Skip to content

Commit e945588

Browse files
committed
09/24/2025
1 parent e947649 commit e945588

File tree

6 files changed

+314
-6
lines changed

6 files changed

+314
-6
lines changed

init.lua

Lines changed: 149 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ Kickstart Guide:
5050
- :
5151
- Tutor
5252
- <enter key>
53-
5453
(If you already know the Neovim basics, you can skip this step.)
5554
5655
Once you've completed that, you can continue working through **AND READING** the rest
@@ -102,7 +101,7 @@ vim.g.have_nerd_font = false
102101
vim.opt.number = true
103102
-- You can also add relative line numbers, to help with jumping.
104103
-- Experiment for yourself to see if you like it!
105-
-- vim.opt.relativenumber = true
104+
vim.opt.relativenumber = true
106105

107106
-- Enable mouse mode, can be useful for resizing splits for example!
108107
vim.opt.mouse = 'a'
@@ -156,6 +155,52 @@ vim.opt.cursorline = true
156155
-- Minimal number of screen lines to keep above and below the cursor.
157156
vim.opt.scrolloff = 10
158157

158+
local mode_disabled = false
159+
local filetype_disabled = false
160+
161+
local function check_eof_scrolloff()
162+
if mode_disabled or filetype_disabled then
163+
return
164+
end
165+
166+
local win_height = vim.api.nvim_win_get_height(0)
167+
local win_view = vim.fn.winsaveview()
168+
local scrolloff = math.min(vim.o.scrolloff, math.floor(win_height / 2))
169+
local scrolloff_line_count = win_height - (vim.fn.line 'w$' - win_view.topline + 1)
170+
local distance_to_last_line = vim.fn.line '$' - win_view.lnum
171+
172+
if distance_to_last_line < scrolloff and scrolloff_line_count + distance_to_last_line < scrolloff then
173+
win_view.topline = win_view.topline + scrolloff - (scrolloff_line_count + distance_to_last_line)
174+
vim.fn.winrestview(win_view)
175+
end
176+
end
177+
178+
vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, {
179+
pattern = '*',
180+
callback = check_eof_scrolloff,
181+
})
182+
183+
-- Grayson - Set the width of a tab
184+
vim.opt.tabstop = 4
185+
vim.opt.shiftwidth = 4
186+
vim.opt.softtabstop = 4
187+
188+
-- Grayson - Auto indent settings
189+
vim.opt.expandtab = false
190+
vim.opt.smarttab = true
191+
vim.opt.autoindent = true
192+
vim.opt.smartindent = true
193+
vim.opt.cindent = true
194+
195+
-- Escape insert mode *and* dismiss Copilot suggestions
196+
vim.keymap.set('i', '<Esc>', function()
197+
local ok, suggestion = pcall(require, 'copilot.suggestion')
198+
if ok and suggestion and suggestion.is_visible() then
199+
suggestion.dismiss()
200+
end
201+
return '<Esc>'
202+
end, { expr = true, silent = true })
203+
159204
-- if performing an operation that would fail due to unsaved changes in the buffer (like `:q`),
160205
-- instead raise a dialog asking if you wish to save the current file(s)
161206
-- See `:help 'confirm'`
@@ -247,6 +292,61 @@ require('lazy').setup({
247292
--
248293
-- Use `opts = {}` to automatically pass options to a plugin's `setup()` function, forcing the plugin to be loaded.
249294
--
295+
-- Colorizer
296+
{
297+
'norcalli/nvim-colorizer.lua',
298+
config = function()
299+
require('colorizer').setup({
300+
'*', -- Highlight all filetypes
301+
css = { rgb_fn = true },
302+
html = { names = true },
303+
}, {
304+
mode = 'background',
305+
})
306+
end,
307+
},
308+
309+
-- GitHub Copilot
310+
{
311+
'zbirenbaum/copilot.lua',
312+
cmd = 'Copilot',
313+
event = 'InsertEnter',
314+
config = function()
315+
require('copilot').setup {
316+
suggestion = {
317+
enabled = true,
318+
auto_trigger = true,
319+
debounce = 75,
320+
keymap = {
321+
accept = '<Tab>',
322+
next = '<C-j>',
323+
prev = '<C-k>',
324+
dismiss = '<C-c>',
325+
},
326+
},
327+
panel = {
328+
enabled = true,
329+
auto_refresh = false,
330+
keymap = {
331+
jump_prev = '[[',
332+
jump_next = ']]',
333+
accept = '<CR>',
334+
refresh = 'gr',
335+
open = '<M-CR>',
336+
},
337+
},
338+
filetypes = {
339+
markdown = true,
340+
help = false,
341+
gitcommit = true,
342+
gitrebase = true,
343+
['*'] = true, -- enable for all filetypes
344+
},
345+
copilot_node_command = 'node', -- Ensure correct Node.js path
346+
server_opts_overrides = {},
347+
}
348+
end,
349+
},
250350

251351
-- Alternatively, use `config = function() ... end` for full control over the configuration.
252352
-- If you prefer to call `setup` explicitly, use:
@@ -434,6 +534,9 @@ require('lazy').setup({
434534
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
435535
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
436536

537+
-- Open file explorer
538+
vim.keymap.set('n', '<leader>e', ':Ex<CR>', { desc = '[E]xplorer' })
539+
437540
-- Slightly advanced example of overriding default behavior and theme
438541
vim.keymap.set('n', '<leader>/', function()
439542
-- You can pass additional configuration to Telescope to change the theme, layout, etc.
@@ -472,6 +575,7 @@ require('lazy').setup({
472575
},
473576
},
474577
},
578+
475579
{
476580
-- Main LSP Configuration
477581
'neovim/nvim-lspconfig',
@@ -668,10 +772,50 @@ require('lazy').setup({
668772
-- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features.
669773
-- - settings (table): Override the default settings passed when initializing the server.
670774
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
775+
local function on_attach(client, bufnr)
776+
if client.name == 'sqls' then
777+
client.server_capabilities.documentFormattingProvider = false
778+
client.server_capabilities.documentRangeFormattingProvider = false
779+
end
780+
end
781+
671782
local servers = {
672783
-- clangd = {},
673-
-- gopls = {},
674-
-- pyright = {},
784+
gopls = {},
785+
pyright = {},
786+
jsonls = {
787+
settings = {
788+
json = {
789+
validate = { enable = true },
790+
},
791+
},
792+
},
793+
sqls = {
794+
on_attach = on_attach,
795+
settings = {
796+
sqls = {
797+
connections = {
798+
{
799+
driver = 'postgres',
800+
dataSourceName = 'postgres:postgres@localhost:5432/gator',
801+
schemaSearchPath = { 'public' },
802+
},
803+
},
804+
},
805+
},
806+
},
807+
clangd = {},
808+
html = {},
809+
cssls = {},
810+
ts_ls = {
811+
filetypes = { 'javascript', 'typescript', 'javascriptreact', 'typescriptreact' },
812+
},
813+
jdtls = {},
814+
eslint = {
815+
settings = {
816+
format = { enable = true },
817+
},
818+
},
675819
-- rust_analyzer = {},
676820
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
677821
--
@@ -961,7 +1105,7 @@ require('lazy').setup({
9611105
main = 'nvim-treesitter.configs', -- Sets main module to use for opts
9621106
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
9631107
opts = {
964-
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' },
1108+
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc', 'java' },
9651109
-- Autoinstall languages that are not installed
9661110
auto_install = true,
9671111
highlight = {

lua/autopairs-config.lua

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
-- autopairs-config.lua
2+
3+
-- Setup autopairs with nvim-cmp.
4+
local status_ok, npairs = pcall(require, 'nvim-autopairs')
5+
if not status_ok then
6+
return
7+
end
8+
9+
npairs.setup {
10+
check_ts = true,
11+
ts_config = {
12+
lua = { 'string', 'source' },
13+
javascript = { 'string', 'template_string' },
14+
java = false,
15+
},
16+
disable_filetype = { 'TelescopePrompt', 'spectre_panel' },
17+
fast_wrap = {
18+
map = '<M-e>',
19+
chars = { '{', '[', '(', '"', "'" },
20+
pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], '%s+', ''),
21+
offset = 0, -- Offset from pattern match
22+
end_key = '$',
23+
keys = 'qwertyuiopzxcvbnmasdfghjkl',
24+
check_comma = true,
25+
highlight = 'PmenuSel',
26+
highlight_grey = 'LineNr',
27+
},
28+
}
29+
30+
local cmp_autopairs = require 'nvim-autopairs.completion.cmp'
31+
local cmp_status_ok, cmp = pcall(require, 'cmp')
32+
if not cmp_status_ok then
33+
return
34+
end
35+
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done { map_char = { tex = '' } })

lua/custom/plugins/init.lua

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,21 @@
22
-- I promise not to create any merge conflicts in this directory :)
33
--
44
-- See the kickstart.nvim README for more information
5-
return {}
5+
print 'plugins.lua is being loaded'
6+
7+
return {
8+
9+
-- Colorizer
10+
{
11+
'norcalli/nvim-colorizer.lua',
12+
config = function()
13+
require('colorizer').setup({
14+
'*', -- Highlight all filetypes
15+
css = { rgb_fn = true },
16+
html = { names = false },
17+
}, {
18+
mode = 'foreground',
19+
})
20+
end,
21+
},
22+
}

lua/kickstart/plugins/copilot.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
-- lua/kickstart/plugins/copilot-vim.lua
2+
return {
3+
'github/copilot.vim',
4+
event = 'InsertEnter', -- Lazy-load on insert
5+
}

lua/plugins.lua

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
return {
2+
3+
-- Alpha (Dashboard)
4+
{
5+
'goolord/alpha-nvim',
6+
lazy = true,
7+
},
8+
9+
-- Auto Pairs
10+
-- Added This Plugin
11+
{
12+
'windwp/nvim-autopairs',
13+
},
14+
15+
-- Bufferline
16+
{
17+
'akinsho/bufferline.nvim',
18+
dependencies = {
19+
'nvim-tree/nvim-web-devicons',
20+
},
21+
},
22+
23+
-- Colorscheme
24+
{
25+
'folke/tokyonight.nvim',
26+
},
27+
28+
-- Hop (Better Navigation)
29+
{
30+
'phaazon/hop.nvim',
31+
lazy = true,
32+
},
33+
34+
-- Lualine
35+
{
36+
'nvim-lualine/lualine.nvim',
37+
dependencies = {
38+
'nvim-tree/nvim-web-devicons',
39+
},
40+
},
41+
42+
-- Language Support
43+
{
44+
'VonHeikemen/lsp-zero.nvim',
45+
lazy = true,
46+
branch = 'v1.x',
47+
dependencies = {
48+
-- LSP Support
49+
{ 'neovim/nvim-lspconfig' }, -- Required
50+
{ 'williamboman/mason.nvim' }, -- Optional
51+
{ 'williamboman/mason-lspconfig.nvim' }, -- Optional
52+
53+
-- Autocompletion
54+
{ 'hrsh7th/nvim-cmp' }, -- Required
55+
{ 'hrsh7th/cmp-nvim-lsp' }, -- Required
56+
{ 'hrsh7th/cmp-buffer' }, -- Optional
57+
{ 'hrsh7th/cmp-path' }, -- Optional
58+
{ 'saadparwaiz1/cmp_luasnip' }, -- Optional
59+
{ 'hrsh7th/cmp-nvim-lua' }, -- Optional
60+
61+
-- Snippets
62+
{ 'L3MON4D3/LuaSnip' }, -- Required
63+
{ 'rafamadriz/friendly-snippets' }, -- Optional
64+
},
65+
},
66+
67+
-- Nvimtree (File Explorer)
68+
{
69+
'nvim-tree/nvim-tree.lua',
70+
lazy = true,
71+
dependencies = {
72+
'nvim-tree/nvim-web-devicons',
73+
},
74+
},
75+
76+
-- Telescope (Fuzzy Finder)
77+
{
78+
'nvim-telescope/telescope.nvim',
79+
lazy = true,
80+
dependencies = {
81+
{ 'nvim-lua/plenary.nvim' },
82+
},
83+
},
84+
85+
-- Treesitter
86+
{
87+
'nvim-treesitter/nvim-treesitter',
88+
},
89+
90+
-- Toggle Term
91+
{
92+
'akinsho/toggleterm.nvim',
93+
config = true,
94+
},
95+
96+
-- Which-key
97+
{
98+
'folke/which-key.nvim',
99+
lazy = true,
100+
},
101+
-- Github Copilot
102+
{
103+
'github/copilot.vim',
104+
event = 'InsertEnter',
105+
},
106+
}

pack/github/start/copilot.vim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 51f80c0ed4f70d1c7e8c0ff11a792a9d84502c03

0 commit comments

Comments
 (0)