diff --git a/README.md b/README.md index 58b7a33..6f35cf3 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 new file mode 100644 index 0000000..d752b28 --- /dev/null +++ b/config/blink.nix @@ -0,0 +1,40 @@ +{ + + 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 new file mode 100644 index 0000000..dcf1211 --- /dev/null +++ b/config/buffer/bufdelete.nix @@ -0,0 +1,23 @@ +{ 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 2ba6591..78f9be7 100644 --- a/config/default.nix +++ b/config/default.nix @@ -1,6 +1,8 @@ { # Import all your configuration modules here imports = [ + ./buffer/bufdelete.nix + ./blink.nix ./bufferline.nix ./comment.nix ./core.nix @@ -14,7 +16,6 @@ ./lsp ./lualine.nix ./neo-tree.nix - ./nvim-cmp.nix # ./project.nix ./rainbow-delimiters.nix ./telescope.nix @@ -22,6 +23,5 @@ ./treesitter.nix ./which-key.nix ]; - plugins.web-devicons.enable = true; } diff --git a/config/harpoon.nix b/config/harpoon.nix index 5b42eb6..fcefc8d 100644 --- a/config/harpoon.nix +++ b/config/harpoon.nix @@ -1,5 +1,53 @@ +{ pkgs, ... }: { - plugins.harpoon = { - enable = true; - }; + # 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) + ''; } diff --git a/config/keybindings.nix b/config/keybindings.nix index 35d5bc3..cdd86f8 100644 --- a/config/keybindings.nix +++ b/config/keybindings.nix @@ -83,14 +83,5 @@ 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 2d55959..db22606 100644 --- a/config/lsp/lsp.nix +++ b/config/lsp/lsp.nix @@ -24,6 +24,9 @@ terraformls = { enable = true; }; + gopls = { + enable = true; + }; }; inlayHints = true; keymaps = { diff --git a/config/nvim-cmp.nix b/config/nvim-cmp.nix deleted file mode 100644 index df8f3f1..0000000 --- a/config/nvim-cmp.nix +++ /dev/null @@ -1,61 +0,0 @@ -{ - 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 c394c3d..7eb2278 100644 --- a/config/telescope.nix +++ b/config/telescope.nix @@ -6,7 +6,10 @@ }; keymaps = [ { - mode = [ "n" "i" ]; + mode = [ + "n" + "i" + ]; key = ""; action = helpers.mkRaw '' function() @@ -18,11 +21,14 @@ }; } { - mode = [ "n" "i" ]; + mode = [ + "n" + "i" + ]; key = ""; action = helpers.mkRaw '' function() - require("telescope.builtin").help_tags() + require("telescope.builtin").live_grep() end ''; } diff --git a/config/toggleterm.nix b/config/toggleterm.nix index 0cbac6a..68a840c 100644 --- a/config/toggleterm.nix +++ b/config/toggleterm.nix @@ -4,8 +4,7 @@ }; keymaps = [ - -{ + { mode = [ "n" ]; key = "tt"; action = "ToggleTerm";