diff options
author | David Luevano Alvarado <david@luevano.xyz> | 2023-06-03 12:22:09 -0600 |
---|---|---|
committer | David Luevano Alvarado <david@luevano.xyz> | 2023-06-03 12:22:09 -0600 |
commit | ad9bdf2f20ce1357c788a749117a3a5d2d3a3c01 (patch) | |
tree | 6503f3b07d1cf5f38187dda84f0d22812c7dd936 /lua | |
parent | 5ecf844b1f2efbdc86b1653483f17d7ecb39f8ee (diff) |
move some mappings into telescope config, separate fzf
Diffstat (limited to 'lua')
-rw-r--r-- | lua/plugins/init.lua | 12 | ||||
-rw-r--r-- | lua/plugins/neo-tree.lua | 7 | ||||
-rw-r--r-- | lua/plugins/telescope-fzf-native.lua | 8 | ||||
-rw-r--r-- | lua/plugins/telescope.lua | 36 |
4 files changed, 48 insertions, 15 deletions
diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index b9f4cbb..9478ab5 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -74,18 +74,6 @@ return { -- "gc" to comment visual regions/lines { 'numToStr/Comment.nvim', opts = {} }, - -- Fuzzy Finder (files, lsp, etc) - { 'nvim-telescope/telescope.nvim', branch = '0.1.x', dependencies = { 'nvim-lua/plenary.nvim' } }, - - -- Fuzzy Finder Algorithm which requires local dependencies to be built - { - 'nvim-telescope/telescope-fzf-native.nvim', - build = 'make', - cond = function() - return vim.fn.executable 'make' == 1 - end, - }, - { -- Highlight, edit, and navigate code 'nvim-treesitter/nvim-treesitter', diff --git a/lua/plugins/neo-tree.lua b/lua/plugins/neo-tree.lua index e83de80..64b0549 100644 --- a/lua/plugins/neo-tree.lua +++ b/lua/plugins/neo-tree.lua @@ -2,9 +2,6 @@ return { 'nvim-neo-tree/neo-tree.nvim', cmd = 'Neotree', version = '*', - keys = { - { '<leader>nt', '<CMD>Neotree toggle<CR>', desc = 'Toggle [N]eo[t]ree' }, - }, dependencies = { 'nvim-lua/plenary.nvim', 'MunifTanjim/nui.nvim', @@ -16,4 +13,8 @@ return { hijack_netrw_behavior = 'open_current', }, }, + -- keys is used for Lazy-load + keys = { + { '<leader>nt', '<CMD>Neotree toggle<CR>', desc = 'Toggle [N]eo[t]ree' }, + }, } diff --git a/lua/plugins/telescope-fzf-native.lua b/lua/plugins/telescope-fzf-native.lua new file mode 100644 index 0000000..1fe2371 --- /dev/null +++ b/lua/plugins/telescope-fzf-native.lua @@ -0,0 +1,8 @@ +return { + 'nvim-telescope/telescope-fzf-native.nvim', + build = 'make', + config = function() + pcall(require('telescope').load_extension, 'fzf') + return vim.fn.executable 'make' == 1 + end, +} diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua new file mode 100644 index 0000000..d182d7c --- /dev/null +++ b/lua/plugins/telescope.lua @@ -0,0 +1,36 @@ +return { + 'nvim-telescope/telescope.nvim', + branch = '0.1.x', + dependencies = { + 'nvim-lua/plenary.nvim', + }, + opts = { + defaults = { + mappings = { + i = { + ['<C-u>'] = false, + ['<C-d>'] = false, + }, + }, + }, + }, + -- Best place to key keymaps in this file + config = function() + vim.keymap.set('n', '<leader>?', require('telescope.builtin').oldfiles, { desc = '[?] Find recently opened files' }) + vim.keymap.set('n', '<leader><space>', require('telescope.builtin').buffers, { desc = '[ ] Find existing buffers' }) + vim.keymap.set('n', '<leader>/', function() + -- You can pass additional configuration to telescope to change theme, layout, etc. + require('telescope.builtin').current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { + winblend = 10, + previewer = false, + }) + end, { desc = '[/] Fuzzily search in current buffer' }) + vim.keymap.set('n', '<leader>gf', require('telescope.builtin').git_files, { desc = 'Search [G]it [F]iles' }) + vim.keymap.set('n', '<leader>sf', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' }) + vim.keymap.set('n', '<leader>sh', require('telescope.builtin').help_tags, { desc = '[S]earch [H]elp' }) + vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string, { desc = '[S]earch current [W]ord' }) + vim.keymap.set('n', '<leader>sg', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' }) + vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { desc = '[S]earch [D]iagnostics' }) + -- Other keybinds present for the LSP currently at init.lua + end, +} |