diff --git a/lua/plugins/fzf-lua.lua b/lua/plugins/fzf-lua.lua new file mode 100644 index 0000000..b314ebd --- /dev/null +++ b/lua/plugins/fzf-lua.lua @@ -0,0 +1,97 @@ +return { + 'ibhagwan/fzf-lua', + dependencies = { 'nvim-tree/nvim-web-devicons' }, + config = function() + require('fzf-lua').setup({}) + end, + cmd = 'FzfLua', + keys = { + { + 'f', + function() + require('fzf-lua').files() + end, + desc = 'Find files', + }, + { + 'c', + function() + require('fzf-lua').commands() + end, + desc = 'Find commands', + }, + { + 'g', + function() + require('fzf-lua').git_files() + end, + desc = 'Find git files', + }, + { + 'o', + function() + require('fzf-lua').oldfiles() + end, + desc = 'Find old files', + }, + { + 'b', + function() + require('fzf-lua').buffers() + end, + desc = 'Select buffer', + }, + { + 'q', + function() + require('fzf-lua').quickfix() + end, + desc = 'Quickfix list', + }, + { + 'l', + function() + require('fzf-lua').live_grep_native() + end, + desc = 'Search in project', + }, + { + 'd', + function() + require('fzf-lua').grep_cword() + end, + mode = { 'n' }, + desc = 'Find word under cursor', + }, + { + 'd', + function() + require('fzf-lua').grep_visual() + end, + mode = { 'x', 'v' }, + desc = 'Find word under cursor', + }, + { + 'j', + function() + require('fzf-lua').jumps() + end, + desc = 'Open jumplist', + }, + { + '', + function() + require('fzf-lua').grep_curbuf() + end, + desc = 'Find in buffer', + }, + { + '', + function() + require('fzf-lua').complete_path() + end, + mode = { "n", "v", "i" }, + desc = 'Fuzzy complete path', + }, + } +} diff --git a/lua/plugins/lspconfig.lua b/lua/plugins/lspconfig.lua index 4a727e3..f73f037 100644 --- a/lua/plugins/lspconfig.lua +++ b/lua/plugins/lspconfig.lua @@ -1,5 +1,6 @@ local lspKeys = function(client, bufnr) - local tele_builtins = require('telescope.builtin') + -- local tele_builtins = require('telescope.builtin') + local fzf = require('fzf-lua') local options = { noremap = true, silent = false, buffer = bufnr } vim.keymap.set('n', ',', vim.diagnostic.goto_prev, vim.tbl_extend('error', options, { desc = 'Diag prev' })) @@ -7,7 +8,7 @@ local lspKeys = function(client, bufnr) vim.tbl_extend('error', options, { desc = 'Diag next' })) vim.keymap.set({ 'n', 'x' }, 'a', vim.lsp.buf.code_action, vim.tbl_extend('error', options, { desc = 'Code action' })) - vim.keymap.set('n', 'd', tele_builtins.lsp_definitions, + vim.keymap.set('n', 'd', function() fzf.lsp_definitions({ jump_to_single_result = true }) end, vim.tbl_extend('error', options, { desc = 'Definition' })) vim.keymap.set('n', 'e', vim.lsp.buf.declaration, vim.tbl_extend('error', options, { desc = 'Declaration' })) @@ -19,21 +20,21 @@ local lspKeys = function(client, bufnr) vim.tbl_extend('error', options, { desc = 'Incoming calls' })) vim.keymap.set('n', 'm', vim.lsp.buf.rename, vim.tbl_extend('error', options, { desc = 'Rename' })) - vim.keymap.set('n', '', tele_builtins.lsp_dynamic_workspace_symbols, + vim.keymap.set('n', '', fzf.lsp_live_workspace_symbols, vim.tbl_extend('error', options, { desc = 'Workspace symbols' })) vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, vim.tbl_extend('error', options, { desc = 'Type definition' })) vim.keymap.set({ 'n', 'i', 'x' }, '', vim.lsp.buf.signature_help, vim.tbl_extend('error', options, { desc = 'Signature help' })) - vim.keymap.set('n', 'r', tele_builtins.lsp_references, + vim.keymap.set('n', 'r', fzf.lsp_references, vim.tbl_extend('error', options, { desc = 'References' })) - vim.keymap.set('n', '', tele_builtins.lsp_document_symbols, - vim.tbl_extend('error', options, { desc = 'References' })) - vim.keymap.set('n', 's', tele_builtins.lsp_dynamic_workspace_symbols, + vim.keymap.set('n', '', fzf.lsp_document_symbols, + vim.tbl_extend('error', options, { desc = 'Document symbols' })) + vim.keymap.set('n', 's', fzf.lsp_live_workspace_symbols, vim.tbl_extend('error', options, { desc = 'Workspace symbols' })) vim.keymap.set('n', 'v', vim.diagnostic.open_float, vim.tbl_extend('error', options, { desc = 'Diagnostics Float' })) - vim.keymap.set('n', 'V', function() tele_builtins.diagnostics({ bufnr = 0 }) end, + vim.keymap.set('n', 'V', fzf.diagnostics_document, vim.tbl_extend('error', options, { desc = 'Diagnostics' })) vim.keymap.set('n', '', 'ClangdSwitchSourceHeader', vim.tbl_extend('error', options, { desc = 'Switch Source/Header' })) diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index 2bf0c21..add92b4 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -13,6 +13,7 @@ return { 'nvim-telescope/telescope-ui-select.nvim', }, cmd = { 'Telescope' }, + enabled = false, keys = { { 'f',