diff options
| author | Eugene Triguba <hello@eugenetriguba.com> | 2025-12-03 22:42:03 -0500 |
|---|---|---|
| committer | Eugene Triguba <hello@eugenetriguba.com> | 2025-12-03 22:42:03 -0500 |
| commit | 2bb40c0ab2e10324a6266ef9ac56b7804fec2d13 (patch) | |
| tree | b9de2c3caf56e07fa01c824ba8fb07293a9e9821 /nvim | |
| parent | Fix a couple shellcheck warnings (diff) | |
| download | dotfiles-2bb40c0ab2e10324a6266ef9ac56b7804fec2d13.zip | |
Migrate to nvim pack
Diffstat (limited to 'nvim')
35 files changed, 901 insertions, 1057 deletions
diff --git a/nvim/.config/nvim/.gitignore b/nvim/.config/nvim/.gitignore deleted file mode 100644 index 8b8b7d9..0000000 --- a/nvim/.config/nvim/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/venv - diff --git a/nvim/.config/nvim/after/ftdetect/tiger.lua b/nvim/.config/nvim/after/ftdetect/tiger.lua new file mode 100644 index 0000000..6c84a55 --- /dev/null +++ b/nvim/.config/nvim/after/ftdetect/tiger.lua @@ -0,0 +1,5 @@ +vim.filetype.add { + extension = { + tiger = 'tiger', + }, +} diff --git a/nvim/.config/nvim/ftdetect/tmux.lua b/nvim/.config/nvim/after/ftdetect/tmux.lua index d43c12a..d43c12a 100644 --- a/nvim/.config/nvim/ftdetect/tmux.lua +++ b/nvim/.config/nvim/after/ftdetect/tmux.lua diff --git a/nvim/.config/nvim/after/ftdetect/tpl.lua b/nvim/.config/nvim/after/ftdetect/tpl.lua new file mode 100644 index 0000000..f1ec161 --- /dev/null +++ b/nvim/.config/nvim/after/ftdetect/tpl.lua @@ -0,0 +1,6 @@ +vim.api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, { + pattern = '*.sh.tpl', + callback = function() + vim.bo.filetype = 'sh' + end, +}) diff --git a/nvim/.config/nvim/init.lua b/nvim/.config/nvim/init.lua deleted file mode 100644 index 4a5ce9f..0000000 --- a/nvim/.config/nvim/init.lua +++ /dev/null @@ -1 +0,0 @@ -require 'eugenetriguba' diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json deleted file mode 100644 index e9d4a25..0000000 --- a/nvim/.config/nvim/lazy-lock.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "CopilotChat.nvim": { "branch": "main", "commit": "f68deee85b8d734db1a9fbf63ce17a8164921267" }, - "LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" }, - "barbar.nvim": { "branch": "master", "commit": "53b5a2f34b68875898f0531032fbf090e3952ad7" }, - "blink-cmp-copilot": { "branch": "main", "commit": "439cff78780c033aa23cf061d7315314b347e3c1" }, - "blink.cmp": { "branch": "main", "commit": "bae4bae0eedd1fa55f34b685862e94a222d5c6f8" }, - "conform.nvim": { "branch": "master", "commit": "2dae54343f3c3fe31b3058188684dcd903e9d00f" }, - "copilot.lua": { "branch": "master", "commit": "92e08cd472653beaece28ad9c8508a851a613358" }, - "fidget.nvim": { "branch": "main", "commit": "2cb5edb2dd6700a958a446b20bb2be04d318da9d" }, - "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, - "gitsigns.nvim": { "branch": "main", "commit": "6e3c66548035e50db7bd8e360a29aec6620c3641" }, - "harpoon": { "branch": "harpoon2", "commit": "ed1f853847ffd04b2b61c314865665e1dadf22c7" }, - "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, - "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, - "lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" }, - "lazygit.nvim": { "branch": "main", "commit": "3c524ebec6072568064235c407195e9f9fd0cb8a" }, - "lualine.nvim": { "branch": "master", "commit": "b8c23159c0161f4b89196f74ee3a6d02cdc3a955" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "1ec4da522fa49dcecee8d190efda273464dd2192" }, - "mason-tool-installer.nvim": { "branch": "main", "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" }, - "mason.nvim": { "branch": "main", "commit": "7dc4facca9702f95353d5a1f87daf23d78e31c2a" }, - "mini.icons": { "branch": "main", "commit": "b8f6fa6f5a3fd0c56936252edcd691184e5aac0c" }, - "mini.nvim": { "branch": "main", "commit": "5d938b3a078a7eeae23ba9f04f180066ab8bd9ef" }, - "nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" }, - "nvim-dap": { "branch": "master", "commit": "881f7dc17c0b4204a1d844732f95539575350e5b" }, - "nvim-dap-go": { "branch": "main", "commit": "b4421153ead5d726603b02743ea40cf26a51ed5f" }, - "nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" }, - "nvim-lint": { "branch": "master", "commit": "7ef127aaede2a4d5ad8df8321e2eb4e567f29594" }, - "nvim-lspconfig": { "branch": "master", "commit": "34c9ecfdcc19d579f51c072300a71445fbec9da8" }, - "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, - "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, - "nvim-treesitter-context": { "branch": "master", "commit": "dca8726fea2c14e1ce6adbaa76a04816fbfaff61" }, - "nvim-web-devicons": { "branch": "master", "commit": "c2599a81ecabaae07c49ff9b45dcd032a8d90f1a" }, - "oil.nvim": { "branch": "master", "commit": "bbad9a76b2617ce1221d49619e4e4b659b3c61fc" }, - "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, - "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" }, - "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, - "telescope.nvim": { "branch": "master", "commit": "b4da76be54691e854d3e0e02c36b0245f945c2c7" }, - "tokyonight.nvim": { "branch": "main", "commit": "057ef5d260c1931f1dffd0f052c685dcd14100a3" }, - "trouble.nvim": { "branch": "main", "commit": "c098362fe603d3922095e7db595961e020bdf2d0" }, - "vim-tmux-navigator": { "branch": "master", "commit": "c45243dc1f32ac6bcf6068e5300f3b2b237e576a" }, - "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" } -} diff --git a/nvim/.config/nvim/lua/eugenetriguba/init.lua b/nvim/.config/nvim/lua/eugenetriguba/init.lua deleted file mode 100644 index ac79aec..0000000 --- a/nvim/.config/nvim/lua/eugenetriguba/init.lua +++ /dev/null @@ -1,5 +0,0 @@ -require 'eugenetriguba.global' -require 'eugenetriguba.lazy' -require 'eugenetriguba.keymaps' -require 'eugenetriguba.autocmds' -require 'eugenetriguba.options' diff --git a/nvim/.config/nvim/lua/eugenetriguba/lazy.lua b/nvim/.config/nvim/lua/eugenetriguba/lazy.lua deleted file mode 100644 index ff5b33d..0000000 --- a/nvim/.config/nvim/lua/eugenetriguba/lazy.lua +++ /dev/null @@ -1,23 +0,0 @@ -local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' -if not (vim.uv or vim.loop).fs_stat(lazypath) then - local lazyrepo = 'https://github.com/folke/lazy.nvim.git' - local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath } - if vim.v.shell_error ~= 0 then - vim.api.nvim_echo({ - { 'Failed to clone lazy.nvim:\n', 'ErrorMsg' }, - { out, 'WarningMsg' }, - { '\nPress any key to exit...' }, - }, true, {}) - vim.fn.getchar() - os.exit(1) - end -end -vim.opt.rtp:prepend(lazypath) - -require('lazy').setup { - spec = { - { import = 'eugenetriguba.plugins' }, - }, - install = { colorscheme = { 'tokyonight' } }, - checker = { enabled = true, notify = false }, -} diff --git a/nvim/.config/nvim/lua/eugenetriguba/plugins/barbar.lua b/nvim/.config/nvim/lua/eugenetriguba/plugins/barbar.lua deleted file mode 100644 index 7056c97..0000000 --- a/nvim/.config/nvim/lua/eugenetriguba/plugins/barbar.lua +++ /dev/null @@ -1,70 +0,0 @@ -return { - { - 'romgrk/barbar.nvim', - dependencies = { - 'lewis6991/gitsigns.nvim', - 'nvim-tree/nvim-web-devicons', - }, - init = function() - vim.g.barbar_auto_setup = false - end, - version = '^1.0.0', - config = function() - require('barbar').setup {} - - local map = vim.api.nvim_set_keymap - local opts = { noremap = true, silent = true } - - -- Move to previous/next - map('n', '<A-,>', '<Cmd>BufferPrevious<CR>', opts) - map('n', '<A-.>', '<Cmd>BufferNext<CR>', opts) - - -- Re-order to previous/next - map('n', '<A-<>', '<Cmd>BufferMovePrevious<CR>', opts) - map('n', '<A->>', '<Cmd>BufferMoveNext<CR>', opts) - - -- Goto buffer in position... - map('n', '<A-1>', '<Cmd>BufferGoto 1<CR>', opts) - map('n', '<A-2>', '<Cmd>BufferGoto 2<CR>', opts) - map('n', '<A-3>', '<Cmd>BufferGoto 3<CR>', opts) - map('n', '<A-4>', '<Cmd>BufferGoto 4<CR>', opts) - map('n', '<A-5>', '<Cmd>BufferGoto 5<CR>', opts) - map('n', '<A-6>', '<Cmd>BufferGoto 6<CR>', opts) - map('n', '<A-7>', '<Cmd>BufferGoto 7<CR>', opts) - map('n', '<A-8>', '<Cmd>BufferGoto 8<CR>', opts) - map('n', '<A-9>', '<Cmd>BufferGoto 9<CR>', opts) - map('n', '<A-0>', '<Cmd>BufferLast<CR>', opts) - - -- Pin/unpin buffer - map('n', '<A-p>', '<Cmd>BufferPin<CR>', opts) - - -- Goto pinned/unpinned buffer - -- :BufferGotoPinned - -- :BufferGotoUnpinned - - -- Close buffer - map('n', '<A-c>', '<Cmd>BufferClose<CR>', opts) - - -- Wipeout buffer - -- :BufferWipeout - - -- Close commands - -- :BufferCloseAllButCurrent - -- :BufferCloseAllButPinned - -- :BufferCloseAllButCurrentOrPinned - -- :BufferCloseBuffersLeft - -- :BufferCloseBuffersRight - - -- Magic buffer-picking mode - map('n', '<C-p>', '<Cmd>BufferPick<CR>', opts) - map('n', '<C-s-p>', '<Cmd>BufferPickDelete<CR>', opts) - - -- Sort automatically by... - map('n', '<Space>bb', '<Cmd>BufferOrderByBufferNumber<CR>', opts) - map('n', '<Space>bn', '<Cmd>BufferOrderByName<CR>', opts) - map('n', '<Space>bd', '<Cmd>BufferOrderByDirectory<CR>', opts) - map('n', '<Space>bl', '<Cmd>BufferOrderByLanguage<CR>', opts) - map('n', '<Space>bw', '<Cmd>BufferOrderByWindowNumber<CR>', opts) - end, - }, -} diff --git a/nvim/.config/nvim/lua/eugenetriguba/plugins/blink.lua b/nvim/.config/nvim/lua/eugenetriguba/plugins/blink.lua deleted file mode 100644 index a4fd085..0000000 --- a/nvim/.config/nvim/lua/eugenetriguba/plugins/blink.lua +++ /dev/null @@ -1,62 +0,0 @@ -return { - { - 'https://github.com/saghen/blink.cmp', - build = 'cargo +nightly build --release', - event = 'VimEnter', - version = '*', - dependencies = { - { - 'https://github.com/L3MON4D3/LuaSnip', - version = '2.*', - build = (function() - if vim.fn.has 'win32' == 1 or vim.fn.executable 'make' == 0 then - return - end - return 'make install_jsregexp' - end)(), - dependencies = { - { - 'rafamadriz/friendly-snippets', - config = function() - require('luasnip.loaders.from_vscode').lazy_load() - end, - }, - }, - opts = {}, - }, - 'https://github.com/folke/lazydev.nvim', - 'https://github.com/giuxtaposition/blink-cmp-copilot', - }, - --- @module 'blink.cmp' - --- @type blink.cmp.Config - opts = { - keymap = { - preset = 'default', - }, - - appearance = { - nerd_font_variant = 'mono', - }, - - completion = { - documentation = { auto_show = true, auto_show_delay_ms = 500 }, - }, - - sources = { - default = { 'lsp', 'path', 'snippets', 'lazydev', 'copilot' }, - providers = { - lazydev = { module = 'lazydev.integrations.blink', score_offset = 100 }, - copilot = { - name = 'copilot', - module = 'blink-cmp-copilot', - score_offset = 100, - async = true, - }, - }, - }, - snippets = { preset = 'luasnip' }, - fuzzy = { implementation = 'prefer_rust_with_warning' }, - signature = { enabled = true }, - }, - }, -} diff --git a/nvim/.config/nvim/lua/eugenetriguba/plugins/colorizer.lua b/nvim/.config/nvim/lua/eugenetriguba/plugins/colorizer.lua deleted file mode 100644 index 199c59e..0000000 --- a/nvim/.config/nvim/lua/eugenetriguba/plugins/colorizer.lua +++ /dev/null @@ -1,6 +0,0 @@ -return { - { - 'norcalli/nvim-colorizer.lua', - opts = {}, - }, -} diff --git a/nvim/.config/nvim/lua/eugenetriguba/plugins/colorschemes.lua b/nvim/.config/nvim/lua/eugenetriguba/plugins/colorschemes.lua deleted file mode 100644 index 8e4a07a..0000000 --- a/nvim/.config/nvim/lua/eugenetriguba/plugins/colorschemes.lua +++ /dev/null @@ -1,14 +0,0 @@ -return { - { - 'folke/tokyonight.nvim', - priority = 1000, - config = function() - require('tokyonight').setup { - styles = { - comments = { italic = false }, - }, - } - vim.cmd.colorscheme 'tokyonight' - end, - }, -} diff --git a/nvim/.config/nvim/lua/eugenetriguba/plugins/conform.lua b/nvim/.config/nvim/lua/eugenetriguba/plugins/conform.lua deleted file mode 100644 index 7c17bd6..0000000 --- a/nvim/.config/nvim/lua/eugenetriguba/plugins/conform.lua +++ /dev/null @@ -1,131 +0,0 @@ -return { - { - 'https://github.com/stevearc/conform.nvim', - event = { 'BufWritePre' }, - cmd = { 'ConformInfo' }, - lazy = false, - keys = { - { - '<leader>bf', - function() - require('conform').format { async = true, lsp_format = 'fallback' } - end, - mode = '', - desc = '[B]uffer [F]ormat', - }, - { - '<leader>tf', - function() - -- If autoformat is currently disabled for this buffer, - -- then enable it, otherwise disable it - if vim.b.disable_autoformat then - vim.cmd 'FormatEnable' - vim.notify 'Enabled autoformat for current buffer' - else - vim.cmd 'FormatDisable!' - vim.notify 'Disabled autoformat for current buffer' - end - end, - desc = 'Toggle autoformat for current buffer', - }, - { - '<leader>tF', - function() - -- If autoformat is currently disabled globally, - -- then enable it globally, otherwise disable it globally - if vim.g.disable_autoformat then - vim.cmd 'FormatEnable' - vim.notify 'Enabled autoformat globally' - else - vim.cmd 'FormatDisable' - vim.notify 'Disabled autoformat globally' - end - end, - desc = 'Toggle autoformat globally', - }, - }, - ---@module "conform" - ---@type conform.setupOpts - opts = { - notify_on_error = false, - format_on_save = function(bufnr) - -- Disable with a global or buffer-local variable - if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then - return - end - - -- Disable "format_on_save lsp_fallback" for certain languages. - local disable_filetypes = { sql = true } - if disable_filetypes[vim.bo[bufnr].filetype] then - return nil - end - - return { - timeout_ms = 3000, - lsp_format = 'fallback', - } - end, - formatters_by_ft = { - c = { 'clang-format' }, - lua = { 'stylua' }, - go = { 'gofmt' }, - python = { 'black', 'isort' }, - rust = { 'rustfmt' }, - sh = { 'shfmt' }, - xml = { 'xmlformatter' }, - md = { 'prettierd', 'prettier', stop_after_first = true }, - yaml = { 'prettierd', 'prettier', stop_after_first = true }, - json = { 'prettierd', 'prettier', stop_after_first = true }, - javascript = { 'prettierd', 'prettier', stop_after_first = true }, - typescript = { 'prettierd', 'prettier', stop_after_first = true }, - javascriptreact = { 'prettierd', 'prettier', stop_after_first = true }, - typescriptreact = { 'prettierd', 'prettier', stop_after_first = true }, - css = { 'prettierd', 'prettier', stop_after_first = true }, - htmldjango = { 'prettierd', 'prettier', stop_after_first = true }, - html = { 'prettierd', 'prettier', stop_after_first = true }, - tf = { 'terraform_fmt' }, - nix = { 'nixfmt' }, - java = { 'google-java-format' }, - }, - formatters = { - isort = { - prepend_args = { '--profile', 'black' }, - }, - xmlformatter = { - command = function() - local python_path = vim.g.python3_host_prog - if python_path and python_path ~= '' then - local venv_bin = vim.fn.fnamemodify(python_path, ':h') - return venv_bin .. '/xmlformat' - end - return 'xmlformat' - end, - prepend_args = { '--blanks' }, - }, - }, - }, - config = function(_, opts) - require('conform').setup(opts) - - vim.api.nvim_create_user_command('FormatDisable', function(args) - if args.bang then - -- :FormatDisable! disables autoformat for this buffer only - vim.b.disable_autoformat = true - else - -- :FormatDisable disables autoformat globally - vim.g.disable_autoformat = true - end - end, { - desc = 'Disable autoformat-on-save', - bang = true, -- allows the ! variant - }) - - vim.api.nvim_create_user_command('FormatEnable', function() - vim.b.disable_autoformat = false - vim.g.disable_autoformat = false - end, { - desc = 'Re-enable autoformat-on-save', - }) - end, - }, -} diff --git a/nvim/.config/nvim/lua/eugenetriguba/plugins/copilot.lua b/nvim/.config/nvim/lua/eugenetriguba/plugins/copilot.lua deleted file mode 100644 index 32060a5..0000000 --- a/nvim/.config/nvim/lua/eugenetriguba/plugins/copilot.lua +++ /dev/null @@ -1,30 +0,0 @@ -return { - { - 'https://github.com/zbirenbaum/copilot.lua', - cmd = 'Copilot', - event = 'InsertEnter', - config = function() - require('copilot').setup { - suggestion = { enabled = false }, - panel = { enabled = false }, - } - end, - }, - { - 'https://github.com/CopilotC-Nvim/CopilotChat.nvim', - event = 'VeryLazy', - dependencies = { - { 'https://github.com/zbirenbaum/copilot.lua' }, - { 'https://github.com/nvim-lua/plenary.nvim', branch = 'master' }, - }, - build = 'make tiktoken', - config = function() - require('CopilotChat').setup { - model = 'claude-sonnet-4.5', - vim.keymap.set('n', '<leader>tc', function() - vim.cmd 'CopilotChatToggle' - end, { desc = '[T]oggle [C]opilot Chat' }), - } - end, - }, -} diff --git a/nvim/.config/nvim/lua/eugenetriguba/plugins/dap.lua b/nvim/.config/nvim/lua/eugenetriguba/plugins/dap.lua deleted file mode 100644 index 35d80b5..0000000 --- a/nvim/.config/nvim/lua/eugenetriguba/plugins/dap.lua +++ /dev/null @@ -1,44 +0,0 @@ -return { - 'mfussenegger/nvim-dap', - dependencies = { - 'https://github.com/nvim-neotest/nvim-nio', - 'https://github.com/rcarriga/nvim-dap-ui', - 'https://github.com/leoluz/nvim-dap-go', - }, - config = function() - local dap = require 'dap' - local dapui = require 'dapui' - - dapui.setup() - require('dap-go').setup { - dap_configurations = { - { - type = 'go', - name = 'Attach remote', - mode = 'remote', - request = 'attach', - }, - }, - } - - dap.listeners.after.event_initialized['dapui_config'] = function() - dapui.open() - end - dap.listeners.before.event_terminated['dapui_config'] = function() - dapui.close() - end - dap.listeners.before.event_exited['dapui_config'] = function() - dapui.close() - end - - vim.keymap.set('n', '<leader>db', dap.toggle_breakpoint, { desc = 'Toggle Breakpoint' }) - vim.keymap.set('n', '<leader>dc', dap.continue, { desc = 'Continue' }) - vim.keymap.set('n', '<leader>ds', dap.step_over, { desc = 'Step Over' }) - vim.keymap.set('n', '<leader>di', dap.step_into, { desc = 'Step Into' }) - vim.keymap.set('n', '<leader>do', dap.step_out, { desc = 'Step Out' }) - vim.keymap.set('n', '<leader>du', dapui.toggle, { desc = 'Toggle DAP UI' }) - vim.keymap.set('n', '<leader>dr', dap.repl.open, { desc = 'Open REPL' }) - vim.keymap.set('n', '<leader>dgt', ':DapGoTest<CR>', { desc = 'Debug Go Test' }) - vim.keymap.set('n', '<leader>dgT', ':DapGoTestFunc<CR>', { desc = 'Debug Go Test Function' }) - end, -} diff --git a/nvim/.config/nvim/lua/eugenetriguba/plugins/gitsigns.lua b/nvim/.config/nvim/lua/eugenetriguba/plugins/gitsigns.lua deleted file mode 100644 index 341b947..0000000 --- a/nvim/.config/nvim/lua/eugenetriguba/plugins/gitsigns.lua +++ /dev/null @@ -1,64 +0,0 @@ -return { - { - 'https://github.com/lewis6991/gitsigns.nvim', - opts = { - signs = { - add = { text = '+' }, - change = { text = '~' }, - delete = { text = '_' }, - topdelete = { text = '‾' }, - changedelete = { text = '~' }, - }, - on_attach = function(bufnr) - local gitsigns = require 'gitsigns' - - local function map(mode, l, r, opts) - opts = opts or {} - opts.buffer = bufnr - vim.keymap.set(mode, l, r, opts) - end - - -- Navigation - map('n', ']c', function() - if vim.wo.diff then - vim.cmd.normal { ']c', bang = true } - else - gitsigns.nav_hunk 'next' - end - end, { desc = 'Jump to next git [c]hange' }) - - map('n', '[c', function() - if vim.wo.diff then - vim.cmd.normal { '[c', bang = true } - else - gitsigns.nav_hunk 'prev' - end - end, { desc = 'Jump to previous git [c]hange' }) - - -- Actions - -- visual mode - map('v', '<leader>hs', function() - gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' } - end, { desc = 'git [s]tage hunk' }) - map('v', '<leader>hr', function() - gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' } - end, { desc = 'git [r]eset hunk' }) - -- normal mode - map('n', '<leader>hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' }) - map('n', '<leader>hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' }) - map('n', '<leader>hS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer' }) - map('n', '<leader>hu', gitsigns.stage_hunk, { desc = 'git [u]ndo stage hunk' }) - map('n', '<leader>hR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' }) - map('n', '<leader>hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' }) - map('n', '<leader>hb', gitsigns.blame_line, { desc = 'git [b]lame line' }) - map('n', '<leader>hd', gitsigns.diffthis, { desc = 'git [d]iff against index' }) - map('n', '<leader>hD', function() - gitsigns.diffthis '@' - end, { desc = 'git [D]iff against last commit' }) - -- Toggles - map('n', '<leader>tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' }) - map('n', '<leader>tD', gitsigns.preview_hunk_inline, { desc = '[T]oggle git show [D]eleted' }) - end, - }, - }, -} diff --git a/nvim/.config/nvim/lua/eugenetriguba/plugins/harpoon.lua b/nvim/.config/nvim/lua/eugenetriguba/plugins/harpoon.lua deleted file mode 100644 index bb2dad2..0000000 --- a/nvim/.config/nvim/lua/eugenetriguba/plugins/harpoon.lua +++ /dev/null @@ -1,40 +0,0 @@ -return { - 'https://github.com/ThePrimeagen/harpoon', - branch = 'harpoon2', - dependencies = { 'https://github.com/nvim-lua/plenary.nvim' }, - config = function() - local harpoon = require 'harpoon' - harpoon:setup() - - vim.keymap.set('n', '<leader>a', function() - harpoon:list():add() - end) - vim.keymap.set('n', '<C-e>', function() - harpoon.ui:toggle_quick_menu(harpoon:list()) - end) - - vim.keymap.set('n', '<leader>1', function() - harpoon:list():select(1) - end) - vim.keymap.set('n', '<leader>2', function() - harpoon:list():select(2) - end) - vim.keymap.set('n', '<leader>3', function() - harpoon:list():select(3) - end) - vim.keymap.set('n', '<leader>4', function() - harpoon:list():select(4) - end) - - vim.keymap.set('n', '<C-x>', function() - harpoon:list():clear() - end, { desc = 'Clear Harpoon list' }) - - vim.keymap.set('n', '<leader>hp', function() - harpoon:list():prev() - end) - vim.keymap.set('n', '<leader>hn', function() - harpoon:list():next() - end) - end, -} diff --git a/nvim/.config/nvim/lua/eugenetriguba/plugins/indent_line.lua b/nvim/.config/nvim/lua/eugenetriguba/plugins/indent_line.lua deleted file mode 100644 index c098a80..0000000 --- a/nvim/.config/nvim/lua/eugenetriguba/plugins/indent_line.lua +++ /dev/null @@ -1,7 +0,0 @@ -return { - { - 'lukas-reineke/indent-blankline.nvim', - main = 'ibl', - opts = {}, - }, -} diff --git a/nvim/.config/nvim/lua/eugenetriguba/plugins/lazygit.lua b/nvim/.config/nvim/lua/eugenetriguba/plugins/lazygit.lua deleted file mode 100644 index 17cb1c2..0000000 --- a/nvim/.config/nvim/lua/eugenetriguba/plugins/lazygit.lua +++ /dev/null @@ -1,17 +0,0 @@ -return { - 'https://github.com/kdheepak/lazygit.nvim', - lazy = true, - cmd = { - 'LazyGit', - 'LazyGitConfig', - 'LazyGitCurrentFile', - 'LazyGitFilter', - 'LazyGitFilterCurrentFile', - }, - dependencies = { - 'https://github.com/nvim-lua/plenary.nvim', - }, - keys = { - { '<leader>lg', '<cmd>LazyGit<cr>', desc = 'LazyGit' }, - }, -} diff --git a/nvim/.config/nvim/lua/eugenetriguba/plugins/lint.lua b/nvim/.config/nvim/lua/eugenetriguba/plugins/lint.lua deleted file mode 100644 index eda0b19..0000000 --- a/nvim/.config/nvim/lua/eugenetriguba/plugins/lint.lua +++ /dev/null @@ -1,68 +0,0 @@ -return { - { - 'https://github.com/mfussenegger/nvim-lint', - event = { 'BufReadPre', 'BufNewFile' }, - config = function() - -- Default linters, which will cause errors unless these tools are available: - -- { - -- clojure = { "clj-kondo" }, - -- dockerfile = { "hadolint" }, - -- inko = { "inko" }, - -- janet = { "janet" }, - -- json = { "jsonlint" }, - -- markdown = { "vale" }, - -- rst = { "vale" }, - -- ruby = { "ruby" }, - -- terraform = { "tflint" }, - -- text = { "vale" } - -- } - -- - -- They can be disabled by setting their filetypes to nil: - -- lint.linters_by_ft['clojure'] = nil - - local lint = require 'lint' - - local pattern = '[^:]+:(%d+): [^:]+: (.*)' - local groups = { 'lnum', 'message' } - local severities = nil - lint.linters.xmllint = { - name = 'xmllint', - cmd = 'xmllint', - stream = 'stderr', - args = { '--noout' }, - stdin = false, - append_fname = true, - ignore_exitcode = true, - parser = require('lint.parser').from_pattern(pattern, groups, severities, { - source = 'xmllint', - severity = vim.diagnostic.severity.ERROR, - }), - } - - lint.linters_by_ft = lint.linters_by_ft or {} - lint.linters_by_ft['cpp'] = { 'cppcheck' } - lint.linters_by_ft['dockerfile'] = { 'hadolint' } - lint.linters_by_ft['json'] = { 'jsonlint' } - lint.linters_by_ft['terraform'] = { 'tflint', 'terraform_validate' } - lint.linters_by_ft['python'] = { 'ruff', 'bandit' } - lint.linters_by_ft['markdown'] = nil - lint.linters_by_ft['text'] = nil - lint.linters_by_ft['xml'] = { 'xmllint' } - lint.linters_by_ft['sh'] = { 'shellcheck' } - table.insert(lint.linters.shellcheck.args, '-x') - - local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true }) - vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, { - group = lint_augroup, - callback = function() - -- Only run the linter in buffers that you can modify in order to - -- avoid superfluous noise, notably within the handy LSP pop-ups that - -- describe the hovered symbol using Markdown. - if vim.opt_local.modifiable:get() then - lint.try_lint() - end - end, - }) - end, - }, -} diff --git a/nvim/.config/nvim/lua/eugenetriguba/plugins/lsp.lua b/nvim/.config/nvim/lua/eugenetriguba/plugins/lsp.lua deleted file mode 100644 index ec9ddf0..0000000 --- a/nvim/.config/nvim/lua/eugenetriguba/plugins/lsp.lua +++ /dev/null @@ -1,204 +0,0 @@ -return { - { - 'folke/lazydev.nvim', - ft = 'lua', - opts = { - library = { - -- Load luvit types when the `vim.uv` word is found - { path = '${3rd}/luv/library', words = { 'vim%.uv' } }, - }, - }, - }, - { - 'neovim/nvim-lspconfig', - dependencies = { - { 'williamboman/mason.nvim', opts = {} }, - 'williamboman/mason-lspconfig.nvim', - 'WhoIsSethDaniel/mason-tool-installer.nvim', - { 'j-hui/fidget.nvim', opts = {} }, - 'saghen/blink.cmp', - }, - config = function() - vim.api.nvim_create_autocmd('LspAttach', { - group = vim.api.nvim_create_augroup('lsp-attach', { clear = true }), - callback = function(event) - local map = function(keys, func, desc, mode) - mode = mode or 'n' - vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) - end - - map('grn', vim.lsp.buf.rename, '[R]e[n]ame') - map('gra', vim.lsp.buf.code_action, '[G]oto Code [A]ction', { 'n', 'x' }) - map('grr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') - map('gri', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') - map('grd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') - map('grD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') - map('gO', require('telescope.builtin').lsp_document_symbols, 'Open Document Symbols') - map('gW', require('telescope.builtin').lsp_dynamic_workspace_symbols, 'Open Workspace Symbols') - map('grt', require('telescope.builtin').lsp_type_definitions, '[G]oto [T]ype Definition') - - -- The following two autocommands are used to highlight references of the - -- word under your cursor when your cursor rests there for a little while. - -- See `:help CursorHold` for information about when this is executed - -- - -- When you move your cursor, the highlights will be cleared (the second autocommand). - local client = vim.lsp.get_client_by_id(event.data.client_id) - if client and client:supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) then - local highlight_augroup = vim.api.nvim_create_augroup('lsp-highlight', { clear = false }) - vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { - buffer = event.buf, - group = highlight_augroup, - callback = vim.lsp.buf.document_highlight, - }) - - vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, { - buffer = event.buf, - group = highlight_augroup, - callback = vim.lsp.buf.clear_references, - }) - - vim.api.nvim_create_autocmd('LspDetach', { - group = vim.api.nvim_create_augroup('lsp-detach', { clear = true }), - callback = function(event2) - vim.lsp.buf.clear_references() - vim.api.nvim_clear_autocmds { group = 'lsp-highlight', buffer = event2.buf } - end, - }) - end - - if client and client:supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then - map('<leader>th', function() - vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf }) - end, '[T]oggle Inlay [H]ints') - end - end, - }) - - vim.diagnostic.config { - severity_sort = true, - float = { border = 'rounded', source = 'if_many' }, - underline = { severity = vim.diagnostic.severity.ERROR }, - signs = vim.g.have_nerd_font and { - text = { - [vim.diagnostic.severity.ERROR] = ' ', - [vim.diagnostic.severity.WARN] = ' ', - [vim.diagnostic.severity.INFO] = ' ', - [vim.diagnostic.severity.HINT] = ' ', - }, - } or {}, - virtual_text = { - source = 'if_many', - spacing = 2, - format = function(diagnostic) - local diagnostic_message = { - [vim.diagnostic.severity.ERROR] = diagnostic.message, - [vim.diagnostic.severity.WARN] = diagnostic.message, - [vim.diagnostic.severity.INFO] = diagnostic.message, - [vim.diagnostic.severity.HINT] = diagnostic.message, - } - return diagnostic_message[diagnostic.severity] - end, - }, - } - - local capabilities = require('blink.cmp').get_lsp_capabilities() - local servers = { - clangd = {}, - gopls = {}, - pyright = { - settings = { - python = { - analysis = { - autoImportCompletions = true, - }, - }, - }, - }, - rust_analyzer = {}, - -- NOTE: https://github.com/pmizio/typescript-tools.nvim may be a better - -- LSP to use here at some point. - ts_ls = {}, - lua_ls = { - settings = { - Lua = { - completion = { - callSnippet = 'Replace', - }, - }, - }, - }, - stylua = {}, - tailwindcss = {}, - mesonlsp = {}, - terraformls = {}, - bashls = {}, - jdtls = { - settings = { - java = { - configuration = { - updateBuildConfiguration = 'interactive', - refreshBundles = true, - }, - completion = { - favoriteStaticMembers = { - 'org.hamcrest.MatcherAssert.assertThat', - 'org.hamcrest.Matchers.*', - 'org.hamcrest.CoreMatchers.*', - 'org.junit.jupiter.api.Assertions.*', - 'java.util.Objects.requireNonNull', - 'java.util.Objects.requireNonNullElse', - }, - }, - contentProvider = { preferred = 'fernflower' }, - eclipse = { - downloadSources = true, - }, - implementationsCodeLens = { - enabled = true, - }, - inlayHints = { - parameterNames = { - enabled = 'all', -- literals, all, none - }, - }, - maven = { - downloadSources = true, - }, - referencesCodeLens = { - enabled = true, - }, - references = { - includeDecompiledSources = true, - }, - saveActions = { - organizeImports = true, - }, - signatureHelp = { enabled = true }, - sources = { - organizeImports = { - starThreshold = 9999, - staticStarThreshold = 9999, - }, - }, - }, - }, - }, - } - - local ensure_installed = vim.tbl_keys(servers or {}) - require('mason-tool-installer').setup { ensure_installed = ensure_installed } - require('mason-lspconfig').setup { - ensure_installed = {}, - automatic_installation = false, - automatic_enable = true, - handlers = { - function(server_name) - local server = servers[server_name] or {} - server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) - require('lspconfig')[server_name].setup(server) - end, - }, - } - end, - }, -} diff --git a/nvim/.config/nvim/lua/eugenetriguba/plugins/lualine.lua b/nvim/.config/nvim/lua/eugenetriguba/plugins/lualine.lua deleted file mode 100644 index d7b5c70..0000000 --- a/nvim/.config/nvim/lua/eugenetriguba/plugins/lualine.lua +++ /dev/null @@ -1,14 +0,0 @@ -return { - { - 'https://github.com/nvim-lualine/lualine.nvim', - event = 'VeryLazy', - dependencies = { 'https://github.com/nvim-tree/nvim-web-devicons' }, - opts = { - options = { - theme = 'tokyonight', - component_separators = { left = '|', right = '|' }, - section_separators = { left = '', right = '' }, - }, - }, - }, -} diff --git a/nvim/.config/nvim/lua/eugenetriguba/plugins/mini.lua b/nvim/.config/nvim/lua/eugenetriguba/plugins/mini.lua deleted file mode 100644 index bfe7ae8..0000000 --- a/nvim/.config/nvim/lua/eugenetriguba/plugins/mini.lua +++ /dev/null @@ -1,25 +0,0 @@ -return { - { - 'https://github.com/nvim-mini/mini.nvim', - config = function() - require('mini.pairs').setup() - require('mini.git').setup() - require('mini.tabline').setup() - - -- Better Around/Inside textobjects - -- - -- Examples: - -- - va) - [V]isually select [A]round [)]paren - -- - yinq - [Y]ank [I]nside [N]ext [Q]uote - -- - ci' - [C]hange [I]nside [']quote - require('mini.ai').setup { n_lines = 500 } - - -- Add/delete/replace surroundings (brackets, quotes, etc.) - -- - -- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren - -- - sd' - [S]urround [D]elete [']quotes - -- - sr)' - [S]urround [R]eplace [)] ['] - require('mini.surround').setup() - end, - }, -} diff --git a/nvim/.config/nvim/lua/eugenetriguba/plugins/oil.lua b/nvim/.config/nvim/lua/eugenetriguba/plugins/oil.lua deleted file mode 100644 index 9b24e51..0000000 --- a/nvim/.config/nvim/lua/eugenetriguba/plugins/oil.lua +++ /dev/null @@ -1,19 +0,0 @@ -return { - 'https://github.com/stevearc/oil.nvim', - ---@module 'oil' - ---@type oil.SetupOpts - opts = {}, - dependencies = { { 'https://github.com/nvim-mini/mini.icons', opts = {} } }, - config = function(_, opts) - vim.keymap.set('n', '\\', '<CMD>Oil --float<CR>', { desc = 'Open parent directory in floating window' }) - vim.keymap.set('n', '-', '<CMD>Oil<CR>', { desc = 'Open parent directory' }) - require('oil').setup { - keymaps = { - ['<C-l>'] = false, - ['<C-h>'] = false, - ['<C-r>'] = 'actions.refresh', - }, - } - end, - lazy = false, -} diff --git a/nvim/.config/nvim/lua/eugenetriguba/plugins/telescope.lua b/nvim/.config/nvim/lua/eugenetriguba/plugins/telescope.lua deleted file mode 100644 index 9db22c3..0000000 --- a/nvim/.config/nvim/lua/eugenetriguba/plugins/telescope.lua +++ /dev/null @@ -1,80 +0,0 @@ -return { - { - 'nvim-telescope/telescope.nvim', - event = 'VimEnter', - dependencies = { - 'nvim-lua/plenary.nvim', - { - 'nvim-telescope/telescope-fzf-native.nvim', - build = 'make', - cond = function() - return vim.fn.executable 'make' == 1 - end, - }, - { 'nvim-telescope/telescope-ui-select.nvim' }, - { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, - }, - config = function() - require('telescope').setup { - defaults = { - vimgrep_arguments = { - 'rg', - '--color=never', - '--no-heading', - '--with-filename', - '--line-number', - '--column', - '--smart-case', - '--hidden', - '--glob', - '!.git/*', - }, - }, - pickers = { - find_files = { - find_command = { 'fd', '--type', 'f', '--hidden', '--strip-cwd-prefix', '--exclude', '.git' }, - }, - }, - extensions = { - ['ui-select'] = { - require('telescope.themes').get_dropdown(), - }, - }, - } - - pcall(require('telescope').load_extension, 'fzf') - pcall(require('telescope').load_extension, 'ui-select') - - local builtin = require 'telescope.builtin' - vim.keymap.set('n', '<leader>fh', builtin.help_tags, { desc = '[F]ind [H]elp' }) - vim.keymap.set('n', '<leader>fk', builtin.keymaps, { desc = '[F]ind [K]eymaps' }) - vim.keymap.set('n', '<leader>ff', builtin.find_files, { desc = '[F]ind [F]iles' }) - vim.keymap.set('n', '<leader>fc', builtin.commands, { desc = '[F]ind [C]ommands' }) - vim.keymap.set('n', '<leader>fs', builtin.builtin, { desc = '[F]ind [S]elect Telescope' }) - vim.keymap.set('n', '<leader>fw', builtin.grep_string, { desc = '[F]ind current [W]ord' }) - vim.keymap.set('n', '<leader>fg', builtin.live_grep, { desc = '[F]ind by [G]rep' }) - vim.keymap.set('n', '<leader>fd', builtin.diagnostics, { desc = '[F]ind [D]iagnostics' }) - vim.keymap.set('n', '<leader>fr', builtin.resume, { desc = '[F]ind [R]esume' }) - vim.keymap.set('n', '<leader>f.', builtin.oldfiles, { desc = '[F]ind Recent Files ("." for repeat)' }) - vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' }) - - vim.keymap.set('n', '<leader>/', function() - builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { - winblend = 10, - previewer = false, - }) - end, { desc = '[/] Fuzzily search in current buffer' }) - - vim.keymap.set('n', '<leader>f/', function() - builtin.live_grep { - grep_open_files = true, - prompt_title = 'Live Grep in Open Files', - } - end, { desc = '[F]ind [/] in Open Files' }) - - vim.keymap.set('n', '<leader>fn', function() - builtin.find_files { cwd = vim.fn.stdpath 'config' } - end, { desc = '[F]ind [N]eovim files' }) - end, - }, -} diff --git a/nvim/.config/nvim/lua/eugenetriguba/plugins/tmux-navigator.lua b/nvim/.config/nvim/lua/eugenetriguba/plugins/tmux-navigator.lua deleted file mode 100644 index 2e2c11a..0000000 --- a/nvim/.config/nvim/lua/eugenetriguba/plugins/tmux-navigator.lua +++ /dev/null @@ -1,19 +0,0 @@ -return { - 'https://github.com/christoomey/vim-tmux-navigator', - event = 'VeryLazy', - cmd = { - 'TmuxNavigateLeft', - 'TmuxNavigateDown', - 'TmuxNavigateUp', - 'TmuxNavigateRight', - 'TmuxNavigatePrevious', - 'TmuxNavigatorProcessList', - }, - keys = { - { '<c-h>', '<cmd><C-U>TmuxNavigateLeft<cr>' }, - { '<c-j>', '<cmd><C-U>TmuxNavigateDown<cr>' }, - { '<c-k>', '<cmd><C-U>TmuxNavigateUp<cr>' }, - { '<c-l>', '<cmd><C-U>TmuxNavigateRight<cr>' }, - { '<c-\\>', '<cmd><C-U>TmuxNavigatePrevious<cr>' }, - }, -} diff --git a/nvim/.config/nvim/lua/eugenetriguba/plugins/tree-sitter.lua b/nvim/.config/nvim/lua/eugenetriguba/plugins/tree-sitter.lua deleted file mode 100644 index af9751b..0000000 --- a/nvim/.config/nvim/lua/eugenetriguba/plugins/tree-sitter.lua +++ /dev/null @@ -1,26 +0,0 @@ -return { - { - 'https://github.com/nvim-treesitter/nvim-treesitter', - version = 'main', - main = 'nvim-treesitter.configs', - build = ':TSUpdate', - opts = { - ensure_installed = 'all', - auto_install = true, - ignore_install = { 'norg', 'org', 'ipkg', 'verilog' }, - highlight = { - enable = true, - additional_vim_regex_highlighting = { 'ruby', 'cpp' }, - }, - incremental_selection = { enable = true }, - context_commentstring = { enable = true }, - textobjects = { enable = true }, - }, - }, - { - 'https://github.com/nvim-treesitter/nvim-treesitter-context', - opts = { - multiline_threshold = 10, - }, - }, -} diff --git a/nvim/.config/nvim/lua/eugenetriguba/plugins/trouble.lua b/nvim/.config/nvim/lua/eugenetriguba/plugins/trouble.lua deleted file mode 100644 index 40087b3..0000000 --- a/nvim/.config/nvim/lua/eugenetriguba/plugins/trouble.lua +++ /dev/null @@ -1,37 +0,0 @@ -return { - 'folke/trouble.nvim', - opts = {}, - cmd = 'Trouble', - keys = { - { - '<leader>xx', - '<cmd>Trouble diagnostics toggle<cr>', - desc = 'Diagnostics (Trouble)', - }, - { - '<leader>xX', - '<cmd>Trouble diagnostics toggle filter.buf=0<cr>', - desc = 'Buffer Diagnostics (Trouble)', - }, - { - '<leader>cs', - '<cmd>Trouble symbols toggle focus=false<cr>', - desc = 'Symbols (Trouble)', - }, - { - '<leader>cl', - '<cmd>Trouble lsp toggle focus=false win.position=right<cr>', - desc = 'LSP Definitions / references / ... (Trouble)', - }, - { - '<leader>xL', - '<cmd>Trouble loclist toggle<cr>', - desc = 'Location List (Trouble)', - }, - { - '<leader>xQ', - '<cmd>Trouble qflist toggle<cr>', - desc = 'Quickfix List (Trouble)', - }, - }, -} diff --git a/nvim/.config/nvim/lua/eugenetriguba/plugins/which-key.lua b/nvim/.config/nvim/lua/eugenetriguba/plugins/which-key.lua deleted file mode 100644 index 28c73d7..0000000 --- a/nvim/.config/nvim/lua/eugenetriguba/plugins/which-key.lua +++ /dev/null @@ -1,6 +0,0 @@ -return { - { - 'https://github.com/folke/which-key.nvim', - event = 'VimEnter', - }, -} diff --git a/nvim/.config/nvim/nvim-pack-lock.json b/nvim/.config/nvim/nvim-pack-lock.json new file mode 100644 index 0000000..bc825e9 --- /dev/null +++ b/nvim/.config/nvim/nvim-pack-lock.json @@ -0,0 +1,139 @@ +{ + "plugins": { + "CopilotChat.nvim": { + "rev": "df5376c132382dd47e3e552612940cbf25b3580c", + "src": "https://github.com/CopilotC-Nvim/CopilotChat.nvim" + }, + "LuaSnip": { + "rev": "3732756842a2f7e0e76a7b0487e9692072857277", + "src": "https://github.com/L3MON4D3/LuaSnip" + }, + "blink-cmp-copilot": { + "rev": "439cff78780c033aa23cf061d7315314b347e3c1", + "src": "https://github.com/giuxtaposition/blink-cmp-copilot" + }, + "blink.cmp": { + "rev": "7beba91fdc61fdc84ea6d6395d614671e609f895", + "src": "https://github.com/saghen/blink.cmp" + }, + "conform": { + "rev": "973f3cb73887d510321653044791d7937c7ec0fa", + "src": "https://github.com/stevearc/conform.nvim" + }, + "conform.nvim": { + "rev": "ffe26e8df8115c9665d24231f8a49fadb2d611ce", + "src": "https://github.com/stevearc/conform.nvim" + }, + "copilot.lua": { + "rev": "881f99b827d65b41f522eecc21b112cf518028ac", + "src": "https://github.com/zbirenbaum/copilot.lua" + }, + "fidget.nvim": { + "rev": "e32b672d8fd343f9d6a76944fedb8c61d7d8111a", + "src": "https://github.com/j-hui/fidget.nvim" + }, + "friendly-snippets": { + "rev": "572f5660cf05f8cd8834e096d7b4c921ba18e175", + "src": "https://github.com/rafamadriz/friendly-snippets" + }, + "fzf-lua": { + "rev": "cae96b04f6cad98a3ad24349731df5e56b384c3c", + "src": "https://github.com/ibhagwan/fzf-lua" + }, + "gitsigns": { + "rev": "ca8bf696be575efa925ef531c4efd897b5c3086b", + "src": "https://github.com/lewis6991/gitsigns.nvim" + }, + "harpoon": { + "rev": "87b1a3506211538f460786c23f98ec63ad9af4e5", + "src": "https://github.com/ThePrimeagen/harpoon", + "version": "'harpoon2'" + }, + "indent-blankline": { + "rev": "005b56001b2cb30bfa61b7986bc50657816ba4ba", + "src": "https://github.com/lukas-reineke/indent-blankline.nvim" + }, + "lazydev.nvim": { + "rev": "5231c62aa83c2f8dc8e7ba957aa77098cda1257d", + "src": "https://github.com/folke/lazydev.nvim" + }, + "lazygit.nvim": { + "rev": "2305deed25bc61b866d5d39189e9105a45cf1cfb", + "src": "https://github.com/kdheepak/lazygit.nvim" + }, + "lualine": { + "rev": "a94fc68960665e54408fe37dcf573193c4ce82c9", + "src": "https://github.com/nvim-lualine/lualine.nvim" + }, + "mason-lspconfig.nvim": { + "rev": "0b9bb925c000ae649ff7e7149c8cd00031f4b539", + "src": "https://github.com/williamboman/mason-lspconfig.nvim" + }, + "mason-tool-installer.nvim": { + "rev": "517ef5994ef9d6b738322664d5fdd948f0fdeb46", + "src": "https://github.com/WhoIsSethDaniel/mason-tool-installer.nvim" + }, + "mason.nvim": { + "rev": "57e5a8addb8c71fb063ee4acda466c7cf6ad2800", + "src": "https://github.com/williamboman/mason.nvim" + }, + "mini": { + "rev": "dca98843fab66d080779cd973e7139e258ff164c", + "src": "https://github.com/nvim-mini/mini.nvim", + "version": "'main'" + }, + "mini.icons": { + "rev": "ff2e4f1d29f659cc2bad0f9256f2f6195c6b2428", + "src": "https://github.com/nvim-mini/mini.icons" + }, + "mini.indentscope": { + "rev": "0308f949f31769e509696af5d5f91cebb2159c69", + "src": "https://github.com/echasnovski/mini.indentscope" + }, + "nvim-lint": { + "rev": "d1118791070d090777398792a73032a0ca5c79ff", + "src": "https://github.com/mfussenegger/nvim-lint" + }, + "nvim-lspconfig": { + "rev": "7757d54716b26280b1b1785d89364a016a29c445", + "src": "https://github.com/neovim/nvim-lspconfig" + }, + "nvim-treesitter": { + "rev": "857fb97bb65c8a71b0c4a568cfcfef95679854d5", + "src": "https://github.com/nvim-treesitter/nvim-treesitter", + "version": "'main'" + }, + "nvim-treesitter-context": { + "rev": "660861b1849256398f70450afdf93908d28dc945", + "src": "https://github.com/nvim-treesitter/nvim-treesitter-context" + }, + "nvim-web-devicons": { + "rev": "c2599a81ecabaae07c49ff9b45dcd032a8d90f1a", + "src": "https://github.com/nvim-tree/nvim-web-devicons" + }, + "oil": { + "rev": "cbcb3f997f6f261c577b943ec94e4ef55108dd95", + "src": "https://github.com/stevearc/oil.nvim" + }, + "plenary": { + "rev": "b9fd5226c2f76c951fc8ed5923d85e4de065e509", + "src": "https://github.com/nvim-lua/plenary.nvim" + }, + "plenary.nvim": { + "rev": "b9fd5226c2f76c951fc8ed5923d85e4de065e509", + "src": "https://github.com/nvim-lua/plenary.nvim" + }, + "tokyonight": { + "rev": "5da1b76e64daf4c5d410f06bcb6b9cb640da7dfd", + "src": "https://github.com/folke/tokyonight.nvim" + }, + "vim-tmux-navigator": { + "rev": "c45243dc1f32ac6bcf6068e5300f3b2b237e576a", + "src": "https://github.com/christoomey/vim-tmux-navigator" + }, + "which-key": { + "rev": "3aab2147e74890957785941f0c1ad87d0a44c15a", + "src": "https://github.com/folke/which-key.nvim" + } + } +}
\ No newline at end of file diff --git a/nvim/.config/nvim/lua/eugenetriguba/global.lua b/nvim/.config/nvim/plugin/00_global.lua index 006fe5e..006fe5e 100644 --- a/nvim/.config/nvim/lua/eugenetriguba/global.lua +++ b/nvim/.config/nvim/plugin/00_global.lua diff --git a/nvim/.config/nvim/lua/eugenetriguba/options.lua b/nvim/.config/nvim/plugin/10_options.lua index 8aadd5a..8aadd5a 100644 --- a/nvim/.config/nvim/lua/eugenetriguba/options.lua +++ b/nvim/.config/nvim/plugin/10_options.lua diff --git a/nvim/.config/nvim/lua/eugenetriguba/keymaps.lua b/nvim/.config/nvim/plugin/20_keymaps.lua index 26f16f7..7efcaa5 100644 --- a/nvim/.config/nvim/lua/eugenetriguba/keymaps.lua +++ b/nvim/.config/nvim/plugin/20_keymaps.lua @@ -1,5 +1,6 @@ local map = vim.keymap.set +-- Create split panes using leader key map('n', '<leader>sh', ':split<CR>') map('n', '<leader>sv', ':vsplit<CR>') @@ -21,4 +22,3 @@ map('n', '<C-h>', '<C-w><C-h>', { desc = 'Move focus to the left window' }) map('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' }) map('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' }) map('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' }) - diff --git a/nvim/.config/nvim/lua/eugenetriguba/autocmds.lua b/nvim/.config/nvim/plugin/30_autocmds.lua index 145d00a..145d00a 100644 --- a/nvim/.config/nvim/lua/eugenetriguba/autocmds.lua +++ b/nvim/.config/nvim/plugin/30_autocmds.lua diff --git a/nvim/.config/nvim/plugin/40_plugins.lua b/nvim/.config/nvim/plugin/40_plugins.lua new file mode 100644 index 0000000..153bab5 --- /dev/null +++ b/nvim/.config/nvim/plugin/40_plugins.lua @@ -0,0 +1,750 @@ +vim.pack.add { + { + name = 'tokyonight', + src = 'https://github.com/folke/tokyonight.nvim', + }, +} +require('tokyonight').setup { + styles = { + comments = { italic = false }, + }, +} +vim.cmd.colorscheme 'tokyonight-night' + +vim.pack.add { + { + name = 'mini', + src = 'https://github.com/nvim-mini/mini.nvim', + version = 'main', + }, +} +require('mini.pairs').setup() +require('mini.tabline').setup() +require('mini.statusline').setup() +require('mini.indentscope').setup { + symbol = '│', + options = { try_as_border = true }, +} +local miniclue = require 'mini.clue' +miniclue.setup { + triggers = { + -- Leader triggers + { mode = 'n', keys = '<Leader>' }, + { mode = 'x', keys = '<Leader>' }, + -- Built-in completion + { mode = 'i', keys = '<C-x>' }, + -- `g` key + { mode = 'n', keys = 'g' }, + { mode = 'x', keys = 'g' }, + -- Marks + { mode = 'n', keys = "'" }, + { mode = 'n', keys = '`' }, + { mode = 'x', keys = "'" }, + { mode = 'x', keys = '`' }, + -- Registers + { mode = 'n', keys = '"' }, + { mode = 'x', keys = '"' }, + { mode = 'i', keys = '<C-r>' }, + { mode = 'c', keys = '<C-r>' }, + -- Window commands + { mode = 'n', keys = '<C-w>' }, + -- `z` key + { mode = 'n', keys = 'z' }, + { mode = 'x', keys = 'z' }, + }, + clues = { + -- Enhance this by adding descriptions for <Leader> mapping groups + miniclue.gen_clues.builtin_completion(), + miniclue.gen_clues.g(), + miniclue.gen_clues.marks(), + miniclue.gen_clues.registers(), + miniclue.gen_clues.windows(), + miniclue.gen_clues.z(), + }, + window = { + delay = 300, + }, +} + +-- Better Around/Inside textobjects +-- +-- Examples: +-- - va) - [V]isually select [A]round [)]paren +-- - yinq - [Y]ank [I]nside [N]ext [Q]uote +-- - ci' - [C]hange [I]nside [']quote +require('mini.ai').setup { n_lines = 500 } + +-- Add/delete/replace surroundings (brackets, quotes, etc.) +-- +-- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren +-- - sd' - [S]urround [D]elete [']quotes +-- - sr)' - [S]urround [R]eplace [)] ['] +require('mini.surround').setup() + +require('mini.diff').setup() +vim.keymap.set('n', '<leader>ho', '<cmd>lua minidiff.toggle_overlay()<cr>', { desc = 'git [o]verlay hunk diff' }) +vim.keymap.set('n', '<leader>hs', ':lua MiniDiff.toggle_overlay()<CR>', { desc = '[H]unk [S]tage (toggle overlay)' }) +vim.keymap.set('n', ']c', function() + if vim.wo.diff then + vim.cmd.normal { ']c', bang = true } + else + require('mini.diff').goto_hunk 'next' + end +end, { desc = 'jump to next git [c]hange' }) +vim.keymap.set('n', '[c', function() + if vim.wo.diff then + vim.cmd.normal { '[c', bang = true } + else + require('mini.diff').goto_hunk 'prev' + end +end, { desc = 'jump to previous git [c]hange' }) + +require('mini.git').setup() +vim.keymap.set('n', '<leader>hb', '<cmd>lua minigit.show_at_cursor()<cr>', { desc = 'git [b]lame at cursor' }) +vim.keymap.set('n', '<leader>hd', '<cmd>lua minigit.show_diff_source()<cr>', { desc = 'git [d]iff source' }) +vim.keymap.set('n', '<leader>hs', '<cmd>lua minigit.show_range_history()<cr>', { desc = 'git [s]how range history' }) +vim.keymap.set('v', '<leader>hs', '<cmd>lua minigit.show_range_history()<cr>', { desc = 'git [s]how range history' }) +vim.keymap.set( + 'n', + '<leader>gl', + '<cmd>lua minigit.show_range_history(nil, nil, {show_level = "buffer"})<cr>', + { desc = 'git [l]og' } +) +-- vim.keymap.set('n', ']h', ':lua MiniDiff.goto_hunk("next")<CR>', { desc = 'Next hunk' }) +-- vim.keymap.set('n', '[h', ':lua MiniDiff.goto_hunk("prev")<CR>', { desc = 'Previous hunk' }) + +-- Support navigating between tmux splits and vim splits +vim.pack.add { + { + name = 'vim-tmux-navigator', + src = 'https://github.com/christoomey/vim-tmux-navigator', + }, +} +vim.keymap.set('n', '<c-h>', '<cmd><C-U>TmuxNavigateLeft<cr>') +vim.keymap.set('n', '<c-j>', '<cmd><C-U>TmuxNavigateDown<cr>') +vim.keymap.set('n', '<c-k>', '<cmd><C-U>TmuxNavigateUp<cr>') +vim.keymap.set('n', '<c-l>', '<cmd><C-U>TmuxNavigateRight<cr>') +vim.keymap.set('n', '<c-\\>', '<cmd><C-U>TmuxNavigatePrevious<cr>') + +-- Replace netrw with Oil to work with the file hierarchy as a regular +-- vim buffer. +vim.pack.add { + { + name = 'oil', + src = 'https://github.com/stevearc/oil.nvim', + }, + { + name = 'mini.icons', + src = 'https://github.com/nvim-mini/mini.icons', + }, +} +require('oil').setup { + keymaps = { + -- Clashes with tmux navigator + ['<C-l>'] = false, + ['<C-h>'] = false, + ['<C-r>'] = 'actions.refresh', + }, +} +vim.keymap.set('n', '\\', '<CMD>Oil --float<CR>', { desc = 'Open parent directory in floating window' }) +vim.keymap.set('n', '-', '<CMD>Oil<CR>', { desc = 'Open parent directory' }) + +-- Treesitter adds understanding of the source code text (e.g. fields, methods, +-- classes) +vim.pack.add { + { + name = 'nvim-treesitter', + src = 'https://github.com/nvim-treesitter/nvim-treesitter', + version = 'main', + }, + { + name = 'nvim-treesitter-context', + src = 'https://github.com/nvim-treesitter/nvim-treesitter-context', + }, +} +local treesitter = require 'nvim-treesitter' +treesitter.setup { + ensure_installed = 'all', + auto_install = true, + modules = {}, + sync_install = false, + ignore_install = { 'norg', 'org', 'ipkg', 'verilog' }, + highlight = { + enable = true, + additional_vim_regex_highlighting = { 'ruby', 'cpp' }, + }, + indent = { enable = true, disable = { 'ruby', 'cpp' } }, + incremental_selection = { enable = true }, + context_commentstring = { enable = true }, + textobjects = { enable = true }, +} +require('treesitter-context').setup { + multiline_threshold = 10, +} +vim.api.nvim_create_autocmd('PackChanged', { + callback = function(args) + local spec = args.data.spec + if spec and spec.name == 'nvim-treesitter' and args.data.kind == 'update' then + vim.schedule(function() + -- If nvim-treesitter was updated, run ':TSUpdate' via the lua API to + -- ensure the installed parsers are also updated. + vim.cmd 'TSUpdate all' + end) + end + end, +}) + +vim.pack.add { + { + name = 'fzf-lua', + src = 'https://github.com/ibhagwan/fzf-lua', + }, +} +require('fzf-lua').setup { + winopts = { + preview = { + default = 'bat', + }, + }, + files = { + fd_opts = '--type f --hidden --exclude .git', + }, + grep = { + rg_opts = "--color=never --no-heading --with-filename --line-number --column --smart-case --hidden --glob '!.git/*'", + }, +} +local fzf = require 'fzf-lua' +vim.keymap.set('n', '<leader>fh', fzf.helptags, { desc = '[F]ind [H]elp' }) +vim.keymap.set('n', '<leader>fk', fzf.keymaps, { desc = '[F]ind [K]eymaps' }) +vim.keymap.set('n', '<leader>ff', fzf.files, { desc = '[F]ind [F]iles' }) +vim.keymap.set('n', '<leader>fc', fzf.commands, { desc = '[F]ind [C]ommands' }) +vim.keymap.set('n', '<leader>fs', fzf.builtin, { desc = '[F]ind [S]elect fzf-lua' }) +vim.keymap.set('n', '<leader>fw', fzf.grep_cword, { desc = '[F]ind current [W]ord' }) +vim.keymap.set('n', '<leader>fg', fzf.live_grep, { desc = '[F]ind by [G]rep' }) +vim.keymap.set('n', '<leader>fd', fzf.diagnostics_document, { desc = '[F]ind [D]iagnostics' }) +vim.keymap.set('n', '<leader>fr', fzf.resume, { desc = '[F]ind [R]esume' }) +vim.keymap.set('n', '<leader>f.', fzf.oldfiles, { desc = '[F]ind Recent Files ("." for repeat)' }) +vim.keymap.set('n', '<leader><leader>', fzf.buffers, { desc = '[ ] Find existing buffers' }) +vim.keymap.set('n', '<leader>/', fzf.blines, { desc = '[/] Fuzzily search in current buffer' }) +vim.keymap.set('n', '<leader>f/', function() + fzf.live_grep { + filespec = vim.fn.expand '%:p', + prompt = 'Live Grep in Open Files> ', + } +end, { desc = '[F]ind [/] in Open Files' }) +vim.keymap.set('n', '<leader>fn', function() + fzf.files { cwd = vim.fn.stdpath 'config' } +end, { desc = '[F]ind [N]eovim files' }) + +vim.pack.add { + { + name = 'lazygit.nvim', + src = 'https://github.com/kdheepak/lazygit.nvim', + }, + { + name = 'plenary.nvim', + src = 'https://github.com/nvim-lua/plenary.nvim', + }, +} +vim.keymap.set('n', '<leader>lg', '<cmd>LazyGit<cr>', { desc = 'LazyGit' }) + +vim.pack.add { + { + name = 'harpoon', + src = 'https://github.com/ThePrimeagen/harpoon', + version = 'harpoon2', + }, + { + name = 'plenary.nvim', + src = 'https://github.com/nvim-lua/plenary.nvim', + }, +} +local harpoon = require 'harpoon' +harpoon:setup() +vim.keymap.set('n', '<leader>a', function() + harpoon:list():add() +end) +vim.keymap.set('n', '<C-e>', function() + harpoon.ui:toggle_quick_menu(harpoon:list()) +end) + +vim.keymap.set('n', '<leader>1', function() + harpoon:list():select(1) +end) +vim.keymap.set('n', '<leader>2', function() + harpoon:list():select(2) +end) +vim.keymap.set('n', '<leader>3', function() + harpoon:list():select(3) +end) +vim.keymap.set('n', '<leader>4', function() + harpoon:list():select(4) +end) + +vim.keymap.set('n', '<C-x>', function() + harpoon:list():clear() +end, { desc = 'Clear Harpoon list' }) +vim.keymap.set('n', '<leader>hp', function() + harpoon:list():prev() +end) +vim.keymap.set('n', '<leader>hn', function() + harpoon:list():next() +end) + +vim.pack.add { + { + name = 'nvim-lint', + src = 'https://github.com/mfussenegger/nvim-lint', + }, +} +-- Default linters, which will cause errors unless these tools are available: +-- { +-- clojure = { "clj-kondo" }, +-- dockerfile = { "hadolint" }, +-- inko = { "inko" }, +-- janet = { "janet" }, +-- json = { "jsonlint" }, +-- markdown = { "vale" }, +-- rst = { "vale" }, +-- ruby = { "ruby" }, +-- terraform = { "tflint" }, +-- text = { "vale" } +-- } +-- +-- They can be disabled by setting their filetypes to nil: +-- lint.linters_by_ft['clojure'] = nil +local lint = require 'lint' +lint.linters_by_ft = lint.linters_by_ft or {} +lint.linters_by_ft['cpp'] = { 'cppcheck' } +lint.linters_by_ft['dockerfile'] = { 'hadolint' } +lint.linters_by_ft['json'] = { 'jsonlint' } +lint.linters_by_ft['terraform'] = { 'tflint', 'terraform_validate' } +lint.linters_by_ft['python'] = { 'ruff', 'bandit' } +lint.linters_by_ft['markdown'] = nil +lint.linters_by_ft['text'] = nil +lint.linters_by_ft['xml'] = { 'xmllint' } +lint.linters_by_ft['sh'] = { 'shellcheck' } +table.insert(lint.linters.shellcheck.args, '-x') +local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true }) +vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, { + group = lint_augroup, + callback = function() + -- Only run the linter in buffers that you can modify in order to + -- avoid superfluous noise, notably within the handy LSP pop-ups that + -- describe the hovered symbol using Markdown. + if vim.opt_local.modifiable:get() then + lint.try_lint() + end + end, +}) + +vim.pack.add { + { + name = 'conform.nvim', + src = 'https://github.com/stevearc/conform.nvim', + }, +} +require('conform').setup { + notify_on_error = false, + format_on_save = function(bufnr) + -- Disable with a global or buffer-local variable + if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then + return + end + -- Disable "format_on_save lsp_fallback" for certain languages. + local disable_filetypes = { sql = true } + if disable_filetypes[vim.bo[bufnr].filetype] then + return nil + end + return { + timeout_ms = 3000, + lsp_format = 'fallback', + } + end, + formatters_by_ft = { + c = { 'clang-format' }, + lua = { 'stylua' }, + go = { 'gofmt' }, + python = { 'black', 'isort' }, + rust = { 'rustfmt' }, + sh = { 'shfmt' }, + md = { 'prettierd', 'prettier', stop_after_first = true }, + yaml = { 'prettierd', 'prettier', stop_after_first = true }, + json = { 'prettierd', 'prettier', stop_after_first = true }, + javascript = { 'prettierd', 'prettier', stop_after_first = true }, + typescript = { 'prettierd', 'prettier', stop_after_first = true }, + javascriptreact = { 'prettierd', 'prettier', stop_after_first = true }, + typescriptreact = { 'prettierd', 'prettier', stop_after_first = true }, + css = { 'prettierd', 'prettier', stop_after_first = true }, + htmldjango = { 'prettierd', 'prettier', stop_after_first = true }, + html = { 'prettierd', 'prettier', stop_after_first = true }, + tf = { 'terraform_fmt' }, + nix = { 'nixfmt' }, + java = { 'google-java-format' }, + }, + formatters = { + isort = { + prepend_args = { '--profile', 'black' }, + }, + }, +} +vim.api.nvim_create_user_command('FormatDisable', function(args) + if args.bang then + -- :FormatDisable! disables autoformat for this buffer only + vim.b.disable_autoformat = true + else + -- :FormatDisable disables autoformat globally + vim.g.disable_autoformat = true + end +end, { + desc = 'Disable autoformat-on-save', + bang = true, -- allows the ! variant +}) + +vim.api.nvim_create_user_command('FormatEnable', function() + vim.b.disable_autoformat = false + vim.g.disable_autoformat = false +end, { + desc = 'Re-enable autoformat-on-save', +}) + +vim.keymap.set('', '<leader>bf', function() + require('conform').format { async = true, lsp_format = 'fallback' } +end, { desc = '[B]uffer [F]ormat' }) + +vim.keymap.set('n', '<leader>tf', function() + -- If autoformat is currently disabled for this buffer, + -- then enable it, otherwise disable it + if vim.b.disable_autoformat then + vim.cmd 'FormatEnable' + vim.notify 'Enabled autoformat for current buffer' + else + vim.cmd 'FormatDisable!' + vim.notify 'Disabled autoformat for current buffer' + end +end, { desc = 'Toggle autoformat for current buffer' }) + +vim.keymap.set('n', '<leader>tF', function() + -- If autoformat is currently disabled globally, + -- then enable it globally, otherwise disable it globally + if vim.g.disable_autoformat then + vim.cmd 'FormatEnable' + vim.notify 'Enabled autoformat globally' + else + vim.cmd 'FormatDisable' + vim.notify 'Disabled autoformat globally' + end +end, { desc = 'Toggle autoformat globally' }) + +vim.pack.add { + { + name = 'copilot.lua', + src = 'https://github.com/zbirenbaum/copilot.lua', + }, + { + name = 'CopilotChat.nvim', + src = 'https://github.com/CopilotC-Nvim/CopilotChat.nvim', + }, + { + name = 'plenary.nvim', + src = 'https://github.com/nvim-lua/plenary.nvim', + }, +} +vim.api.nvim_create_autocmd('PackChanged', { + callback = function(args) + local spec = args.data.spec + if spec and spec.name == 'CopilotChat.nvim' then + if args.data.kind == 'install' or args.data.kind == 'update' then + vim.notify('Building CopilotChat.nvim...', vim.log.levels.INFO) + vim.system({ 'make', 'tiktoken' }, { cwd = spec.path, text = true }, function(result) + if result.code == 0 then + vim.notify('CopilotChat.nvim build successful!', vim.log.levels.INFO) + else + vim.notify('CopilotChat.nvim build failed: ' .. (result.stderr or ''), vim.log.levels.ERROR) + end + end) + end + end + end, +}) +require('copilot').setup { + suggestion = { enabled = false }, + panel = { enabled = false }, +} +require('CopilotChat').setup { + model = 'claude-sonnet-4.5', +} +vim.keymap.set('n', '<leader>tc', function() + vim.cmd 'CopilotChatToggle' +end, { desc = '[T]oggle [C]opilot Chat' }) + +vim.pack.add { + { + name = 'blink.cmp', + src = 'https://github.com/saghen/blink.cmp', + }, + { + name = 'LuaSnip', + src = 'https://github.com/L3MON4D3/LuaSnip', + }, + { + name = 'friendly-snippets', + src = 'https://github.com/rafamadriz/friendly-snippets', + }, + { + name = 'lazydev.nvim', + src = 'https://github.com/folke/lazydev.nvim', + }, + { + name = 'blink-cmp-copilot', + src = 'https://github.com/giuxtaposition/blink-cmp-copilot', + }, +} +vim.api.nvim_create_autocmd('PackChanged', { + callback = function(args) + local spec = args.data.spec + if spec and spec.name == 'blink.cmp' then + if args.data.kind == 'install' or args.data.kind == 'update' then + vim.notify('Building blink.cmp...', vim.log.levels.INFO) + vim.system({ 'cargo', '+nightly', 'build', '--release' }, { cwd = spec.path, text = true }, function(result) + if result.code == 0 then + vim.notify('blink.cmp build successful!', vim.log.levels.INFO) + else + vim.notify('blink.cmp build failed: ' .. (result.stderr or ''), vim.log.levels.ERROR) + end + end) + end + end + end, +}) +require('luasnip.loaders.from_vscode').lazy_load() +require('blink.cmp').setup { + keymap = { + preset = 'default', + }, + appearance = { + nerd_font_variant = 'mono', + }, + completion = { + documentation = { auto_show = true, auto_show_delay_ms = 500 }, + }, + sources = { + default = { 'lsp', 'path', 'snippets', 'lazydev', 'copilot' }, + providers = { + lazydev = { module = 'lazydev.integrations.blink', score_offset = 100 }, + copilot = { + name = 'copilot', + module = 'blink-cmp-copilot', + score_offset = 100, + async = true, + }, + }, + }, + snippets = { preset = 'luasnip' }, + fuzzy = { implementation = 'prefer_rust_with_warning' }, + signature = { enabled = true }, +} + +vim.pack.add { + { + name = 'lazydev.nvim', + src = 'https://github.com/folke/lazydev.nvim', + }, + { + name = 'nvim-lspconfig', + src = 'https://github.com/neovim/nvim-lspconfig', + }, + { + name = 'mason.nvim', + src = 'https://github.com/williamboman/mason.nvim', + }, + { + name = 'mason-lspconfig.nvim', + src = 'https://github.com/williamboman/mason-lspconfig.nvim', + }, + { + name = 'mason-tool-installer.nvim', + src = 'https://github.com/WhoIsSethDaniel/mason-tool-installer.nvim', + }, + { + name = 'fidget.nvim', + src = 'https://github.com/j-hui/fidget.nvim', + }, +} + +-- Lazydev for Lua development +require('lazydev').setup { + library = { + { path = '${3rd}/luv/library', words = { 'vim%.uv' } }, + }, +} +-- Fidget for LSP progress +require('fidget').setup {} +require('mason').setup() +vim.api.nvim_create_autocmd('LspAttach', { + group = vim.api.nvim_create_augroup('lsp-attach', { clear = true }), + callback = function(event) + local map = function(keys, func, desc, mode) + mode = mode or 'n' + vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) + end + + map('grn', vim.lsp.buf.rename, '[R]e[n]ame') + map('gra', vim.lsp.buf.code_action, '[G]oto Code [A]ction', { 'n', 'x' }) + map('grr', fzf.lsp_references, '[G]oto [R]eferences') + map('gri', fzf.lsp_implementations, '[G]oto [I]mplementation') + map('grd', fzf.lsp_definitions, '[G]oto [D]efinition') + map('grD', fzf.lsp_declarations, '[G]oto [D]eclaration') + map('gO', fzf.lsp_document_symbols, 'Open Document Symbols') + map('gW', fzf.lsp_workspace_symbols, 'Open Workspace Symbols') + map('grt', fzf.lsp_typedefs, '[G]oto [T]ype Definition') + + local client = vim.lsp.get_client_by_id(event.data.client_id) + if client and client:supports_method(vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) then + local highlight_augroup = vim.api.nvim_create_augroup('lsp-highlight', { clear = false }) + vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, { + buffer = event.buf, + group = highlight_augroup, + callback = vim.lsp.buf.document_highlight, + }) + + vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, { + buffer = event.buf, + group = highlight_augroup, + callback = vim.lsp.buf.clear_references, + }) + + vim.api.nvim_create_autocmd('LspDetach', { + group = vim.api.nvim_create_augroup('lsp-detach', { clear = true }), + callback = function(event2) + vim.lsp.buf.clear_references() + vim.api.nvim_clear_autocmds { group = 'lsp-highlight', buffer = event2.buf } + end, + }) + end + + if client and client:supports_method(vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then + map('<leader>th', function() + vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf }) + end, '[T]oggle Inlay [H]ints') + end + end, +}) + +vim.diagnostic.config { + severity_sort = true, + float = { border = 'rounded', source = 'if_many' }, + underline = { severity = vim.diagnostic.severity.ERROR }, + signs = vim.g.have_nerd_font and { + text = { + [vim.diagnostic.severity.ERROR] = ' ', + [vim.diagnostic.severity.WARN] = ' ', + [vim.diagnostic.severity.INFO] = ' ', + [vim.diagnostic.severity.HINT] = ' ', + }, + } or {}, + virtual_text = { + source = 'if_many', + spacing = 2, + format = function(diagnostic) + return diagnostic.message + end, + }, +} + +local capabilities = require('blink.cmp').get_lsp_capabilities() +local servers = { + clangd = {}, + gopls = {}, + pyright = { + settings = { + python = { + analysis = { + autoImportCompletions = true, + }, + }, + }, + }, + rust_analyzer = {}, + ts_ls = {}, + lua_ls = { + settings = { + Lua = { + completion = { + callSnippet = 'Replace', + }, + }, + }, + }, + stylua = {}, + tailwindcss = {}, + mesonlsp = {}, + terraformls = {}, + bashls = {}, + jdtls = { + settings = { + java = { + configuration = { + updateBuildConfiguration = 'interactive', + refreshBundles = true, + }, + completion = { + favoriteStaticMembers = { + 'org.hamcrest.MatcherAssert.assertThat', + 'org.hamcrest.Matchers.*', + 'org.hamcrest.CoreMatchers.*', + 'org.junit.jupiter.api.Assertions.*', + 'java.util.Objects.requireNonNull', + 'java.util.Objects.requireNonNullElse', + }, + }, + contentProvider = { preferred = 'fernflower' }, + eclipse = { + downloadSources = true, + }, + implementationsCodeLens = { + enabled = true, + }, + inlayHints = { + parameterNames = { + enabled = 'all', + }, + }, + maven = { + downloadSources = true, + }, + referencesCodeLens = { + enabled = true, + }, + references = { + includeDecompiledSources = true, + }, + saveActions = { + organizeImports = true, + }, + signatureHelp = { enabled = true }, + sources = { + organizeImports = { + starThreshold = 9999, + staticStarThreshold = 9999, + }, + }, + }, + }, + }, +} + +local ensure_installed = vim.tbl_keys(servers or {}) +require('mason-tool-installer').setup { ensure_installed = ensure_installed } +require('mason-lspconfig').setup { + ensure_installed = {}, + automatic_installation = false, + automatic_enable = true, + handlers = { + function(server_name) + local server = servers[server_name] or {} + server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {}) + require('lspconfig')[server_name].setup(server) + end, + }, +} |