diff --git a/README.md b/README.md index 6f35cf3..58b7a33 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Nixvim ## TODO -- [ ] Open last active buffer after :bd -- [ ] Code action -- [ ] DAP support +[ ] Open last active buffer after :bd +[ ] Code action +[ ] DAP support diff --git a/config/blink.nix b/config/blink.nix deleted file mode 100644 index d752b28..0000000 --- a/config/blink.nix +++ /dev/null @@ -1,40 +0,0 @@ -{ - - plugins = { - blink-cmp = { - enable = true; - settings = { - keymap = { - "" = [ - "scroll_documentation_up" - "fallback" - ]; - "" = [ - "scroll_documentation_down" - "fallback" - ]; - "" = [ - "select_next" - "fallback" - ]; - "" = [ - "select_prev" - "fallback" - ]; - "" = [ - "show" - "show_documentation" - "hide_documentation" - "fallback" - ]; - "" = [ - "select_and_accept" - "fallback" - ]; - }; - }; - }; - cmp-nvim-lsp.enable = true; - cmp.enable = true; - }; -} diff --git a/config/buffer/bufdelete.nix b/config/buffer/bufdelete.nix deleted file mode 100644 index dcf1211..0000000 --- a/config/buffer/bufdelete.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ helpers, ... }: -{ - plugins = { - bufdelete = { - enable = true; - }; - }; - - keymaps = [ - { - mode = [ "n" ]; - key = ""; - action = helpers.mkRaw '' - function() - require("bufdelete").bufdelete(0, false) - end - ''; - options = { - desc = "Toggle terminal"; - }; - } - ]; -} diff --git a/config/default.nix b/config/default.nix index 78f9be7..2ba6591 100644 --- a/config/default.nix +++ b/config/default.nix @@ -1,8 +1,6 @@ { # Import all your configuration modules here imports = [ - ./buffer/bufdelete.nix - ./blink.nix ./bufferline.nix ./comment.nix ./core.nix @@ -16,6 +14,7 @@ ./lsp ./lualine.nix ./neo-tree.nix + ./nvim-cmp.nix # ./project.nix ./rainbow-delimiters.nix ./telescope.nix @@ -23,5 +22,6 @@ ./treesitter.nix ./which-key.nix ]; + plugins.web-devicons.enable = true; } diff --git a/config/harpoon.nix b/config/harpoon.nix index fcefc8d..5b42eb6 100644 --- a/config/harpoon.nix +++ b/config/harpoon.nix @@ -1,53 +1,5 @@ -{ pkgs, ... }: { - # keymaps for this plugin are difined in config/keymaps/window-movements module - extraPlugins = with pkgs.vimPlugins; [ - harpoon2 - ]; - extraConfigLua = '' - local harpoon = require("harpoon") - harpoon:setup( - { - settings = { - save_on_toggle = true, - sync_on_ui_close = true, - key = function() - return vim.loop.cwd() - end, - }, - } - ) - - -- basic telescope configuration - -- local conf = require("telescope.config").values - -- local function toggle_telescope(harpoon_files) - -- local file_paths = {} - -- for _, item in ipairs(harpoon_files.items) do - -- table.insert(file_paths, item.value) - -- end - -- - -- require("telescope.pickers").new({}, { - -- prompt_title = "Harpoon", - -- finder = require("telescope.finders").new_table({ - -- results = file_paths, - -- }), - -- previewer = conf.file_previewer({}), - -- sorter = conf.generic_sorter({}), - -- layout_strategy = getLayoutStrategy() - -- }):find() - -- end - -- - -- vim.keymap.set("n", "", function() toggle_telescope(harpoon:list()) end, - -- { desc = "Open harpoon window" }) - vim.keymap.set("n", "", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end) - vim.keymap.set("n", "a", function() harpoon:list():add() end) - - vim.keymap.set("n", "", function() harpoon:list():select(1) end) - vim.keymap.set("n", "", function() harpoon:list():select(2) end) - vim.keymap.set("n", "", function() harpoon:list():select(3) end) - vim.keymap.set("n", "", function() harpoon:list():select(4) end) - -- Toggle previous & next buffers stored within Harpoon list - vim.keymap.set("n", "", function() harpoon:list():prev() end) - vim.keymap.set("n", "", function() harpoon:list():next() end) - ''; + plugins.harpoon = { + enable = true; + }; } diff --git a/config/keybindings.nix b/config/keybindings.nix index cdd86f8..35d5bc3 100644 --- a/config/keybindings.nix +++ b/config/keybindings.nix @@ -83,5 +83,14 @@ desc = "Next Buffer"; }; } + + { + mode = [ "n" "i" ]; + key = ""; + action = "tabprevious"; + options = { + desc = "Previous Tab"; + }; + } ]; } diff --git a/config/lsp/lsp.nix b/config/lsp/lsp.nix index db22606..2d55959 100644 --- a/config/lsp/lsp.nix +++ b/config/lsp/lsp.nix @@ -24,9 +24,6 @@ terraformls = { enable = true; }; - gopls = { - enable = true; - }; }; inlayHints = true; keymaps = { diff --git a/config/nvim-cmp.nix b/config/nvim-cmp.nix new file mode 100644 index 0000000..df8f3f1 --- /dev/null +++ b/config/nvim-cmp.nix @@ -0,0 +1,61 @@ +{ + plugins = { + cmp = { + enable = true; + settings = { + sources = [ + { name = "nvim_lsp"; } + { + name = "buffer"; # text within current buffer + option.get_bufnrs.__raw = "vim.api.nvim_list_bufs"; + keywordLength = 3; + } + { + name = "path"; # file system paths + keywordLength = 3; + } + { + name = "luasnip"; # snippets + keywordLength = 3; + } + ]; + mapping = { + "" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})"; + "" = "cmp.mapping.select_next_item()"; + "" = "cmp.mapping.select_prev_item()"; + "" = "cmp.mapping.abort()"; + "" = "cmp.mapping.scroll_docs(-4)"; + "" = "cmp.mapping.scroll_docs(4)"; + "" = "cmp.mapping.complete()"; + "" = "cmp.mapping.confirm({ select = true })"; + "" = "cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true })"; + }; + }; + }; + cmp-nvim-lsp.enable = true; + cmp-path.enable = true; + cmp-buffer.enable = true; + }; + keymaps = [ + # Need to map macro recording to another key due to: + # https://github.com/hrsh7th/nvim-cmp/issues/1692 + { + mode = [ "n" ]; + key = "q"; + action = "q"; + options = { + noremap = true; + silent = true; + }; + } + { + mode = [ "n" ]; + key = "q"; + action = ""; + options = { + noremap = true; + silent = true; + }; + } + ]; +} diff --git a/config/telescope.nix b/config/telescope.nix index 7eb2278..c394c3d 100644 --- a/config/telescope.nix +++ b/config/telescope.nix @@ -6,10 +6,7 @@ }; keymaps = [ { - mode = [ - "n" - "i" - ]; + mode = [ "n" "i" ]; key = ""; action = helpers.mkRaw '' function() @@ -21,14 +18,11 @@ }; } { - mode = [ - "n" - "i" - ]; + mode = [ "n" "i" ]; key = ""; action = helpers.mkRaw '' function() - require("telescope.builtin").live_grep() + require("telescope.builtin").help_tags() end ''; } diff --git a/config/toggleterm.nix b/config/toggleterm.nix index 68a840c..0cbac6a 100644 --- a/config/toggleterm.nix +++ b/config/toggleterm.nix @@ -4,7 +4,8 @@ }; keymaps = [ - { + +{ mode = [ "n" ]; key = "tt"; action = "ToggleTerm";