diff options
Diffstat (limited to 'nvim')
| -rw-r--r-- | nvim/.config/nvim/lazy-lock.json | 6 | ||||
| -rw-r--r-- | nvim/.config/nvim/lua/config/filetypes.lua | 4 | ||||
| -rw-r--r-- | nvim/.config/nvim/lua/config/global.lua | 1 | ||||
| -rw-r--r-- | nvim/.config/nvim/lua/config/keymaps.lua | 21 | ||||
| -rw-r--r-- | nvim/.config/nvim/lua/plugins/barbar.lua | 2 | ||||
| -rw-r--r-- | nvim/.config/nvim/lua/plugins/conform.lua | 27 | ||||
| -rw-r--r-- | nvim/.config/nvim/lua/plugins/lint.lua | 3 | ||||
| -rw-r--r-- | nvim/.config/nvim/lua/plugins/lsp.lua | 16 | ||||
| -rw-r--r-- | nvim/.config/nvim/lua/plugins/mini.lua | 7 | ||||
| -rw-r--r-- | nvim/.config/nvim/lua/plugins/telescope.lua | 1 | ||||
| -rw-r--r-- | nvim/.config/nvim/lua/plugins/todo-comments.lua | 1 |
11 files changed, 62 insertions, 27 deletions
diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json index 36f1ba8..652413b 100644 --- a/nvim/.config/nvim/lazy-lock.json +++ b/nvim/.config/nvim/lazy-lock.json @@ -6,17 +6,14 @@ "blink.cmp": { "branch": "main", "commit": "9bcb14b43852a6f2bfd5ac9ef29cb5cf09b1b39b" }, "conform.nvim": { "branch": "master", "commit": "8132ec733eed3bf415b97b76797ca41b59f51d7d" }, "copilot.lua": { "branch": "master", "commit": "46f4b7d026cba9497159dcd3e6aa61a185cb1c48" }, - "fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" }, "gitsigns.nvim": { "branch": "main", "commit": "1b0350ab707713b2bc6c236151f1a324175347b1" }, "indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, "lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" }, "lualine.nvim": { "branch": "master", "commit": "a94fc68960665e54408fe37dcf573193c4ce82c9" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "c4c84f4521d62de595c0d0f718a9a40c1890c8ce" }, "mason-nvim-dap.nvim": { "branch": "main", "commit": "4c2cdc69d69fe00c15ae8648f7e954d99e5de3ea" }, - "mason-tool-installer.nvim": { "branch": "main", "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" }, "mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" }, - "mini.nvim": { "branch": "main", "commit": "145476d74aaa3236db9dc6705d0fa3eb0f4f8352" }, + "mini.nvim": { "branch": "main", "commit": "8ca3965e68edfee5f438d4063f5adf5afa255884" }, "neo-tree.nvim": { "branch": "main", "commit": "f481de16a0eb59c985abac8985e3f2e2f75b4875" }, "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, "nvim-autopairs": { "branch": "master", "commit": "2647cce4cb64fb35c212146663384e05ae126bdf" }, @@ -26,7 +23,6 @@ "nvim-dap-python": { "branch": "master", "commit": "261ce649d05bc455a29f9636dc03f8cdaa7e0e2c" }, "nvim-dap-ui": { "branch": "master", "commit": "73a26abf4941aa27da59820fd6b028ebcdbcf932" }, "nvim-lint": { "branch": "master", "commit": "2b0039b8be9583704591a13129c600891ac2c596" }, - "nvim-lspconfig": { "branch": "master", "commit": "6bba673aa8993eceec233be17b42ddfb9540794b" }, "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, "nvim-web-devicons": { "branch": "master", "commit": "19d6211c78169e78bab372b585b6fb17ad974e82" }, diff --git a/nvim/.config/nvim/lua/config/filetypes.lua b/nvim/.config/nvim/lua/config/filetypes.lua index 3c98c6b..139bfb7 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/config/global.lua b/nvim/.config/nvim/lua/config/global.lua index f5462f9..8581ae9 100644 --- a/nvim/.config/nvim/lua/config/global.lua +++ b/nvim/.config/nvim/lua/config/global.lua @@ -13,3 +13,4 @@ vim.g.loaded_netrwPlugin = 1 -- Set Python 3 to a virtual environment with `pynvim` installed -- to support python plugins. vim.g.python3_host_prog = vim.fn.expand '~/.config/nvim/venv/bin/python' + diff --git a/nvim/.config/nvim/lua/config/keymaps.lua b/nvim/.config/nvim/lua/config/keymaps.lua index 3af4d7c..baa81f8 100644 --- a/nvim/.config/nvim/lua/config/keymaps.lua +++ b/nvim/.config/nvim/lua/config/keymaps.lua @@ -1,6 +1,16 @@ -- [[ Keymaps ]] -- See `:help vim.keymap.set()` local map = vim.keymap.set +local telescope = require('telescope.builtin') + +map('n', '<leader>ff', telescope.find_files, { desc = 'Telescope find files' }) +map('n', '<leader>fg', telescope.live_grep, { desc = 'Telescope live grep' }) +map('n', '<leader>fb', telescope.buffers, { desc = 'Telescope buffers' }) +map('n', '<leader>fh', telescope.help_tags, { desc = 'Telescope help tags' }) + + +map("n", "<leader>sh", ":split<CR>") +map("n", "<leader>sv", ":vsplit<CR>") -- Clear highlights on search when pressing <Esc> in normal mode -- See `:help hlsearch` @@ -30,3 +40,14 @@ map('n', '<C-S-h>', '<C-w>H', { desc = 'Move window to the left' }) map('n', '<C-S-l>', '<C-w>L', { desc = 'Move window to the right' }) map('n', '<C-S-j>', '<C-w>J', { desc = 'Move window to the lower' }) map('n', '<C-S-k>', '<C-w>K', { desc = 'Move window to the upper' }) + +local function confirm_and_delete_buffer() + local confirm = vim.fn.confirm("Delete buffer and file?", "&Y\n&N", 2) + + if confirm == 1 then + os.remove(vim.fn.expand "%") + vim.api.nvim_buf_delete(0, { force = true }) + end +end + +map('n', '<leader>df', confirm_and_delete_buffer) diff --git a/nvim/.config/nvim/lua/plugins/barbar.lua b/nvim/.config/nvim/lua/plugins/barbar.lua index 9787b05..f7e0252 100644 --- a/nvim/.config/nvim/lua/plugins/barbar.lua +++ b/nvim/.config/nvim/lua/plugins/barbar.lua @@ -68,7 +68,7 @@ return { -- Other: -- :BarbarEnable - enables barbar (enabled by default) - -- :BarbarDisable - very bad command, should never be used + -- :BarbarDisable - disables barbar end, }, } diff --git a/nvim/.config/nvim/lua/plugins/conform.lua b/nvim/.config/nvim/lua/plugins/conform.lua index 1d4be80..627607f 100644 --- a/nvim/.config/nvim/lua/plugins/conform.lua +++ b/nvim/.config/nvim/lua/plugins/conform.lua @@ -46,6 +46,26 @@ return { desc = 'Toggle autoformat globally', }, }, + 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) @@ -68,8 +88,9 @@ return { formatters_by_ft = { lua = { 'stylua' }, go = { 'goimports', 'gofmt' }, - python = { 'isort', 'black' }, + python = { 'black', 'isort' }, rust = { 'rustfmt' }, + sh = { 'shfmt' }, javascript = { 'prettierd', 'prettier', stop_after_first = true }, typescript = { 'prettierd', 'prettier', stop_after_first = true }, javascriptreact = { 'prettierd', 'prettier', stop_after_first = true }, @@ -77,12 +98,14 @@ return { css = { 'prettierd', 'prettier', stop_after_first = true }, htmldjango = { 'prettierd', 'prettier', stop_after_first = true }, html = { 'prettierd', 'prettier', stop_after_first = true }, - sh = { 'shfmt' }, }, formatters = { isort = { prepend_args = { '--profile', 'black' }, }, + black = { + prepend_args = { '--line-length', '120' }, + }, }, }, config = function(_, opts) diff --git a/nvim/.config/nvim/lua/plugins/lint.lua b/nvim/.config/nvim/lua/plugins/lint.lua index 4e41d83..66923a7 100644 --- a/nvim/.config/nvim/lua/plugins/lint.lua +++ b/nvim/.config/nvim/lua/plugins/lint.lua @@ -1,7 +1,4 @@ --- Linting - return { - { 'mfussenegger/nvim-lint', event = { 'BufReadPre', 'BufNewFile' }, diff --git a/nvim/.config/nvim/lua/plugins/lsp.lua b/nvim/.config/nvim/lua/plugins/lsp.lua index f3c51ad..c184284 100644 --- a/nvim/.config/nvim/lua/plugins/lsp.lua +++ b/nvim/.config/nvim/lua/plugins/lsp.lua @@ -1,5 +1,4 @@ -- LSP Plugins - return { { -- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins @@ -171,7 +170,15 @@ return { -- See `:help lspconfig-all` for a list of all the pre-configured LSPs clangd = {}, gopls = {}, - pyright = {}, + 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. @@ -185,6 +192,7 @@ return { }, }, }, + stylua = {} tailwindcss = {}, mesonlsp = {}, } @@ -203,11 +211,7 @@ return { -- You can add other tools here that you want Mason to install -- for you, so that they are available from within Neovim. local ensure_installed = vim.tbl_keys(servers or {}) - vim.list_extend(ensure_installed, { - 'stylua', -- Used to format Lua code - }) require('mason-tool-installer').setup { ensure_installed = ensure_installed } - require('mason-lspconfig').setup { ensure_installed = {}, -- explicitly set to an empty table (Populated via mason-tool-installer) automatic_installation = false, diff --git a/nvim/.config/nvim/lua/plugins/mini.lua b/nvim/.config/nvim/lua/plugins/mini.lua index 0138e29..4048fae 100644 --- a/nvim/.config/nvim/lua/plugins/mini.lua +++ b/nvim/.config/nvim/lua/plugins/mini.lua @@ -19,11 +19,7 @@ return { -- - sr)' - [S]urround [R]eplace [)] ['] require('mini.surround').setup() - -- Simple and easy statusline. - -- You could remove this setup call if you don't like it, - -- and try some other statusline plugin local statusline = require 'mini.statusline' - -- set use_icons to true if you have a Nerd Font statusline.setup { use_icons = vim.g.have_nerd_font } -- You can configure sections in the statusline by overriding their @@ -33,9 +29,6 @@ return { statusline.section_location = function() return '%2l:%-2v' end - - -- ... and there is more! - -- Check out: https://github.com/echasnovski/mini.nvim end, }, } diff --git a/nvim/.config/nvim/lua/plugins/telescope.lua b/nvim/.config/nvim/lua/plugins/telescope.lua index 90064f6..9e3c703 100644 --- a/nvim/.config/nvim/lua/plugins/telescope.lua +++ b/nvim/.config/nvim/lua/plugins/telescope.lua @@ -74,6 +74,7 @@ return { vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' }) vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' }) vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' }) + vim.keymap.set('n', '<leader>sc', builtin.commands, { desc = '[S]earch [C]ommands'}) vim.keymap.set('n', '<leader>ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' }) vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' }) vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' }) diff --git a/nvim/.config/nvim/lua/plugins/todo-comments.lua b/nvim/.config/nvim/lua/plugins/todo-comments.lua index 70f72d0..8dc2cc7 100644 --- a/nvim/.config/nvim/lua/plugins/todo-comments.lua +++ b/nvim/.config/nvim/lua/plugins/todo-comments.lua @@ -1,5 +1,4 @@ -- Highlight todo, notes, etc in comments - return { { 'folke/todo-comments.nvim', |