Update lsp and git integration

This commit is contained in:
juan 2022-05-03 14:36:01 +08:00
parent 88e753ee4c
commit 42489a70f2
Signed by: juan
GPG Key ID: 5C1E5093C74F1DC7
4 changed files with 52 additions and 15 deletions

View File

@ -28,6 +28,12 @@ vim.api.nvim_set_keymap('', '<leader>gs', ':Gitsigns toggle_signs<cr>',
-- lsp stuff -- lsp stuff
vim.api.nvim_buf_set_keymap(0, 'n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', vim.api.nvim_buf_set_keymap(0, 'n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>',
{noremap = true}) {noremap = true})
vim.api.nvim_set_keymap('', '<leader>K',
'<cmd>lua vim.diagnostic.open_float()<CR>',
{noremap = true})
vim.api.nvim_set_keymap('', '<leader>qf',
'<cmd>lua vim.diagnostic.setqflist({open = false})<cr><cmd>Telescope quickfix<cr>',
{silent = true})
-- toggle tagbar -- toggle tagbar
vim.api.nvim_set_keymap('', '<leader>tt', ':TagbarToggle<cr>', {silent = true}) vim.api.nvim_set_keymap('', '<leader>tt', ':TagbarToggle<cr>', {silent = true})
-- toggle NvimTree -- toggle NvimTree
@ -42,14 +48,6 @@ vim.api.nvim_set_keymap('', '<leader>w', ':HopWordAC<cr>', {silent = true})
vim.api.nvim_set_keymap('', '<leader>l', ':HopWordCurrentLine<cr>', vim.api.nvim_set_keymap('', '<leader>l', ':HopWordCurrentLine<cr>',
{silent = true}) {silent = true})
-- telescope stuff -- telescope stuff
vim.api.nvim_set_keymap('', '<leader>tf', ':Telescope fd<cr>', {silent = true}) vim.api.nvim_set_keymap('', '<leader>fd', ':Telescope fd<cr>', {silent = true})
vim.api.nvim_set_keymap('', '<leader>tb', ':Telescope buffers<cr>', vim.api.nvim_set_keymap('', '<leader>tb', ':Telescope buffers<cr>',
{silent = true}) {silent = true})
vim.api.nvim_set_keymap('', '<leader>tq', ':Telescope quickfix<cr>',
{silent = true})
vim.api.nvim_set_keymap('', '<leader>tdd',
':Telescope lsp_document_diagnostics<cr>',
{silent = true})
vim.api.nvim_set_keymap('', '<leader>tdw',
':Telescope lsp_workspace_diagnostics<cr>',
{silent = true})

View File

@ -25,6 +25,7 @@ return require('packer').startup(function(use)
after = 'packer.nvim', after = 'packer.nvim',
config = function() config = function()
vim.g.serenade_enable_italic = 1 vim.g.serenade_enable_italic = 1
vim.g.serenade_sign_column_background = 'none'
vim.g.serenade_better_performance = 1 vim.g.serenade_better_performance = 1
vim.cmd("colorscheme serenade") vim.cmd("colorscheme serenade")
end end
@ -113,6 +114,7 @@ return require('packer').startup(function(use)
use { use {
'nvim-telescope/telescope.nvim', 'nvim-telescope/telescope.nvim',
requires = {{'nvim-lua/plenary.nvim'}}, requires = {{'nvim-lua/plenary.nvim'}},
config = function() require "plugins.telescope" end,
cmd = 'Telescope' cmd = 'Telescope'
} }
use {'preservim/tagbar', cmd = 'TagbarToggle'} use {'preservim/tagbar', cmd = 'TagbarToggle'}

View File

@ -17,12 +17,14 @@ require('gitsigns').setup {
["n <leader>hp"] = '<cmd>lua require"gitsigns".preview_hunk()<CR>', ["n <leader>hp"] = '<cmd>lua require"gitsigns".preview_hunk()<CR>',
["n <leader>hb"] = '<cmd>lua require"gitsigns".blame_line()<CR>' ["n <leader>hb"] = '<cmd>lua require"gitsigns".blame_line()<CR>'
}, },
numhl = false,
sign_priority = 5, -- signs
status_formatter = nil, -- Use default
numhl = false,
sign_priority = 10,
signs = { signs = {
add = {hl = "DiffAdd", text = "", numhl = "GitSignsAddNr"}, add = {hl = "DiffAdd", text = "+", numhl = "GitSignsAddNr"},
change = {hl = "DiffChange", text = "", numhl = "GitSignsChangeNr"}, change = {hl = "DiffChange", text = ">", numhl = "GitSignsChangeNr"},
changedelete = { changedelete = {
hl = "DiffChange", hl = "DiffChange",
text = "~", text = "~",
@ -35,7 +37,15 @@ require('gitsigns').setup {
numhl = "GitSignsDeleteNr" numhl = "GitSignsDeleteNr"
} }
}, },
yadm = {enable = true},
status_formatter = nil, -- Use default -- Current line blame
watch_gitdir = {interval = 100} current_line_blame = true, -- Toggle with `:Gitsigns toggle_current_line_blame`
current_line_blame_opts = {
virt_text = true,
virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align'
delay = 250,
ignore_whitespace = false
},
current_line_blame_formatter = '<author>, <author_time:%Y-%m-%d> - <summary>'
} }

27
lua/plugins/telescope.lua Normal file
View File

@ -0,0 +1,27 @@
require('telescope').setup {
defaults = {
-- Default configuration for telescope goes here:
-- config_key = value,
-- ..
layout_strategy = 'vertical',
layout_config = {height = 0.95}
},
pickers = {
-- Default configuration for builtin pickers goes here:
-- picker_name = {
-- picker_config_key = value,
-- ...
-- }
-- Now the picker_config_key will be applied every time you call this
-- builtin picker
},
extensions = {
-- Your extension configuration goes here:
-- extension_name = {
-- extension_config_key = value,
-- }
-- please take a look at the readme of the extension you want to configure
}
}