neovim: add trouble.nvim

Also update treesitter highlight groups to be aligned with original
nord.vim
This commit is contained in:
FollieHiyuki 2021-07-15 02:59:31 +03:00
parent ec3540565a
commit 84c528ddb1
No known key found for this signature in database
GPG Key ID: 813CF484F4993419
4 changed files with 61 additions and 41 deletions

View File

@ -137,6 +137,7 @@ local function highlight_syntax()
hi('Conceal', '', '', '', '')
hi('Conditional', c.blue, '', '', '')
hi('Constant', c.fg, '', '', '')
hi('Decorator', c.orange, '', '', '')
hi('Define', c.blue, '', '', '')
hi('Delimiter', c.white2, '', '', '')
hi('Exception', c.blue, '', '', '')
@ -161,8 +162,10 @@ local function highlight_syntax()
hi('Todo', c.yellow, '', '', '')
hi('Type', c.blue, '', '', '')
hi('Typedef', c.blue, '', '', '')
vim.cmd('hi! link Annotation Decorator')
vim.cmd('hi! link Macro Define')
vim.cmd('hi! link PreCondit PreProc')
vim.cmd('hi! link Variable Identifier')
-- Diff
hi('DiffAdd' , c.green , c.grey1, '', '')
@ -182,37 +185,21 @@ end
-- Treesitter
local function highlight_treesitter()
hi('TSAnnotation' , c.orange, '', '', '')
hi('TSCharacter' , c.fg , '', '', '')
hi('TSConstructor' , c.blue , '', '', '')
hi('TSConstant' , c.fg , '', '', '')
hi('TSFloat' , c.purple, '', '', '')
hi('TSNumber' , c.purple, '', '', '')
hi('TSString' , c.green , '', '', '')
hi('TSAttribute' , c.purple, '', '', '')
hi('TSBoolean' , c.blue , '', '', '')
hi('TSConstBuiltin', c.teal , '', '', '')
hi('TSConstMacro' , c.teal , '', '', '')
hi('TSError' , c.fg , c.red, '', '')
hi('TSException' , c.red , '', 'underline', '')
hi('TSField' , c.fg , '', '', '')
hi('TSFuncMacro' , c.cyan , '', '', '')
hi('TSInclude' , c.teal , '', '', '')
hi('TSLabel' , c.blue , '', '', '')
hi('TSNamespace' , c.teal , '', '', '')
hi('TSOperator' , c.blue , '', '', '')
hi('TSParameter' , c.dark_blue, '', '', '')
hi('TSParameterReference', c.dark_blue, '', '', '')
hi('TSProperty' , c.fg , '', '', '')
hi('TSPunctDelimiter', c.white2, '', '', '')
hi('TSPunctBracket', c.white2, '', '', '')
hi('TSPunctSpecial', c.white2 , '', '', '')
hi('TSStringRegex' , c.teal, '', '', '')
hi('TSStringEscape', c.grey2, '', '', '')
hi('TSSymbol' , c.purple, '', '', '')
hi('TSType' , c.blue , '', '', '')
hi('TSTypeBuiltin' , c.blue, '', '', '')
hi('TSTag' , c.teal, '', '', '')
-- tree-sitter
vim.cmd('hi! link TSAnnotation Annotation')
vim.cmd('hi! link TSConstBuiltin Constant')
vim.cmd('hi! link TSConstructor Function')
vim.cmd('hi! link TSEmphasis Italic')
vim.cmd('hi! link TSError Error')
vim.cmd('hi! link TSFuncBuiltin Function')
vim.cmd('hi! link TSFuncMacro Function')
vim.cmd('hi! link TSStringRegex SpecialChar')
vim.cmd('hi! link TSStrong Bold')
vim.cmd('hi! link TSStructure Structure')
vim.cmd('hi! link TSTagDelimiter TSTag')
vim.cmd('hi! link TSUnderline Underline')
vim.cmd('hi! link TSVariable Variable')
vim.cmd('hi! link TSVariableBuiltin Keyword')
-- ts-rainbow
hi('rainbowcol1', c.red, '', 'bold', '')
@ -300,6 +287,9 @@ local function highlight_plugins()
-- vim-illuminate
vim.cmd('hi! link illuminatedWord Underline')
-- trouble.nvim
hi('LspTroubleText', c.blue, '', 'bold', '')
-- Telescope
hi('TelescopePromptBorder', c.cyan, '', 'bold', '')
hi('TelescopeResultsBorder', c.blue, '', 'bold', '')

