Ver Fonte

nixpkgs/neovim: switch to telescope for go to lsp*

Thomas Dy há 10 meses atrás
pai
commit
49abd34b34

+ 1 - 1
.config/nixpkgs/neovim/lsp.lua

@@ -79,8 +79,8 @@ else
         local opts = { silent = true, buffer = bufnr }
         -- exclude import statements from reference search (may have false positives)
         vim.keymap.set('n', 'gr', '<cmd>Telescope lsp_references default_text=!import\\ <CR>', opts)
+        vim.keymap.set('n', 'gD', '<cmd>Telescope lsp_definitions<CR>', opts)
         vim.keymap.set('n', 'gd', '<cmd>TypescriptGoToSourceDefinition<CR>', opts)
-        vim.keymap.set('n', 'gD', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
       end
     }
   })

+ 5 - 4
.config/nixpkgs/neovim/mappings.lua

@@ -82,15 +82,16 @@ function on_attach(client, bufnr)
 
   -- LSP-specific mappings
   vim.keymap.set('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts)
-  vim.keymap.set('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
+  vim.keymap.set('n', 'gd', '<cmd>Telescope lsp_definitions<CR>', opts)
   vim.keymap.set('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
-  vim.keymap.set('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
+  vim.keymap.set('n', 'gi', '<cmd>Telescope lsp_implementations<CR>', opts)
   vim.keymap.set({'n', 'i'}, '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
-  vim.keymap.set('n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
+  vim.keymap.set('n', '<space>D', '<cmd>Telescope lsp_type_definitions<CR>', opts)
   vim.keymap.set('n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
   vim.keymap.set('n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
-  vim.keymap.set('v', '<space>ca', '<cmd>lua vim.lsp.buf.range_code_action()<CR><ESC>', opts)
+  vim.keymap.set('v', '<space>ca', '<cmd>lua vim.lsp.buf.range_code_action()<CR>', opts)
   vim.keymap.set('n', 'gr', '<cmd>Telescope lsp_references<CR>', opts)
   vim.keymap.set('n', '<Leader>fs', '<cmd>Telescope lsp_document_symbols<CR>', opts)
   vim.keymap.set('n', '<Leader>fr', '<cmd>Telescope resume<CR>', opts)
+  vim.keymap.set('n', '<Leader>fp', '<cmd>Telescope pickers<CR>', opts)
 end

+ 5 - 0
.config/nixpkgs/neovim/plugins.lua

@@ -39,6 +39,11 @@ require('telescope').setup({
       "%.yarn/releases/",
       "%.yarn/plugins/"
     },
+
+    -- picker history
+    cache_picker = {
+      num_pickers = 10,
+    },
   },
   pickers = {
     buffers = {