09/24/2025

This commit is contained in:
Grayson Butcher 2025-09-24 11:17:37 -06:00
parent e947649cb0
commit e945588f4e
6 changed files with 314 additions and 6 deletions

154
init.lua
View File

@ -50,7 +50,6 @@ Kickstart Guide:
- : - :
- Tutor - Tutor
- <enter key> - <enter key>
(If you already know the Neovim basics, you can skip this step.) (If you already know the Neovim basics, you can skip this step.)
Once you've completed that, you can continue working through **AND READING** the rest Once you've completed that, you can continue working through **AND READING** the rest
@ -102,7 +101,7 @@ vim.g.have_nerd_font = false
vim.opt.number = true vim.opt.number = true
-- You can also add relative line numbers, to help with jumping. -- You can also add relative line numbers, to help with jumping.
-- Experiment for yourself to see if you like it! -- Experiment for yourself to see if you like it!
-- vim.opt.relativenumber = true vim.opt.relativenumber = true
-- Enable mouse mode, can be useful for resizing splits for example! -- Enable mouse mode, can be useful for resizing splits for example!
vim.opt.mouse = 'a' vim.opt.mouse = 'a'
@ -156,6 +155,52 @@ vim.opt.cursorline = true
-- Minimal number of screen lines to keep above and below the cursor. -- Minimal number of screen lines to keep above and below the cursor.
vim.opt.scrolloff = 10 vim.opt.scrolloff = 10
local mode_disabled = false
local filetype_disabled = false
local function check_eof_scrolloff()
if mode_disabled or filetype_disabled then
return
end
local win_height = vim.api.nvim_win_get_height(0)
local win_view = vim.fn.winsaveview()
local scrolloff = math.min(vim.o.scrolloff, math.floor(win_height / 2))
local scrolloff_line_count = win_height - (vim.fn.line 'w$' - win_view.topline + 1)
local distance_to_last_line = vim.fn.line '$' - win_view.lnum
if distance_to_last_line < scrolloff and scrolloff_line_count + distance_to_last_line < scrolloff then
win_view.topline = win_view.topline + scrolloff - (scrolloff_line_count + distance_to_last_line)
vim.fn.winrestview(win_view)
end
end
vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, {
pattern = '*',
callback = check_eof_scrolloff,
})
-- Grayson - Set the width of a tab
vim.opt.tabstop = 4
vim.opt.shiftwidth = 4
vim.opt.softtabstop = 4
-- Grayson - Auto indent settings
vim.opt.expandtab = false
vim.opt.smarttab = true
vim.opt.autoindent = true
vim.opt.smartindent = true
vim.opt.cindent = true
-- Escape insert mode *and* dismiss Copilot suggestions
vim.keymap.set('i', '<Esc>', function()
local ok, suggestion = pcall(require, 'copilot.suggestion')
if ok and suggestion and suggestion.is_visible() then
suggestion.dismiss()
end
return '<Esc>'
end, { expr = true, silent = true })
-- if performing an operation that would fail due to unsaved changes in the buffer (like `:q`), -- if performing an operation that would fail due to unsaved changes in the buffer (like `:q`),
-- instead raise a dialog asking if you wish to save the current file(s) -- instead raise a dialog asking if you wish to save the current file(s)
-- See `:help 'confirm'` -- See `:help 'confirm'`
@ -247,6 +292,61 @@ require('lazy').setup({
-- --
-- Use `opts = {}` to automatically pass options to a plugin's `setup()` function, forcing the plugin to be loaded. -- Use `opts = {}` to automatically pass options to a plugin's `setup()` function, forcing the plugin to be loaded.
-- --
-- Colorizer
{
'norcalli/nvim-colorizer.lua',
config = function()
require('colorizer').setup({
'*', -- Highlight all filetypes
css = { rgb_fn = true },
html = { names = true },
}, {
mode = 'background',
})
end,
},
-- GitHub Copilot
{
'zbirenbaum/copilot.lua',
cmd = 'Copilot',
event = 'InsertEnter',
config = function()
require('copilot').setup {
suggestion = {
enabled = true,
auto_trigger = true,
debounce = 75,
keymap = {
accept = '<Tab>',
next = '<C-j>',
prev = '<C-k>',
dismiss = '<C-c>',
},
},
panel = {
enabled = true,
auto_refresh = false,
keymap = {
jump_prev = '[[',
jump_next = ']]',
accept = '<CR>',
refresh = 'gr',
open = '<M-CR>',
},
},
filetypes = {
markdown = true,
help = false,
gitcommit = true,
gitrebase = true,
['*'] = true, -- enable for all filetypes
},
copilot_node_command = 'node', -- Ensure correct Node.js path
server_opts_overrides = {},
}
end,
},
-- Alternatively, use `config = function() ... end` for full control over the configuration. -- Alternatively, use `config = function() ... end` for full control over the configuration.
-- If you prefer to call `setup` explicitly, use: -- If you prefer to call `setup` explicitly, use:
@ -434,6 +534,9 @@ require('lazy').setup({
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' }) vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
-- Open file explorer
vim.keymap.set('n', '<leader>e', ':Ex<CR>', { desc = '[E]xplorer' })
-- Slightly advanced example of overriding default behavior and theme -- Slightly advanced example of overriding default behavior and theme
vim.keymap.set('n', '<leader>/', function() vim.keymap.set('n', '<leader>/', function()
-- You can pass additional configuration to Telescope to change the theme, layout, etc. -- You can pass additional configuration to Telescope to change the theme, layout, etc.
@ -472,6 +575,7 @@ require('lazy').setup({
}, },
}, },
}, },
{ {
-- Main LSP Configuration -- Main LSP Configuration
'neovim/nvim-lspconfig', 'neovim/nvim-lspconfig',
@ -668,10 +772,50 @@ require('lazy').setup({
-- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features. -- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features.
-- - settings (table): Override the default settings passed when initializing the server. -- - settings (table): Override the default settings passed when initializing the server.
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
local function on_attach(client, bufnr)
if client.name == 'sqls' then
client.server_capabilities.documentFormattingProvider = false
client.server_capabilities.documentRangeFormattingProvider = false
end
end
local servers = { local servers = {
-- clangd = {}, -- clangd = {},
-- gopls = {}, gopls = {},
-- pyright = {}, pyright = {},
jsonls = {
settings = {
json = {
validate = { enable = true },
},
},
},
sqls = {
on_attach = on_attach,
settings = {
sqls = {
connections = {
{
driver = 'postgres',
dataSourceName = 'postgres:postgres@localhost:5432/gator',
schemaSearchPath = { 'public' },
},
},
},
},
},
clangd = {},
html = {},
cssls = {},
ts_ls = {
filetypes = { 'javascript', 'typescript', 'javascriptreact', 'typescriptreact' },
},
jdtls = {},
eslint = {
settings = {
format = { enable = true },
},
},
-- rust_analyzer = {}, -- rust_analyzer = {},
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
-- --
@ -961,7 +1105,7 @@ require('lazy').setup({
main = 'nvim-treesitter.configs', -- Sets main module to use for opts main = 'nvim-treesitter.configs', -- Sets main module to use for opts
-- [[ Configure Treesitter ]] See `:help nvim-treesitter` -- [[ Configure Treesitter ]] See `:help nvim-treesitter`
opts = { opts = {
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }, ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc', 'java' },
-- Autoinstall languages that are not installed -- Autoinstall languages that are not installed
auto_install = true, auto_install = true,
highlight = { highlight = {

35
lua/autopairs-config.lua Normal file
View File

@ -0,0 +1,35 @@
-- autopairs-config.lua
-- Setup autopairs with nvim-cmp.
local status_ok, npairs = pcall(require, 'nvim-autopairs')
if not status_ok then
return
end
npairs.setup {
check_ts = true,
ts_config = {
lua = { 'string', 'source' },
javascript = { 'string', 'template_string' },
java = false,
},
disable_filetype = { 'TelescopePrompt', 'spectre_panel' },
fast_wrap = {
map = '<M-e>',
chars = { '{', '[', '(', '"', "'" },
pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], '%s+', ''),
offset = 0, -- Offset from pattern match
end_key = '$',
keys = 'qwertyuiopzxcvbnmasdfghjkl',
check_comma = true,
highlight = 'PmenuSel',
highlight_grey = 'LineNr',
},
}
local cmp_autopairs = require 'nvim-autopairs.completion.cmp'
local cmp_status_ok, cmp = pcall(require, 'cmp')
if not cmp_status_ok then
return
end
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done { map_char = { tex = '' } })

View File

@ -2,4 +2,21 @@
-- I promise not to create any merge conflicts in this directory :) -- I promise not to create any merge conflicts in this directory :)
-- --
-- See the kickstart.nvim README for more information -- See the kickstart.nvim README for more information
return {} print 'plugins.lua is being loaded'
return {
-- Colorizer
{
'norcalli/nvim-colorizer.lua',
config = function()
require('colorizer').setup({
'*', -- Highlight all filetypes
css = { rgb_fn = true },
html = { names = false },
}, {
mode = 'foreground',
})
end,
},
}

View File

@ -0,0 +1,5 @@
-- lua/kickstart/plugins/copilot-vim.lua
return {
'github/copilot.vim',
event = 'InsertEnter', -- Lazy-load on insert
}

106
lua/plugins.lua Normal file
View File

@ -0,0 +1,106 @@
return {
-- Alpha (Dashboard)
{
'goolord/alpha-nvim',
lazy = true,
},
-- Auto Pairs
-- Added This Plugin
{
'windwp/nvim-autopairs',
},
-- Bufferline
{
'akinsho/bufferline.nvim',
dependencies = {
'nvim-tree/nvim-web-devicons',
},
},
-- Colorscheme
{
'folke/tokyonight.nvim',
},
-- Hop (Better Navigation)
{
'phaazon/hop.nvim',
lazy = true,
},
-- Lualine
{
'nvim-lualine/lualine.nvim',
dependencies = {
'nvim-tree/nvim-web-devicons',
},
},
-- Language Support
{
'VonHeikemen/lsp-zero.nvim',
lazy = true,
branch = 'v1.x',
dependencies = {
-- LSP Support
{ 'neovim/nvim-lspconfig' }, -- Required
{ 'williamboman/mason.nvim' }, -- Optional
{ 'williamboman/mason-lspconfig.nvim' }, -- Optional
-- Autocompletion
{ 'hrsh7th/nvim-cmp' }, -- Required
{ 'hrsh7th/cmp-nvim-lsp' }, -- Required
{ 'hrsh7th/cmp-buffer' }, -- Optional
{ 'hrsh7th/cmp-path' }, -- Optional
{ 'saadparwaiz1/cmp_luasnip' }, -- Optional
{ 'hrsh7th/cmp-nvim-lua' }, -- Optional
-- Snippets
{ 'L3MON4D3/LuaSnip' }, -- Required
{ 'rafamadriz/friendly-snippets' }, -- Optional
},
},
-- Nvimtree (File Explorer)
{
'nvim-tree/nvim-tree.lua',
lazy = true,
dependencies = {
'nvim-tree/nvim-web-devicons',
},
},
-- Telescope (Fuzzy Finder)
{
'nvim-telescope/telescope.nvim',
lazy = true,
dependencies = {
{ 'nvim-lua/plenary.nvim' },
},
},
-- Treesitter
{
'nvim-treesitter/nvim-treesitter',
},
-- Toggle Term
{
'akinsho/toggleterm.nvim',
config = true,
},
-- Which-key
{
'folke/which-key.nvim',
lazy = true,
},
-- Github Copilot
{
'github/copilot.vim',
event = 'InsertEnter',
},
}

@ -0,0 +1 @@
Subproject commit 51f80c0ed4f70d1c7e8c0ff11a792a9d84502c03