diff options
| author | Eugene Triguba <eugene.triguba@paymentworks.com> | 2025-05-27 19:20:34 -0400 |
|---|---|---|
| committer | Eugene Triguba <eugene.triguba@paymentworks.com> | 2025-05-27 19:20:34 -0400 |
| commit | c3465bef27510c36afc7147a1c88d863391035dd (patch) | |
| tree | e67d648bcbc63142bf28e2e3ac611c3a7c8b1e4c | |
| parent | Merge branch 'main' of github.com:eugenetriguba/dotfiles (diff) | |
| download | dotfiles-c3465bef27510c36afc7147a1c88d863391035dd.zip | |
adjust nvim config
| -rw-r--r-- | nvim/.config/nvim/lazy-lock.json | 1 | ||||
| -rw-r--r-- | nvim/.config/nvim/lua/config/autocmds.lua | 2 | ||||
| -rw-r--r-- | nvim/.config/nvim/lua/config/filetypes.lua | 4 | ||||
| -rw-r--r-- | nvim/.config/nvim/lua/plugins/blink.lua | 3 | ||||
| -rw-r--r-- | nvim/.config/nvim/lua/plugins/conform.lua | 56 | ||||
| -rw-r--r-- | nvim/.config/nvim/lua/plugins/debug.lua | 21 | ||||
| -rw-r--r-- | nvim/.config/nvim/lua/plugins/indent_line.lua | 4 | ||||
| -rw-r--r-- | nvim/.config/nvim/lua/plugins/lint.lua | 27 | ||||
| -rw-r--r-- | nvim/.config/nvim/lua/plugins/lsp.lua | 2 | ||||
| -rw-r--r-- | nvim/.config/nvim/lua/plugins/mini.lua | 4 | ||||
| -rw-r--r-- | nvim/.config/nvim/lua/plugins/telescope.lua | 14 | ||||
| -rw-r--r-- | nvim/.config/nvim/lua/plugins/todo-comments.lua | 2 | ||||
| -rw-r--r-- | nvim/.config/nvim/lua/plugins/tokyonight.lua | 8 | ||||
| -rw-r--r-- | nvim/.config/nvim/lua/plugins/tree-sitter.lua | 4 | ||||
| -rw-r--r-- | nvim/.config/nvim/lua/plugins/vim-sleuth.lua | 5 | ||||
| -rw-r--r-- | nvim/.config/nvim/lua/plugins/which-key.lua | 3 |
16 files changed, 86 insertions, 74 deletions
diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json index 74bb628..ea24cea 100644 --- a/nvim/.config/nvim/lazy-lock.json +++ b/nvim/.config/nvim/lazy-lock.json @@ -19,6 +19,7 @@ "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": "b8e7957bde4cbb3cb25a13a62548f7c273b026e9" }, 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/config/filetypes.lua b/nvim/.config/nvim/lua/config/filetypes.lua index 428cb14..38ae06f 100644 --- a/nvim/.config/nvim/lua/config/filetypes.lua +++ b/nvim/.config/nvim/lua/config/filetypes.lua @@ -7,8 +7,8 @@ vim.api.nvim_create_autocmd('FileType', { vim.opt_local.shiftwidth = 4 vim.opt_local.expandtab = true - -- 88 character length lines for Black formatter - vim.opt_local.colorcolumn = '88' + -- 120 character length lines for Black formatter + vim.opt_local.colorcolumn = '120' -- Google-style docstrings vim.g.python_style = 'google' 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 `<c-space>` 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..ee2777c 100644 --- a/nvim/.config/nvim/lua/plugins/conform.lua +++ b/nvim/.config/nvim/lua/plugins/conform.lua @@ -13,28 +13,58 @@ return { desc = '[F]ormat buffer', }, }, + config = function() + vim.api.nvim_create_user_command('FormatDisable', function(args) + if args.bang then + -- FormatDisable! will disable formatting just for this buffer + vim.b.disable_autoformat = true + else + vim.g.disable_autoformat = true + end + end, { + desc = 'Disable autoformat-on-save', + bang = true, + }) + + 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, 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' }, + javascript = { 'prettierd', 'prettier', stop_after_first = true }, + }, + formatters = { + isort = { + prepend_args = { '--profile', 'black' }, + }, + black = { + prepend_args = { '--line-length', '120' }, + }, }, }, }, diff --git a/nvim/.config/nvim/lua/plugins/debug.lua b/nvim/.config/nvim/lua/plugins/debug.lua index 753cb0c..fb59be1 100644 --- a/nvim/.config/nvim/lua/plugins/debug.lua +++ b/nvim/.config/nvim/lua/plugins/debug.lua @@ -1,15 +1,9 @@ -- 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', @@ -17,15 +11,15 @@ return { -- 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! { '<F5>', function() @@ -86,24 +80,19 @@ 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 +133,7 @@ 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..a4b6c05 100644 --- a/nvim/.config/nvim/lua/plugins/lint.lua +++ b/nvim/.config/nvim/lua/plugins/lint.lua @@ -1,25 +1,18 @@ 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 +26,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..a4cbc18 100644 --- a/nvim/.config/nvim/lua/plugins/lsp.lua +++ b/nvim/.config/nvim/lua/plugins/lsp.lua @@ -1,5 +1,5 @@ +-- 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..8dc2cc7 100644 --- a/nvim/.config/nvim/lua/plugins/todo-comments.lua +++ b/nvim/.config/nvim/lua/plugins/todo-comments.lua @@ -1,5 +1,5 @@ +-- 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..93904da 100644 --- a/nvim/.config/nvim/lua/plugins/vim-sleuth.lua +++ b/nvim/.config/nvim/lua/plugins/vim-sleuth.lua @@ -1,4 +1,5 @@ +-- 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 |