Add telescope plugin.

main
Joshua Potter 2023-11-24 08:21:43 -07:00
parent d0cf9f8722
commit 8f25bede11
2 changed files with 57 additions and 0 deletions

View File

@ -31,6 +31,13 @@ let
config = config.programs.neovim.nvim-lspconfig; config = config.programs.neovim.nvim-lspconfig;
}; };
nvim-telescope = {
plugin = pkgs.vimPlugins.telescope-nvim;
config = ''
require('init.telescope').setup()
'';
};
nvim-treesitter = { nvim-treesitter = {
plugin = (pkgs.vimPlugins.nvim-treesitter.withPlugins ( plugin = (pkgs.vimPlugins.nvim-treesitter.withPlugins (
ps: with ps; [ ps: with ps; [
@ -73,6 +80,10 @@ in
}; };
config = { config = {
home.packages = with pkgs; [
ripgrep
];
programs.neovim = { programs.neovim = {
defaultEditor = true; defaultEditor = true;
plugins = map (p: plugins = map (p:
@ -84,6 +95,7 @@ in
nvim-cmp nvim-cmp
nvim-dap nvim-dap
nvim-lspconfig nvim-lspconfig
nvim-telescope
nvim-treesitter nvim-treesitter
pkgs.vimPlugins.cmp-buffer pkgs.vimPlugins.cmp-buffer
pkgs.vimPlugins.cmp-nvim-lsp pkgs.vimPlugins.cmp-nvim-lsp

View File

@ -0,0 +1,45 @@
local M = {}
local function set_telescope_map(key, picker)
vim.keymap.set(
'n',
string.format('<c-;>%s', key),
string.format('<cmd>Telescope %s<cr>', picker)
)
vim.keymap.set(
'n',
string.format('<c-;><c-%s>', key),
string.format('<cmd>Telescope %s<cr>', 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