nvim: added preview for lsp

master
tiyn 10 months ago
parent 591c548d6b
commit fd28f92833

@ -1,4 +1,5 @@
{ {
"action-hints.nvim": { "branch": "main", "commit": "ab10fef255dd4bc933c92d8f9969828f2f856e71" },
"aerial.nvim": { "branch": "master", "commit": "31fbd369bbbeb53080c4b1ead9e76be322725ef5" }, "aerial.nvim": { "branch": "master", "commit": "31fbd369bbbeb53080c4b1ead9e76be322725ef5" },
"barbecue": { "branch": "main", "commit": "cd7e7da622d68136e13721865b4d919efd6325ed" }, "barbecue": { "branch": "main", "commit": "cd7e7da622d68136e13721865b4d919efd6325ed" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
@ -13,6 +14,7 @@
"fzy-lua-native": { "branch": "master", "commit": "820f745b7c442176bcc243e8f38ef4b985febfaf" }, "fzy-lua-native": { "branch": "master", "commit": "820f745b7c442176bcc243e8f38ef4b985febfaf" },
"git-blame.nvim": { "branch": "master", "commit": "a0282d05adbee80aaf4e2ff35b81b52940b67bed" }, "git-blame.nvim": { "branch": "master", "commit": "a0282d05adbee80aaf4e2ff35b81b52940b67bed" },
"gitsigns.nvim": { "branch": "main", "commit": "2c2463dbd82eddd7dbab881c3a62cfbfbe3c67ae" }, "gitsigns.nvim": { "branch": "main", "commit": "2c2463dbd82eddd7dbab881c3a62cfbfbe3c67ae" },
"goto-preview": { "branch": "main", "commit": "527fd81a827234e26ca47891abe90497215db2a6" },
"indent-blankline.nvim": { "branch": "master", "commit": "821a7acd88587d966f7e464b0b3031dfe7f5680c" }, "indent-blankline.nvim": { "branch": "master", "commit": "821a7acd88587d966f7e464b0b3031dfe7f5680c" },
"knap": { "branch": "main", "commit": "d4ea571d2d4e139d288b758c5bab31788d30eea3" }, "knap": { "branch": "main", "commit": "d4ea571d2d4e139d288b758c5bab31788d30eea3" },
"lazy.nvim": { "branch": "main", "commit": "83493db50a434a4c5c648faf41e2ead80f96e478" }, "lazy.nvim": { "branch": "main", "commit": "83493db50a434a4c5c648faf41e2ead80f96e478" },

@ -12,6 +12,7 @@ local m = require 'mapx'.setup { global = true, whichkey = true }
-- setup keymap groups -- setup keymap groups
m.nname("g", "LSP: goto") m.nname("g", "LSP: goto")
m.nname("gp", "LSP: preview")
m.cname("w", "Write") m.cname("w", "Write")
m.cname("w!", "Write: overwrite") m.cname("w!", "Write: overwrite")
m.nname("<leader>g", "Git") m.nname("<leader>g", "Git")
@ -89,11 +90,19 @@ m.nmap("<leader>x", ":TroubleToggle<CR>", "LSP: toggle error list")
m.nnoremap("gd", vim.lsp.buf.definition(), "LSP: goto definition") m.nnoremap("gd", vim.lsp.buf.definition(), "LSP: goto definition")
m.nnoremap("gD", vim.lsp.buf.declaration(), "LSP: goto declaration") m.nnoremap("gD", vim.lsp.buf.declaration(), "LSP: goto declaration")
m.nnoremap("gi", vim.lsp.buf.implementation(), "LSP: list implementation") m.nnoremap("gi", vim.lsp.buf.implementation(), "LSP: list implementation")
m.nnoremap("gr", vim.lsp.buf.references(), "LSP: list references") m.nnoremap("gr", function() vim.lsp.buf.references() end, "LSP: list references")
m.nnoremap("gy", vim.lsp.buf.type_definition(), "LSP: goto type definition") m.nnoremap("gy", vim.lsp.buf.type_definition(), "LSP: goto type definition")
m.nnoremap("K", vim.lsp.buf.hover(), "LSP: show documentation") m.nnoremap("K", vim.lsp.buf.hover(), "LSP: show documentation")
m.nnoremap("<F8>", function() require("conform").format({ async = true, lsp_fallback = true }) end, "LSP: format") m.nnoremap("<F8>", function() require("conform").format({ async = true, lsp_fallback = true }) end, "LSP: format")
-- rmagatti/goto-preview
m.nnoremap("gpd", function() require('goto-preview').goto_preview_definition() end, "LSP: preview definition")
m.nnoremap("gpy", function() require('goto-preview').goto_preview_type_definition() end, "LSP: preview type definition")
m.nnoremap("gpi", function() require('goto-preview').goto_preview_implementation() end, "LSP: list preview implementation")
m.nnoremap("gpD", function() require('goto-preview').goto_preview_declaration() end, "LSP: preview declaration")
m.nnoremap("gpr", function() require('goto-preview').goto_preview_references() end, "LSP: list preview references")
m.nnoremap("gpc", function() require('goto-preview').close_all_win() end, "LSP: close all preview windows")
-- filipdutescu/renamer.nvim -- filipdutescu/renamer.nvim
m.nnoremap("<F5>", function() require("renamer").rename() end, "LSP: rename") m.nnoremap("<F5>", function() require("renamer").rename() end, "LSP: rename")

@ -0,0 +1,6 @@
return {
"rmagatti/goto-preview",
config = function()
require("goto-preview").setup({})
end,
}

@ -1,53 +1,65 @@
return { return {
-- statusline -- statusline
{ {
'nvim-lualine/lualine.nvim', "nvim-lualine/lualine.nvim",
dependencies = { dependencies = {
{ {
'nvim-tree/nvim-web-devicons', "nvim-tree/nvim-web-devicons",
lazy = true lazy = true,
}, },
{ {
'f-person/git-blame.nvim', "f-person/git-blame.nvim",
config = function() config = function()
vim.g.gitblame_display_virtual_text = 0 vim.g.gitblame_display_virtual_text = 0
end end,
},
{ "tiyn/tccs.nvim" },
{
"roobert/action-hints.nvim",
config = function()
require("action-hints").setup({
template = {
definition = { text = "D", color = "#add8e6" },
references = { text = "R%s", color = "#ff6666" },
},
})
end,
}, },
{ 'tiyn/tccs.nvim' },
}, },
config = function() config = function()
require('lualine').setup({ require("lualine").setup({
options = { options = {
globalstatus = true, globalstatus = true,
symbols = { symbols = {
error = Error_sign, error = Error_sign,
warn = Warn_sign, warn = Warn_sign,
hint = Hint_sign, hint = Hint_sign,
info = Info_sign info = Info_sign,
}, },
theme = 'tccs', theme = "tccs",
component_separators = { left = '', right = '' }, component_separators = { left = "", right = "" },
section_separators = { left = '', right = '' } section_separators = { left = "", right = "" },
}, },
sections = { sections = {
lualine_b = { lualine_b = {
{ {
require('gitblame').get_current_blame_text, require("gitblame").get_current_blame_text,
cond = require('gitblame').is_blame_text_available cond = require("gitblame").is_blame_text_available,
} },
}, },
lualine_c = {}, lualine_c = {},
lualine_x = { lualine_x = {
'encoding', require("action-hints").statusline,
'fileformat', "encoding",
"fileformat",
{ {
'filetype', "filetype",
icon_only = true icon_only = true,
} },
}, },
lualine_y = { lualine_y = {
{ {
'filename', "filename",
file_status = true, file_status = true,
newfile_status = true, newfile_status = true,
path = 1, path = 1,
@ -57,12 +69,12 @@ return {
readonly = Lualine_signs["readonly"], readonly = Lualine_signs["readonly"],
unnamed = Lualine_signs["unnamed"], unnamed = Lualine_signs["unnamed"],
newfile = Lualine_signs["newfile"], newfile = Lualine_signs["newfile"],
} },
} },
}, },
lualine_z = { 'progress', 'location' }, lualine_z = { "progress", "location" },
} },
}) })
end end,
} },
} }

Loading…
Cancel
Save