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 4b543a24f2
commit 891212d986
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('Conceal', '', '', '', '')
hi('Conditional', c.blue, '', '', '') hi('Conditional', c.blue, '', '', '')
hi('Constant', c.fg, '', '', '') hi('Constant', c.fg, '', '', '')
hi('Decorator', c.orange, '', '', '')
hi('Define', c.blue, '', '', '') hi('Define', c.blue, '', '', '')
hi('Delimiter', c.white2, '', '', '') hi('Delimiter', c.white2, '', '', '')
hi('Exception', c.blue, '', '', '') hi('Exception', c.blue, '', '', '')
@ -161,8 +162,10 @@ local function highlight_syntax()
hi('Todo', c.yellow, '', '', '') hi('Todo', c.yellow, '', '', '')
hi('Type', c.blue, '', '', '') hi('Type', c.blue, '', '', '')
hi('Typedef', c.blue, '', '', '') hi('Typedef', c.blue, '', '', '')
vim.cmd('hi! link Annotation Decorator')
vim.cmd('hi! link Macro Define') vim.cmd('hi! link Macro Define')
vim.cmd('hi! link PreCondit PreProc') vim.cmd('hi! link PreCondit PreProc')
vim.cmd('hi! link Variable Identifier')
-- Diff -- Diff
hi('DiffAdd' , c.green , c.grey1, '', '') hi('DiffAdd' , c.green , c.grey1, '', '')
@ -182,37 +185,21 @@ end
-- Treesitter -- Treesitter
local function highlight_treesitter() local function highlight_treesitter()
hi('TSAnnotation' , c.orange, '', '', '') -- tree-sitter
hi('TSCharacter' , c.fg , '', '', '') vim.cmd('hi! link TSAnnotation Annotation')
hi('TSConstructor' , c.blue , '', '', '') vim.cmd('hi! link TSConstBuiltin Constant')
hi('TSConstant' , c.fg , '', '', '') vim.cmd('hi! link TSConstructor Function')
hi('TSFloat' , c.purple, '', '', '') vim.cmd('hi! link TSEmphasis Italic')
hi('TSNumber' , c.purple, '', '', '') vim.cmd('hi! link TSError Error')
hi('TSString' , c.green , '', '', '') vim.cmd('hi! link TSFuncBuiltin Function')
hi('TSAttribute' , c.purple, '', '', '') vim.cmd('hi! link TSFuncMacro Function')
hi('TSBoolean' , c.blue , '', '', '') vim.cmd('hi! link TSStringRegex SpecialChar')
hi('TSConstBuiltin', c.teal , '', '', '') vim.cmd('hi! link TSStrong Bold')
hi('TSConstMacro' , c.teal , '', '', '') vim.cmd('hi! link TSStructure Structure')
hi('TSError' , c.fg , c.red, '', '') vim.cmd('hi! link TSTagDelimiter TSTag')
hi('TSException' , c.red , '', 'underline', '') vim.cmd('hi! link TSUnderline Underline')
hi('TSField' , c.fg , '', '', '') vim.cmd('hi! link TSVariable Variable')
hi('TSFuncMacro' , c.cyan , '', '', '') vim.cmd('hi! link TSVariableBuiltin Keyword')
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, '', '', '')
-- ts-rainbow -- ts-rainbow
hi('rainbowcol1', c.red, '', 'bold', '') hi('rainbowcol1', c.red, '', 'bold', '')
@ -300,6 +287,9 @@ local function highlight_plugins()
-- vim-illuminate -- vim-illuminate
vim.cmd('hi! link illuminatedWord Underline') vim.cmd('hi! link illuminatedWord Underline')
-- trouble.nvim
hi('LspTroubleText', c.blue, '', 'bold', '')
-- Telescope -- Telescope
hi('TelescopePromptBorder', c.cyan, '', 'bold', '') hi('TelescopePromptBorder', c.cyan, '', 'bold', '')
hi('TelescopeResultsBorder', c.blue, '', 'bold', '') hi('TelescopeResultsBorder', c.blue, '', 'bold', '')

View File

@ -26,10 +26,10 @@ wk.register({
L = {'$', 'End of the line'}, L = {'$', 'End of the line'},
-- Easier moving between windows -- Easier moving between windows
['<C-h>'] = {'<C-w>h', 'Go to the left window'}, -- ['<C-h>'] = {'<C-w>h', 'Go to the left window'},
['<C-l>'] = {'<C-w>l', 'Go to the right window'}, -- ['<C-l>'] = {'<C-w>l', 'Go to the right window'},
['<C-j>'] = {'<C-w>j', 'Go to the down window'}, -- ['<C-j>'] = {'<C-w>j', 'Go to the down window'},
['<C-k>'] = {'<C-w>k', 'Go to the up window'}, -- ['<C-k>'] = {'<C-w>k', 'Go to the up window'},
-- Copy the whole buffer -- Copy the whole buffer
['<C-a>'] = {'<Cmd>%y+<CR>', 'Copy whole buffer'}, ['<C-a>'] = {'<Cmd>%y+<CR>', 'Copy whole buffer'},
@ -82,7 +82,8 @@ wk.register({
d = 'Go to definition', d = 'Go to definition',
D = 'Go to declaration', D = 'Go to declaration',
i = 'Go to implementation', i = 'Go to implementation',
r = 'Go to references' r = 'Go to references',
R = {'<Cmd>TroubleToggle lsp_references<CR>', 'Reference list'}
}, },
K = {name = 'Hover'}, K = {name = 'Hover'},
z = {name = 'Misc utils'}, z = {name = 'Misc utils'},
@ -152,12 +153,12 @@ wk.register({
a = 'Add workspace folder', a = 'Add workspace folder',
d = 'Type definition', d = 'Type definition',
e = 'Line diagnostics', e = 'Line diagnostics',
l = 'List workspace folders', l = 'Set diagnostics loclist',
n = 'Rename in buffer', n = 'Rename in buffer',
o = 'Format buffer', o = 'Format buffer',
q = 'Set diagnostics loclist',
r = 'Remove workspace folder', r = 'Remove workspace folder',
s = 'Signature help', s = 'Signature help',
w = 'List workspace folders',
f = { f = {
name = 'Telescope', name = 'Telescope',
a = {':Telescope lsp_code_actions<CR>', 'Code actions'}, a = {':Telescope lsp_code_actions<CR>', 'Code actions'},
@ -170,7 +171,12 @@ wk.register({
r = {':Telescope lsp_references<CR>', 'References'}, r = {':Telescope lsp_references<CR>', 'References'},
s = {':Telescope lsp_document_symbols<CR>', 'Buffer symbols'}, s = {':Telescope lsp_document_symbols<CR>', 'Buffer symbols'},
S = {':Telescope lsp_workspace_symbols<CR>', 'Workspace 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 -- 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 { use {
'onsails/lspkind-nvim', 'onsails/lspkind-nvim',
event = 'BufRead', event = 'InsertEnter',
config = function() config = function()
require('lspkind').init({with_text = false}) require('lspkind').init({with_text = false})
end end
} }
use {
'folke/trouble.nvim',
event = 'BufRead',
config = function()
require('modules.lsptrouble')
end
}
use { use {
'hrsh7th/nvim-compe', 'hrsh7th/nvim-compe',
event = 'InsertEnter', event = 'InsertEnter',
@ -306,6 +313,6 @@ return require('packer').startup(
end 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 end
) )