better lsp/telescope config
This commit is contained in:
parent
84bc65982f
commit
a7697c2e87
2 changed files with 33 additions and 13 deletions
|
|
@ -73,8 +73,7 @@ saga_cfg = {
|
|||
virtual_text = false,
|
||||
},
|
||||
}
|
||||
require'lspsaga'.init_lsp_saga(saga_cfg)
|
||||
|
||||
-- require'lspsaga'.init_lsp_saga(saga_cfg)
|
||||
|
||||
local t = function(str)
|
||||
return vim.api.nvim_replace_termcodes(str, true, true, true)
|
||||
|
|
@ -149,7 +148,24 @@ require('lspkind').init({
|
|||
})
|
||||
|
||||
require('telescope').setup {
|
||||
|
||||
defaults = {
|
||||
mappings = {
|
||||
n = {
|
||||
["q"] = require('telescope.actions').close,
|
||||
},
|
||||
},
|
||||
},
|
||||
pickers = {
|
||||
lsp_code_actions = {
|
||||
theme = "ivy",
|
||||
},
|
||||
lsp_range_code_actions = {
|
||||
theme = "ivy",
|
||||
},
|
||||
lsp_references = {
|
||||
theme = "ivy",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
local builtin = require'telescope.builtin'
|
||||
|
|
@ -178,8 +194,10 @@ live_grep_repo = function(conf)
|
|||
end
|
||||
|
||||
git_grep_word = function(conf)
|
||||
local opt = dropdown
|
||||
opt.cwd = vim.fn.systemlist("git rev-parse --show-toplevel")[1]
|
||||
--local opt = dropdown
|
||||
local opt = {
|
||||
cwd = vim.fn.systemlist("git rev-parse --show-toplevel")[1]
|
||||
}
|
||||
for k,v in pairs(conf) do opt[k] = v end
|
||||
builtin.grep_string(opt)
|
||||
end
|
||||
|
|
|
|||
18
.vimrc
18
.vimrc
|
|
@ -211,7 +211,10 @@ Plug 'kyazdani42/nvim-web-devicons' " for file icons
|
|||
"Plug 'kyazdani42/nvim-tree.lua'
|
||||
|
||||
Plug 'ray-x/lsp_signature.nvim'
|
||||
Plug 'glepnir/lspsaga.nvim'
|
||||
|
||||
Plug 'RishabhRD/popfix'
|
||||
Plug 'RishabhRD/nvim-lsputils'
|
||||
|
||||
" Plugins that do specific things
|
||||
"Plug 'Shougo/vimproc.vim'
|
||||
"Plug 'Shougo/vimfiler.vim'
|
||||
|
|
@ -289,17 +292,16 @@ luafile $HOME/.vim/nvim.lua
|
|||
nnoremap <silent> gd <cmd>lua vim.lsp.buf.definition()<CR>
|
||||
nnoremap <silent> gi <cmd>lua vim.lsp.buf.implementation()<CR>
|
||||
nnoremap <silent> gy <cmd>lua vim.lsp.buf.type_definition()<CR>
|
||||
"nnoremap <silent> K <cmd>lua vim.lsp.buf.hover()<CR>
|
||||
nnoremap <silent> K <cmd>lua require('lspsaga.hover').render_hover_doc()<CR>
|
||||
nnoremap <silent> K <cmd>lua vim.lsp.buf.hover()<CR>
|
||||
nnoremap <silent> gK <cmd>lua vim.lsp.buf.signature_help()<CR>
|
||||
nnoremap <silent> gr <cmd>lua vim.lsp.buf.references()<CR>
|
||||
nnoremap <silent>gR <cmd>lua require('lspsaga.rename').rename()<CR>
|
||||
"nnoremap <silent> gr <cmd>lua vim.lsp.buf.references()<CR>
|
||||
nnoremap <silent> gr <cmd>lua require('telescope.builtin').lsp_references({initial_mode = "normal"})<cr>
|
||||
nnoremap <silent> g0 <cmd>lua vim.lsp.buf.document_symbol()<CR>
|
||||
nnoremap <silent> gW <cmd>lua vim.lsp.buf.workspace_symbol()<CR>
|
||||
"nnoremap <silent> gd <cmd>lua vim.lsp.buf.declaration()<CR>
|
||||
"nnoremap <silent> ga <cmd>lua vim.lsp.buf.code_action()<CR>
|
||||
nnoremap <silent>ga <cmd>lua require('lspsaga.codeaction').code_action()<CR>
|
||||
vnoremap <silent>ga :<C-U>lua require('lspsaga.codeaction').range_code_action()<CR>
|
||||
nnoremap <silent> ga <cmd>lua require('telescope.builtin').lsp_code_actions({initial_mode = "normal"})<cr>
|
||||
vnoremap <silent> ga :<C-U>lua require('telescope.builtin').lsp_range_code_actions({initial_mode = "normal"})<cr>
|
||||
nnoremap <silent> ge <cmd>lua vim.lsp.diagnostic.show_line_diagnostics({show_header = false, focusable = false})<CR>
|
||||
|
||||
" Set updatetime for CursorHold
|
||||
|
|
@ -1013,7 +1015,7 @@ nnoremap <silent> <Leader>aa :<C-u>RgRoot!<CR>
|
|||
"nnoremap <C-k> :<C-u>GFiles<CR>
|
||||
nnoremap <C-k> <cmd>lua require('telescope.builtin').git_files()<cr>
|
||||
nnoremap <silent> <Leader>ag <cmd>lua live_grep_repo{ word_match = "-w", only_sort_text = true, search = ''}<cr>
|
||||
nnoremap <silent> <Leader>aw <cmd>lua git_grep_word{ word_match = "-w", only_sort_text = true }<cr>
|
||||
nnoremap <silent> <Leader>aw <cmd>lua git_grep_word{ word_match = "-w", only_sort_text = true, initial_mode = "normal" }<cr>
|
||||
|
||||
" For C++ -- A is a great plugin which allows you to jump from the c file to the
|
||||
" header and vice-versa. Mneumonic here is headerheader.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue