From 4bab538344e2cb7d82f6c729dc4bde49c5dd3c78 Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Tue, 27 May 2025 21:16:24 -0400 Subject: update neovim configuration --- nvim/.config/nvim/lazy-lock.json | 7 +- nvim/.config/nvim/lua/config/autocmds.lua | 2 +- nvim/.config/nvim/lua/plugins/blink.lua | 3 +- nvim/.config/nvim/lua/plugins/conform.lua | 94 +++++++++++++++++++++---- nvim/.config/nvim/lua/plugins/debug.lua | 24 ++----- nvim/.config/nvim/lua/plugins/indent_line.lua | 4 +- nvim/.config/nvim/lua/plugins/lint.lua | 28 ++++---- nvim/.config/nvim/lua/plugins/lsp.lua | 3 +- nvim/.config/nvim/lua/plugins/mini.lua | 4 +- nvim/.config/nvim/lua/plugins/telescope.lua | 14 ++-- nvim/.config/nvim/lua/plugins/todo-comments.lua | 3 +- nvim/.config/nvim/lua/plugins/tokyonight.lua | 8 +-- nvim/.config/nvim/lua/plugins/tree-sitter.lua | 4 +- nvim/.config/nvim/lua/plugins/vim-sleuth.lua | 4 +- nvim/.config/nvim/lua/plugins/which-key.lua | 3 +- tmux/.config/tmux/options.conf | 2 + zsh/.zshrc | 1 + 17 files changed, 130 insertions(+), 78 deletions(-) diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json index d465408..ea24cea 100644 --- a/nvim/.config/nvim/lazy-lock.json +++ b/nvim/.config/nvim/lazy-lock.json @@ -8,20 +8,21 @@ "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, "lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" }, "lualine.nvim": { "branch": "master", "commit": "0c6cca9f2c63dadeb9225c45bc92bb95a151d4af" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "87888865fa1ce1928a25b9abbea8c8f7839bf522" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "d3ada78a941ff09d21dd9b4c2ec36f0cf44a4ccb" }, "mason-nvim-dap.nvim": { "branch": "main", "commit": "4c2cdc69d69fe00c15ae8648f7e954d99e5de3ea" }, "mason-tool-installer.nvim": { "branch": "main", "commit": "75d60a8f928decd8b38897f80849768b7c540a5b" }, "mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" }, - "mini.nvim": { "branch": "main", "commit": "d90adc96b68b310cf17d8ebcc8e2e4626c6bb8cc" }, + "mini.nvim": { "branch": "main", "commit": "ecbb9b1e2223a04171388887765e7695f5a0c132" }, "neo-tree.nvim": { "branch": "main", "commit": "f481de16a0eb59c985abac8985e3f2e2f75b4875" }, "nui.nvim": { "branch": "main", "commit": "7cd18e73cfbd70e1546931b7268b3eebaeff9391" }, "nvim-autopairs": { "branch": "master", "commit": "4d74e75913832866aa7de35e4202463ddf6efd1b" }, "nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" }, "nvim-dap": { "branch": "master", "commit": "b0f983507e3702f073bfe1516846e58b56d4e42f" }, "nvim-dap-go": { "branch": "main", "commit": "8763ced35b19c8dc526e04a70ab07c34e11ad064" }, + "nvim-dap-python": { "branch": "master", "commit": "261ce649d05bc455a29f9636dc03f8cdaa7e0e2c" }, "nvim-dap-ui": { "branch": "master", "commit": "73a26abf4941aa27da59820fd6b028ebcdbcf932" }, "nvim-lint": { "branch": "master", "commit": "b47cbb249351873e3a571751c3fb66ed6369852f" }, - "nvim-lspconfig": { "branch": "master", "commit": "d45702594afc661a9dfa95e96acf18c56006d4d9" }, + "nvim-lspconfig": { "branch": "master", "commit": "b8e7957bde4cbb3cb25a13a62548f7c273b026e9" }, "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, "nvim-web-devicons": { "branch": "master", "commit": "1fb58cca9aebbc4fd32b086cb413548ce132c127" }, diff --git a/nvim/.config/nvim/lua/config/autocmds.lua b/nvim/.config/nvim/lua/config/autocmds.lua index 4b210af..1e8b533 100644 --- a/nvim/.config/nvim/lua/config/autocmds.lua +++ b/nvim/.config/nvim/lua/config/autocmds.lua @@ -7,7 +7,7 @@ local autocmd = vim.api.nvim_create_autocmd -- See `:help vim.highlight.on_yank()` autocmd('TextYankPost', { desc = 'Highlight when yanking (copying) text', - group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }), + group = vim.api.nvim_create_augroup('highlight-yank', { clear = true }), callback = function() vim.highlight.on_yank() end, diff --git a/nvim/.config/nvim/lua/plugins/blink.lua b/nvim/.config/nvim/lua/plugins/blink.lua index 2a7bd69..d83ee7f 100644 --- a/nvim/.config/nvim/lua/plugins/blink.lua +++ b/nvim/.config/nvim/lua/plugins/blink.lua @@ -72,7 +72,7 @@ return { completion = { -- By default, you may press `` to show the documentation. -- Optionally, set `auto_show = true` to show the documentation after a delay. - documentation = { auto_show = false, auto_show_delay_ms = 500 }, + documentation = { auto_show = true, auto_show_delay_ms = 500 }, }, sources = { @@ -97,5 +97,4 @@ return { signature = { enabled = true }, }, }, - } diff --git a/nvim/.config/nvim/lua/plugins/conform.lua b/nvim/.config/nvim/lua/plugins/conform.lua index 37dba09..8c69f30 100644 --- a/nvim/.config/nvim/lua/plugins/conform.lua +++ b/nvim/.config/nvim/lua/plugins/conform.lua @@ -1,8 +1,11 @@ +-- Conform adds code autoformatting funcionality. + return { { 'stevearc/conform.nvim', event = { 'BufWritePre' }, cmd = { 'ConformInfo' }, + lazy = false, keys = { { 'f', @@ -12,30 +15,95 @@ return { mode = '', desc = '[F]ormat buffer', }, + { + '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', + }, + { + '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', + }, }, opts = { notify_on_error = false, format_on_save = function(bufnr) - -- Disable "format_on_save lsp_fallback" for languages that don't - -- have a well standardized coding style. You can add additional - -- languages here or re-enable it for the disabled ones. - local disable_filetypes = { c = true, cpp = true } + -- 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, c = true, cpp = true } if disable_filetypes[vim.bo[bufnr].filetype] then return nil - else - return { - timeout_ms = 500, - lsp_format = 'fallback', - } end + + return { + timeout_ms = 500, + lsp_format = 'fallback', + } end, formatters_by_ft = { lua = { 'stylua' }, - python = { "isort", "black" }, - -- 'stop_after_first' will run the first available - -- formatter from the list - javascript = { "prettierd", "prettier", stop_after_first = true }, + go = { 'goimports', 'gofmt' }, + python = { 'isort', 'black' }, + rust = { 'rustfmt' }, + 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 }, + }, + formatters = { + isort = { + prepend_args = { '--profile', 'black' }, + }, }, }, + 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/plugins/debug.lua b/nvim/.config/nvim/lua/plugins/debug.lua index 753cb0c..239410f 100644 --- a/nvim/.config/nvim/lua/plugins/debug.lua +++ b/nvim/.config/nvim/lua/plugins/debug.lua @@ -1,31 +1,22 @@ -- debug.lua -- -- Shows how to use the DAP plugin to debug your code. --- --- Primarily focused on configuring the debugger for Go, but can --- be extended to other languages as well. That's why it's called --- kickstart.nvim and not kitchen-sink.nvim ;) return { - -- NOTE: Yes, you can install new plugins here! 'mfussenegger/nvim-dap', - -- NOTE: And you can specify dependencies as well dependencies = { -- Creates a beautiful debugger UI 'rcarriga/nvim-dap-ui', - -- Required dependency for nvim-dap-ui 'nvim-neotest/nvim-nio', - - -- Installs the debug adapters for you + -- Installs the debug adapters 'williamboman/mason.nvim', 'jay-babu/mason-nvim-dap.nvim', - - -- Add your own debuggers here + -- Debugger adapters 'leoluz/nvim-dap-go', + 'mfussenegger/nvim-dap-python', }, keys = { - -- Basic debugging keymaps, feel free to change to your liking! { '', function() @@ -86,24 +77,18 @@ return { -- reasonable debug configurations automatic_installation = true, - -- You can provide additional configuration to the handlers, -- see mason-nvim-dap README for more information handlers = {}, - -- You'll need to check that you have the required things installed - -- online, please don't ask me how to install them :) ensure_installed = { - -- Update this to ensure that you have the debuggers for the langs you want 'delve', + 'python', }, } -- Dap UI setup -- For more information, see |:help nvim-dap-ui| dapui.setup { - -- Set icons to characters that are more likely to work in every terminal. - -- Feel free to remove or use ones that you like more! :) - -- Don't feel like these are good choices. icons = { expanded = '▾', collapsed = '▸', current_frame = '*' }, controls = { icons = { @@ -144,5 +129,6 @@ return { detached = vim.fn.has 'win32' == 0, }, } + require('dap-python').setup 'python3' end, } diff --git a/nvim/.config/nvim/lua/plugins/indent_line.lua b/nvim/.config/nvim/lua/plugins/indent_line.lua index ed7f269..041ba40 100644 --- a/nvim/.config/nvim/lua/plugins/indent_line.lua +++ b/nvim/.config/nvim/lua/plugins/indent_line.lua @@ -1,5 +1,7 @@ +-- Add indentation guides even on blank lines + return { - { -- Add indentation guides even on blank lines + { 'lukas-reineke/indent-blankline.nvim', -- Enable `lukas-reineke/indent-blankline.nvim` -- See `:help ibl` diff --git a/nvim/.config/nvim/lua/plugins/lint.lua b/nvim/.config/nvim/lua/plugins/lint.lua index df2b809..c72efc2 100644 --- a/nvim/.config/nvim/lua/plugins/lint.lua +++ b/nvim/.config/nvim/lua/plugins/lint.lua @@ -1,25 +1,21 @@ +-- Linting + return { - { -- Linting + { 'mfussenegger/nvim-lint', event = { 'BufReadPre', 'BufNewFile' }, config = function() local lint = require 'lint' - lint.linters_by_ft = { - cpp = { 'cppcheck' }, - dockerfile = { 'hadolint' }, - json = { 'jsonlint' }, - terraform = { 'tflint' }, - python = { 'ruff', 'bandit' }, - } + 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' } + lint.linters_by_ft['python'] = { 'ruff', 'bandit' } + lint.linters_by_ft['markdown'] = { 'markdownlint' } - -- To allow other plugins to add linters to require('lint').linters_by_ft, - -- instead set linters_by_ft like this: - -- lint.linters_by_ft = lint.linters_by_ft or {} - -- lint.linters_by_ft['markdown'] = { 'markdownlint' } - -- - -- However, note that this will enable a set of default linters, - -- which will cause errors unless these tools are available: + -- Default linters, which will cause errors unless these tools are available: -- { -- clojure = { "clj-kondo" }, -- dockerfile = { "hadolint" }, @@ -33,7 +29,7 @@ return { -- text = { "vale" } -- } -- - -- You can disable the default linters by setting their filetypes to nil: + -- They can be disabled by setting their filetypes to nil: -- lint.linters_by_ft['clojure'] = nil -- lint.linters_by_ft['dockerfile'] = nil -- lint.linters_by_ft['inko'] = nil diff --git a/nvim/.config/nvim/lua/plugins/lsp.lua b/nvim/.config/nvim/lua/plugins/lsp.lua index f7c9b90..e6e77f9 100644 --- a/nvim/.config/nvim/lua/plugins/lsp.lua +++ b/nvim/.config/nvim/lua/plugins/lsp.lua @@ -1,5 +1,6 @@ +-- LSP Plugins + return { - -- LSP Plugins { -- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins -- used for completion, annotations and signatures of Neovim apis diff --git a/nvim/.config/nvim/lua/plugins/mini.lua b/nvim/.config/nvim/lua/plugins/mini.lua index b8d78b5..0138e29 100644 --- a/nvim/.config/nvim/lua/plugins/mini.lua +++ b/nvim/.config/nvim/lua/plugins/mini.lua @@ -1,5 +1,7 @@ +-- Collection of various small independent plugins/modules + return { - { -- Collection of various small independent plugins/modules + { 'echasnovski/mini.nvim', config = function() -- Better Around/Inside textobjects diff --git a/nvim/.config/nvim/lua/plugins/telescope.lua b/nvim/.config/nvim/lua/plugins/telescope.lua index 4256675..8ca3d26 100644 --- a/nvim/.config/nvim/lua/plugins/telescope.lua +++ b/nvim/.config/nvim/lua/plugins/telescope.lua @@ -1,25 +1,19 @@ +-- Fuzzy Finder (files, lsp, etc) + return { - { -- Fuzzy Finder (files, lsp, etc) + { 'nvim-telescope/telescope.nvim', event = 'VimEnter', dependencies = { 'nvim-lua/plenary.nvim', - { -- If encountering errors, see telescope-fzf-native README for installation instructions + { 'nvim-telescope/telescope-fzf-native.nvim', - - -- `build` is used to run some command when the plugin is installed/updated. - -- This is only run then, not every time Neovim starts up. build = 'make', - - -- `cond` is a condition used to determine whether this plugin should be - -- installed and loaded. cond = function() return vim.fn.executable 'make' == 1 end, }, { 'nvim-telescope/telescope-ui-select.nvim' }, - - -- Useful for getting pretty icons, but requires a Nerd Font. { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font }, }, config = function() diff --git a/nvim/.config/nvim/lua/plugins/todo-comments.lua b/nvim/.config/nvim/lua/plugins/todo-comments.lua index 485da8c..70f72d0 100644 --- a/nvim/.config/nvim/lua/plugins/todo-comments.lua +++ b/nvim/.config/nvim/lua/plugins/todo-comments.lua @@ -1,5 +1,6 @@ +-- Highlight todo, notes, etc in comments + return { - -- Highlight todo, notes, etc in comments { 'folke/todo-comments.nvim', event = 'VimEnter', diff --git a/nvim/.config/nvim/lua/plugins/tokyonight.lua b/nvim/.config/nvim/lua/plugins/tokyonight.lua index b19aecb..aae2d30 100644 --- a/nvim/.config/nvim/lua/plugins/tokyonight.lua +++ b/nvim/.config/nvim/lua/plugins/tokyonight.lua @@ -1,4 +1,6 @@ --- To see what colorschemes are already installed, you can use `:Telescope colorscheme`. +-- Setup the tokyonight color scheme. +-- +-- To see what colorschemes are already installed: `:Telescope colorscheme`. return { { @@ -11,9 +13,7 @@ return { }, } - -- Load the colorscheme here. - -- Like many other themes, this one has different styles, and you could load - -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. + -- Other styles: 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. vim.cmd.colorscheme 'tokyonight' end, }, diff --git a/nvim/.config/nvim/lua/plugins/tree-sitter.lua b/nvim/.config/nvim/lua/plugins/tree-sitter.lua index cdcf66f..ea68249 100644 --- a/nvim/.config/nvim/lua/plugins/tree-sitter.lua +++ b/nvim/.config/nvim/lua/plugins/tree-sitter.lua @@ -1,4 +1,5 @@ -- Highlight, edit, and navigate code + return { { 'nvim-treesitter/nvim-treesitter', @@ -18,8 +19,7 @@ return { }, indent = { enable = true, disable = { 'ruby', 'cpp' } }, }, - -- There are additional nvim-treesitter modules that you can use to interact - -- with nvim-treesitter. You should go explore a few and see what interests you: + -- Additional nvim-treesitter modules to explore: -- -- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod` -- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context diff --git a/nvim/.config/nvim/lua/plugins/vim-sleuth.lua b/nvim/.config/nvim/lua/plugins/vim-sleuth.lua index 07e73d3..d9a0887 100644 --- a/nvim/.config/nvim/lua/plugins/vim-sleuth.lua +++ b/nvim/.config/nvim/lua/plugins/vim-sleuth.lua @@ -1,4 +1,4 @@ +-- Detect tabstop and shiftwidth automatically return { - 'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically + 'tpope/vim-sleuth', } - diff --git a/nvim/.config/nvim/lua/plugins/which-key.lua b/nvim/.config/nvim/lua/plugins/which-key.lua index 896100a..ca43c7a 100644 --- a/nvim/.config/nvim/lua/plugins/which-key.lua +++ b/nvim/.config/nvim/lua/plugins/which-key.lua @@ -3,13 +3,12 @@ return { { 'folke/which-key.nvim', - event = 'VimEnter', -- Set the loading event to 'VimEnter' + event = 'VimEnter', opts = { -- delay between pressing a key and opening which-key (milliseconds) -- this setting is independent of vim.opt.timeoutlen delay = 0, icons = { - -- set icon mappings to true if you have a Nerd Font mappings = vim.g.have_nerd_font, -- If you are using a Nerd Font: set icons.keys to an empty table which will use the -- default which-key.nvim defined Nerd Font icons, otherwise define a string table diff --git a/tmux/.config/tmux/options.conf b/tmux/.config/tmux/options.conf index a06803b..05533c5 100644 --- a/tmux/.config/tmux/options.conf +++ b/tmux/.config/tmux/options.conf @@ -24,3 +24,5 @@ set-option -g visual-silence off set-window-option -g monitor-activity off set-option -g bell-action none +# Enable hyperlinks +set-option -as terminal-features ",*:hyperlinks" diff --git a/zsh/.zshrc b/zsh/.zshrc index 3099148..c5f2a25 100755 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -15,6 +15,7 @@ export SAVEHIST=100000 export EDITOR="nvim" export BROWSER= export PAGER="less" +export TERM="xterm-256color" export GPG_TTY=$(tty) -- cgit v1.2.3