diff --git a/jrpotter/neovim/default.nix b/jrpotter/neovim/default.nix index c558eee..9d4cca7 100644 --- a/jrpotter/neovim/default.nix +++ b/jrpotter/neovim/default.nix @@ -31,6 +31,13 @@ let config = config.programs.neovim.nvim-lspconfig; }; + nvim-telescope = { + plugin = pkgs.vimPlugins.telescope-nvim; + config = '' + require('init.telescope').setup() + ''; + }; + nvim-treesitter = { plugin = (pkgs.vimPlugins.nvim-treesitter.withPlugins ( ps: with ps; [ @@ -73,6 +80,10 @@ in }; config = { + home.packages = with pkgs; [ + ripgrep + ]; + programs.neovim = { defaultEditor = true; plugins = map (p: @@ -84,6 +95,7 @@ in nvim-cmp nvim-dap nvim-lspconfig + nvim-telescope nvim-treesitter pkgs.vimPlugins.cmp-buffer pkgs.vimPlugins.cmp-nvim-lsp diff --git a/jrpotter/neovim/lua/init/telescope.lua b/jrpotter/neovim/lua/init/telescope.lua new file mode 100644 index 0000000..3d42437 --- /dev/null +++ b/jrpotter/neovim/lua/init/telescope.lua @@ -0,0 +1,45 @@ +local M = {} + +local function set_telescope_map(key, picker) + vim.keymap.set( + 'n', + string.format('%s', key), + string.format('Telescope %s', picker) + ) + vim.keymap.set( + 'n', + string.format('', key), + string.format('Telescope %s', picker) + ) +end + +function M.setup() + require('telescope').setup { + pickers = { + buffers = { theme = 'ivy' }, + find_files = { theme = 'ivy' }, + live_grep = { theme = 'ivy' }, + lsp_definitions = { theme = 'cursor' }, + lsp_implementations = { theme = 'cursor' }, + lsp_type_definitions = { theme = 'cursor' }, + }, + } + + set_telescope_map(';', 'resume') + set_telescope_map('b', 'buffers') + set_telescope_map('f', 'find_files') + + set_telescope_map('s', 'live_grep') + set_telescope_map('d', 'lsp_type_definitions') + set_telescope_map(']', 'lsp_definitions') + set_telescope_map('i', 'lsp_implementations') + + vim.api.nvim_create_autocmd('User', { + pattern = 'TelescopePreviewerLoaded', + callback = function() + vim.wo.wrap = true + end, + }) +end + +return M