diff --git a/home/neovim.nix b/home/neovim.nix index 57028f7..c652260 100644 --- a/home/neovim.nix +++ b/home/neovim.nix @@ -4,9 +4,13 @@ let in { imports = [ + ./neovim/telescope.nix ./neovim/coc.nix ./neovim/haskell.nix ./neovim/zk.nix + # which-key must be the last import for it to recognize the keybindings of + # previous imports. + ./neovim/which-key.nix ]; programs.neovim = { enable = true; @@ -43,70 +47,6 @@ in src = inputs.himalaya + /vim; }) - # Doom-emacs like experience - { - plugin = vim-which-key; - type = "lua"; - # TODO: How to port this to Lua? - config = '' - vim.cmd([[ - map - let g:mapleader = "\" - let g:maplocalleader = ',' - nnoremap :WhichKey '' - nnoremap :WhichKey ',' - ]]) - ''; - } - # TODO: Don't know how to configure this correctly - # nvim-whichkey-setup-lua - - { - plugin = telescope-nvim; - type = "lua"; - config = '' - nmap("ff", ":Telescope find_files") - nmap("fg", ":Telescope live_grep") - nmap("fb", ":Telescope buffers") - nmap("fh", ":Telescope help_tags") - ''; - } - { - plugin = telescope-zoxide; - type = "lua"; - config = '' - nmap("fz", ":Telescope zoxide list") - ''; - } - { - plugin = telescope-file-browser-nvim; - type = "lua"; - config = '' - -- You don't need to set any of these options. - -- IMPORTANT!: this is only a showcase of how you can set default options! - require("telescope").setup { - extensions = { - file_browser = { - theme = "ivy", - mappings = { - ["i"] = { - -- your custom insert mode mappings - }, - ["n"] = { - -- your custom normal mode mappings - }, - }, - }, - }, - } - -- To get telescope-file-browser loaded and working with telescope, - -- you need to call load_extension, somewhere after setup function: - require("telescope").load_extension "file_browser" - nmap("fb", ":Telescope file_browser path=%:p:h") - nmap("fB", ":Telescope file_browser") - ''; - } - { plugin = lualine-nvim; type = "lua"; diff --git a/home/neovim/telescope.nix b/home/neovim/telescope.nix new file mode 100644 index 0000000..b891bf2 --- /dev/null +++ b/home/neovim/telescope.nix @@ -0,0 +1,53 @@ +{ pkgs, inputs, system, ... }: +{ + programs.neovim = { + plugins = with pkgs.vimPlugins; [ + { + plugin = telescope-nvim; + type = "lua"; + config = '' + nmap("ff", ":Telescope find_files") + nmap("fg", ":Telescope live_grep") + nmap("fb", ":Telescope buffers") + nmap("fh", ":Telescope help_tags") + ''; + } + { + plugin = telescope-zoxide; + type = "lua"; + config = '' + nmap("fz", ":Telescope zoxide list") + ''; + } + { + plugin = telescope-file-browser-nvim; + type = "lua"; + config = '' + -- You don't need to set any of these options. + -- IMPORTANT!: this is only a showcase of how you can set default options! + require("telescope").setup { + extensions = { + file_browser = { + theme = "ivy", + mappings = { + ["i"] = { + -- your custom insert mode mappings + }, + ["n"] = { + -- your custom normal mode mappings + }, + }, + }, + }, + } + -- To get telescope-file-browser loaded and working with telescope, + -- you need to call load_extension, somewhere after setup function: + require("telescope").load_extension "file_browser" + nmap("fb", ":Telescope file_browser path=%:p:h") + nmap("fB", ":Telescope file_browser") + ''; + } + + ]; + }; +} diff --git a/home/neovim/which-key.nix b/home/neovim/which-key.nix new file mode 100644 index 0000000..83b16ec --- /dev/null +++ b/home/neovim/which-key.nix @@ -0,0 +1,26 @@ +{ pkgs, inputs, system, ... }: +{ + programs.neovim = { + plugins = with pkgs.vimPlugins; [ + # Doom-emacs like experience + { + plugin = vim-which-key; + type = "lua"; + # TODO: How to port this to Lua? + config = '' + vim.cmd([[ + map + let g:mapleader = "\" + let g:maplocalleader = ',' + nnoremap :WhichKey '' + nnoremap :WhichKey ',' + ]]) + ''; + } + # TODO: Don't know how to configure this correctly + # nvim-whichkey-setup-lua + + + ]; + }; +}