diff options
| -rw-r--r-- | users/seth/programs/neovim/config/init.lua | 2 | ||||
| -rw-r--r-- | users/seth/programs/neovim/config/keybinds.lua | 17 | ||||
| -rw-r--r-- | users/seth/programs/neovim/config/plugins/general.lua | 75 | ||||
| -rw-r--r-- | users/seth/programs/neovim/config/plugins/init.lua | 1 | ||||
| -rw-r--r-- | users/seth/programs/neovim/config/plugins/lsp.lua | 41 | ||||
| -rw-r--r-- | users/seth/programs/neovim/config/plugins/ui.lua | 40 | ||||
| -rw-r--r-- | users/seth/programs/neovim/default.nix | 43 |
7 files changed, 170 insertions, 49 deletions
diff --git a/users/seth/programs/neovim/config/init.lua b/users/seth/programs/neovim/config/init.lua index 6b22664..854f26c 100644 --- a/users/seth/programs/neovim/config/init.lua +++ b/users/seth/programs/neovim/config/init.lua @@ -6,7 +6,7 @@ opt.tabstop = 2 opt.shiftwidth = 2 opt.expandtab = false opt.smartindent = true -opt.wrap = false +opt.wrap = true -- appearance opt.syntax = "on" diff --git a/users/seth/programs/neovim/config/keybinds.lua b/users/seth/programs/neovim/config/keybinds.lua index a71f606..7dab12e 100644 --- a/users/seth/programs/neovim/config/keybinds.lua +++ b/users/seth/programs/neovim/config/keybinds.lua @@ -5,9 +5,20 @@ local set = function(mode, key, vimcmd) vim.keymap.set(mode, key, vimcmd, opts) end -set("n", "<leader>t", function() - vim.cmd("NvimTreeToggle") -end) +if pcall(require, "neo-tree.command") then + set("n", "<leader>t", function() + require("neo-tree.command").execute({ + toggle = true, + dir = vim.loop.cwd(), + }) + end) +end + +if pcall(require, "flash") then + set({ "n", "o", "x" }, "s", function() + require("flash").jump() + end) +end for i = 1, 9 do set("n", "<leader>" .. i, function() diff --git a/users/seth/programs/neovim/config/plugins/general.lua b/users/seth/programs/neovim/config/plugins/general.lua index 3c89ea6..f9a0c2c 100644 --- a/users/seth/programs/neovim/config/plugins/general.lua +++ b/users/seth/programs/neovim/config/plugins/general.lua @@ -1,8 +1,3 @@ ----- autopairs -require("nvim-autopairs").setup({ - disable_filetype = { "TeleScopePrompt" }, -}) - ---- catppuccin local compile_path = vim.fn.stdpath("cache") .. "/catppuccin-nvim" vim.fn.mkdir(compile_path, "p") @@ -12,14 +7,13 @@ require("catppuccin").setup({ compile_path = compile_path, flavour = "mocha", -- mocha, macchiato, frappe, latte integrations = { - barbar = true, cmp = true, + flash = true, gitsigns = true, - leap = true, native_lsp = { enabled = true, }, - nvimtree = true, + neotree = true, treesitter_context = true, treesitter = true, telescope = true, @@ -38,29 +32,76 @@ require("bufferline").setup({ mode = "buffers", numbers = "ordinal", separator_style = "slant", + offsets = { + { + filetype = "neo-tree", + text = "neo-tree", + highlight = "Directory", + text_align = "left", + }, + }, }, }) ---- gitsigns require("gitsigns").setup() ----- leap -require("leap").add_default_mappings() +---- indent-blankline.nvim +require("indent_blankline").setup({ + filetype_exclude = { + "help", + "neo-tree", + "Trouble", + "lazy", + "mason", + "notify", + "toggleterm", + }, + show_trailing_blankline_indent = false, + show_current_context = false, +}) ---- lualine require("lualine").setup({ options = { theme = "catppuccin", }, - extensions = { "nvim-tree" }, + extensions = { "neo-tree", "trouble" }, +}) + +---- mini.nvim +require("mini.pairs").setup({}) +require("mini.indentscope").setup({ + options = { try_as_border = true }, +}) + +vim.api.nvim_create_autocmd("FileType", { + pattern = { + "help", + "neo-tree", + "Trouble", + "lazy", + "mason", + "notify", + "toggleterm", + }, + callback = function() + vim.b.miniindentscope_disable = true + end, }) ---- nvim-tree -require("nvim-tree").setup() +require("neo-tree").setup({ + sources = { "filesystem", "buffers", "git_status", "document_symbols" }, + open_files_do_not_replace_types = { "terminal", "Trouble", "qf", "Outline" }, + filesystem = { + bind_to_cwd = false, + follow_current_file = { enabled = true }, + use_libuv_file_watcher = true, + }, +}) ----- treesitter -require("nvim-treesitter.configs").setup({ - auto_install = false, - highlight = { enable = true }, - indent = { enable = true }, +---- which-key +require("which-key").setup({ + plugins = { spelling = true }, }) diff --git a/users/seth/programs/neovim/config/plugins/init.lua b/users/seth/programs/neovim/config/plugins/init.lua index b123949..95883c7 100644 --- a/users/seth/programs/neovim/config/plugins/init.lua +++ b/users/seth/programs/neovim/config/plugins/init.lua @@ -1,2 +1,3 @@ require("getchoo.plugins.general") require("getchoo.plugins.lsp") +require("getchoo.plugins.ui") diff --git a/users/seth/programs/neovim/config/plugins/lsp.lua b/users/seth/programs/neovim/config/plugins/lsp.lua index 013d135..e776ed4 100644 --- a/users/seth/programs/neovim/config/plugins/lsp.lua +++ b/users/seth/programs/neovim/config/plugins/lsp.lua @@ -31,11 +31,14 @@ require("cmp").setup({ sources = cmp.config.sources({ { name = "nvim_lsp" }, { name = "luasnip" }, - { name = "path" }, + { name = "async_path" }, { name = "buffer" }, }), }) +---- gitsigns +require("gitsigns").setup() + ---- fidget require("fidget").setup() @@ -48,6 +51,8 @@ local sources = { lsp_servers = { ["bashls"] = "bash-language-server", ["clangd"] = "clangd", + ["eslint"] = "eslint", + ["nil_ls"] = "nil", ["pyright"] = "pyright-langserver", ["rust_analyzer"] = "rust-analyzer", ["tsserver"] = "typescript-language-server", @@ -57,7 +62,6 @@ local sources = { diagnostics.alex, diagnostics.codespell, diagnostics.deadnix, - diagnostics.eslint, diagnostics.pylint, diagnostics.shellcheck, diagnostics.statix, @@ -109,20 +113,6 @@ servers["lua_ls"] = { }, } -servers["nil_ls"] = { - capabilities = capabilities, - settings = { - ["nil"] = { - nix = { - flake = { - autoArchive = false, - autoEvalInputs = false, - }, - }, - }, - }, -} - for server, settings in pairs(servers) do require("lspconfig")[server].setup(settings) end @@ -152,10 +142,29 @@ local formatting_on_attach = function(client, bufnr) end end +require("mini.comment").setup({ + options = { + custom_commentstring = function() + return require("ts_context_commentstring.internal").calculate_commentstring() + or vim.bo.context_commentstring + end, + }, +}) + require("null-ls").setup({ on_attach = formatting_on_attach, sources = sources.null_ls, }) +require("nvim-treesitter.configs").setup({ + auto_install = false, + highlight = { enable = true }, + indent = { enable = true }, + context_commentstring = { + enable = true, + enable_autocmd = false, + }, +}) + ---- trouble require("trouble").setup() diff --git a/users/seth/programs/neovim/config/plugins/ui.lua b/users/seth/programs/neovim/config/plugins/ui.lua new file mode 100644 index 0000000..3a0cc2e --- /dev/null +++ b/users/seth/programs/neovim/config/plugins/ui.lua @@ -0,0 +1,40 @@ +require("dressing") + +vim.notify = require("notify") + +vim.ui.select = function(...) + return vim.ui.select(...) +end + +vim.ui.input = function(...) + return vim.ui.input(...) +end + +require("noice").setup({ + lsp = { + override = { + ["vim.lsp.util.convert_input_to_markdown_lines"] = true, + ["vim.lsp.util.stylize_markdown"] = true, + ["cmp.entry.get_documentation"] = true, + }, + }, + routes = { + { + filter = { + event = "msg_show", + any = { + { find = "%d+L, %d+B" }, + { find = "; after #%d+" }, + { find = "; before #%d+" }, + }, + }, + view = "mini", + }, + }, + presets = { + bottom_search = true, + command_palette = true, + long_message_to_split = true, + inc_rename = true, + }, +}) diff --git a/users/seth/programs/neovim/default.nix b/users/seth/programs/neovim/default.nix index fe7edd3..2a186ac 100644 --- a/users/seth/programs/neovim/default.nix +++ b/users/seth/programs/neovim/default.nix @@ -28,13 +28,9 @@ in { sumneko-lua-language-server ]; plugins = with pkgs.vimPlugins; [ - bufferline-nvim + # general catppuccin-nvim - cmp-nvim-lsp - cmp-buffer - cmp_luasnip - cmp-path - editorconfig-nvim + # TODO: don't pin when deprecation notice # is no longer in nixpkgs (fidget-nvim.overrideAttrs (_: { @@ -45,21 +41,44 @@ in { hash = "sha256-v9qARsW8Gozit4Z3+igiemjI467QgRhwM+crqwO9r6U="; }; })) + + flash-nvim gitsigns-nvim - leap-nvim + indent-blankline-nvim lualine-nvim - luasnip - nvim-autopairs + neo-tree-nvim + nvim-web-devicons + mini-nvim + + # completion nvim-cmp + cmp-nvim-lsp + cmp-buffer + cmp_luasnip + cmp-async-path + luasnip + + # ui + dressing-nvim + noice-nvim + nui-nvim + nvim-notify + + # lsp nvim-lspconfig null-ls-nvim - nvim-tree-lua - nvim-treesitter.withAllGrammars - nvim-web-devicons pkgs.vim-just + + ## utils + bufferline-nvim plenary-nvim telescope-nvim trouble-nvim + which-key-nvim + + # treesitter + nvim-treesitter.withAllGrammars + nvim-ts-context-commentstring ]; extraLuaConfig = '' require("getchoo") |