View File

@ -26,10 +26,10 @@ wk.register({
L = {'$', 'End of the line'},
-- Easier moving between windows
['<C-h>'] = {'<C-w>h', 'Go to the left window'},
['<C-l>'] = {'<C-w>l', 'Go to the right window'},
['<C-j>'] = {'<C-w>j', 'Go to the down window'},
['<C-k>'] = {'<C-w>k', 'Go to the up window'},
-- ['<C-h>'] = {'<C-w>h', 'Go to the left window'},
-- ['<C-l>'] = {'<C-w>l', 'Go to the right window'},
-- ['<C-j>'] = {'<C-w>j', 'Go to the down window'},
-- ['<C-k>'] = {'<C-w>k', 'Go to the up window'},
-- Copy the whole buffer
['<C-a>'] = {'<Cmd>%y+<CR>', 'Copy whole buffer'},
@ -82,7 +82,8 @@ wk.register({
d = 'Go to definition',
D = 'Go to declaration',
i = 'Go to implementation',
r = 'Go to references'
r = 'Go to references',
R = {'<Cmd>TroubleToggle lsp_references<CR>', 'Reference list'}
},
K = {name = 'Hover'},
z = {name = 'Misc utils'},
@ -152,12 +153,12 @@ wk.register({
a = 'Add workspace folder',
d = 'Type definition',
e = 'Line diagnostics',
l = 'List workspace folders',
l = 'Set diagnostics loclist',
n = 'Rename in buffer',
o = 'Format buffer',
q = 'Set diagnostics loclist',
r = 'Remove workspace folder',
s = 'Signature help',
w = 'List workspace folders',
f = {
name = 'Telescope',
a = {':Telescope lsp_code_actions<CR>', 'Code actions'},
@ -170,7 +171,12 @@ wk.register({
r = {':Telescope lsp_references<CR>', 'References'},
s = {':Telescope lsp_document_symbols<CR>', 'Buffer symbols'},
S = {':Telescope lsp_workspace_symbols<CR>', 'Workspace symbols'}
}
},
D = {'<Cmd>TroubleToggle lsp_definitions<CR>', 'Definition list'},
E = {'<Cmd>TroubleToggle lsp_document_diagnostics<CR>', 'Document diagnostics list'},
W = {'<Cmd>TroubleToggle lsp_workspace_diagnostics<CR>', 'Workspace diagnostics list'},
L = {'<Cmd>TroubleToggle loclist<CR>', 'Location list items'},
Q = {'<Cmd>TroubleToggle quickfix<CR>', 'Quickfix list'}
},
-- Git

View File

@ -0,0 +1,17 @@
return require('trouble').setup {
mode = 'lsp_workspace_diagnostics',
fold_open = '',
fold_closed = '',
action_keys = {
open_split = {'<c-h>'},
open_vsplit = {'<c-v>'},
open_tab = {'<c-t>'}
},
signs = {
error = '',
warning = '',
hint = '',
information = '',
other = ''
}
}

View File

@ -128,11 +128,18 @@ return require('packer').startup(
}
use {
'onsails/lspkind-nvim',
event = 'BufRead',
event = 'InsertEnter',
config = function()
require('lspkind').init({with_text = false})
end
}
use {
'folke/trouble.nvim',
event = 'BufRead',
config = function()
require('modules.lsptrouble')
end
}
use {
'hrsh7th/nvim-compe',
event = 'InsertEnter',
@ -306,6 +313,6 @@ return require('packer').startup(
end
}
-- TODO: trouble.nvim, lspsaga, orgmode.nvim, TrueZen/zen-mode, nvim-lint, vim-spectre, nvim-dap, hop.nvim, dial.nvim, asynctasks.nvim
-- TODO: lspsaga, orgmode.nvim, TrueZen/zen-mode, nvim-lint, vim-spectre, nvim-dap, hop.nvim, dial.nvim, asynctasks.nvim
end
)