mirror of
https://git.disroot.org/FollieHiyuki/dotfiles.git
synced 2024-11-28 10:18:25 -05:00
neovim: update multiple
- nvim-ts-rainbow: move config into 'nvim-treesitter.configs' block - bufferline.nvim: update lsp diagnostic display, highlight - gitsigns.nvim: add highlight for line blame info - nvim-autopairs: update new config - highlight: no more lazy loading (only 1-2ms faster, and caused some glitched highlights at startup due to treesitter group) - chore: theme.util -> util
This commit is contained in:
parent
265c64ae4a
commit
133dd68322
@ -144,11 +144,43 @@ end
|
|||||||
-- end
|
-- end
|
||||||
|
|
||||||
function M.autopairs_conf()
|
function M.autopairs_conf()
|
||||||
require('nvim-autopairs').setup {fast_wrap = {}}
|
require('nvim-autopairs').setup {
|
||||||
|
disable_filetype = {'TelescopePrompt', 'spectre_panel'},
|
||||||
|
disable_in_macro = false, -- disable when recording or executing a macro
|
||||||
|
ignored_next_char = string.gsub([[ [%w%%%'%[%"%.] ]], '%s+', ''),
|
||||||
|
enable_moveright = true,
|
||||||
|
enable_afterquote = true, -- add bracket pairs after quote
|
||||||
|
enable_check_bracket_line = true, -- check bracket in same line
|
||||||
|
check_ts = true, -- use treesitter
|
||||||
|
ts_config = {
|
||||||
|
lua = {'string', 'source'},
|
||||||
|
javascript = {'string', 'template_string'}
|
||||||
|
},
|
||||||
|
map_bs = true, -- map the <BS> key
|
||||||
|
map_c_w = true, -- map <C-w> to delete an pair if possible
|
||||||
|
map_cr = false, -- use mapping <CR> for nvim-cmp below instead
|
||||||
|
fast_wrap = {
|
||||||
|
map = '<A-e>',
|
||||||
|
chars = { '{', '[', '(', '"', "'" },
|
||||||
|
pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], '%s+', ''),
|
||||||
|
offset = 0, -- Offset from pattern match
|
||||||
|
end_key = '$',
|
||||||
|
keys = 'qwertyuiopzxcvbnmasdfghjkl',
|
||||||
|
check_comma = true,
|
||||||
|
highlight = 'Search',
|
||||||
|
highlight_grey = 'Comment'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
require('nvim-autopairs.completion.cmp').setup {
|
require('nvim-autopairs.completion.cmp').setup {
|
||||||
map_cr = true, -- map <CR> on insert mode
|
map_cr = true, -- map <CR> on insert mode
|
||||||
map_complete = true, -- it will auto insert `(` after select function or method item
|
map_complete = true, -- it will auto insert `(` after select function or method item
|
||||||
auto_select = true -- automatically select the first item
|
auto_select = true, -- automatically select the first item
|
||||||
|
insert = false, -- use insert confirm behavior instead of replace
|
||||||
|
map_char = { -- modifies the function or method delimiter by filetypes
|
||||||
|
all = '(',
|
||||||
|
tex = '{'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@ function M.blankline_conf()
|
|||||||
},
|
},
|
||||||
buftype_exclude = {'terminal', 'nofile'},
|
buftype_exclude = {'terminal', 'nofile'},
|
||||||
show_trailing_blankline_indent = false,
|
show_trailing_blankline_indent = false,
|
||||||
|
-- show_end_of_line = true,
|
||||||
show_current_context = true,
|
show_current_context = true,
|
||||||
context_patterns = {
|
context_patterns = {
|
||||||
'class', 'function', 'method', 'block', 'list_literal', 'selector', '^if',
|
'class', 'function', 'method', 'block', 'list_literal', 'selector', '^if',
|
||||||
@ -108,6 +109,11 @@ function M.treesitter_conf()
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
matchup = {enable = true},
|
matchup = {enable = true},
|
||||||
|
rainbow = {
|
||||||
|
enable = true,
|
||||||
|
extended_mode = true,
|
||||||
|
max_file_lines = 1000
|
||||||
|
},
|
||||||
playground = {
|
playground = {
|
||||||
enable = true,
|
enable = true,
|
||||||
disable = {},
|
disable = {},
|
||||||
@ -166,16 +172,6 @@ function M.iswap_conf()
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.rainbow_conf()
|
|
||||||
require('nvim-treesitter.configs').setup {
|
|
||||||
rainbow = {
|
|
||||||
enable = true,
|
|
||||||
extended_mode = true,
|
|
||||||
max_file_lines = 1000
|
|
||||||
}
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
function M.matchup_conf()
|
function M.matchup_conf()
|
||||||
vim.g.matchup_matchparen_offscreen = {method = 'popup'}
|
vim.g.matchup_matchparen_offscreen = {method = 'popup'}
|
||||||
end
|
end
|
||||||
|
@ -326,6 +326,15 @@ function M.bufferline_conf()
|
|||||||
max_prefix_length = 14,
|
max_prefix_length = 14,
|
||||||
tab_size = 20,
|
tab_size = 20,
|
||||||
diagnostics = 'nvim_lsp',
|
diagnostics = 'nvim_lsp',
|
||||||
|
diagnostics_update_in_insert = false,
|
||||||
|
diagnostics_indicator = function(count, level, diagnostics_dict, context)
|
||||||
|
local s = ' '
|
||||||
|
for e, n in pairs(diagnostics_dict) do
|
||||||
|
local sym = e == 'error' and 'x ' or (e == 'warning' and '! ' or (e == 'info' and 'i ' or '? '))
|
||||||
|
s = s .. n .. sym
|
||||||
|
end
|
||||||
|
return s
|
||||||
|
end,
|
||||||
show_close_icon = false,
|
show_close_icon = false,
|
||||||
show_buffer_icons = true,
|
show_buffer_icons = true,
|
||||||
show_tab_indicators = true,
|
show_tab_indicators = true,
|
||||||
@ -340,7 +349,14 @@ function M.bufferline_conf()
|
|||||||
},
|
},
|
||||||
highlights = {
|
highlights = {
|
||||||
fill = {guibg = {attribute = 'bg', highlight = 'TabLineFill'}},
|
fill = {guibg = {attribute = 'bg', highlight = 'TabLineFill'}},
|
||||||
indicator_selected = {guifg = {attribute = 'fg', highlight = 'TabLineSel'}}
|
indicator_selected = {guifg = {attribute = 'fg', highlight = 'TabLineSel'}},
|
||||||
|
diagnostic_selected = {guifg = {attribute = 'fg', highlight = 'LspDiagnosticsSignHint', gui = 'bold,italic'}},
|
||||||
|
info_diagnostic_selected = {guifg = {attribute = 'fg', highlight = 'LspDiagnosticsSignInformation', gui = 'bold,italic'}},
|
||||||
|
info_selected = {guifg = {attribute = 'fg', highlight = 'LspDiagnosticsDefaultInformation', gui = 'bold,italic'}},
|
||||||
|
warning_diagnostic_selected = {guifg = {attribute = 'fg', highlight = 'LspDiagnosticsSignWarning', gui = 'bold,italic'}},
|
||||||
|
warning_selected = {guifg = {attribute = 'fg', highlight = 'LspDiagnosticsDefaultWarning', gui = 'bold,italic'}},
|
||||||
|
error_diagnostic_selected = {guifg = {attribute = 'fg', highlight = 'LspDiagnosticsSignError', gui = 'bold,italic'}},
|
||||||
|
error_selected = {guifg = {attribute = 'fg', highlight = 'LspDiagnosticsDefaultError', gui = 'bold,italic'}}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
@ -477,11 +493,12 @@ function M.gitsigns_conf()
|
|||||||
interval = 1000,
|
interval = 1000,
|
||||||
follow_files = true
|
follow_files = true
|
||||||
},
|
},
|
||||||
|
attach_to_untracked = true,
|
||||||
current_line_blame = false,
|
current_line_blame = false,
|
||||||
current_line_blame_opts = {
|
current_line_blame_opts = {
|
||||||
delay = 1000,
|
delay = 1000,
|
||||||
virt_text = true,
|
virt_text = true,
|
||||||
virt_text_pos = 'eol'
|
virt_text_pos = 'right_align'
|
||||||
},
|
},
|
||||||
current_line_blame_formatter_opts = {
|
current_line_blame_formatter_opts = {
|
||||||
relative_time = false
|
relative_time = false
|
||||||
@ -502,6 +519,7 @@ function M.gitsigns_conf()
|
|||||||
enable = false
|
enable = false
|
||||||
},
|
},
|
||||||
diff_opts = {
|
diff_opts = {
|
||||||
|
algorithm = 'myers', -- others: 'minimal', 'patience', 'histogram'
|
||||||
internal = true -- If luajit is present
|
internal = true -- If luajit is present
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -75,6 +75,7 @@ return packer.startup(function(use)
|
|||||||
event = 'BufRead',
|
event = 'BufRead',
|
||||||
config = editor.treesitter_conf
|
config = editor.treesitter_conf
|
||||||
}
|
}
|
||||||
|
use {'p00f/nvim-ts-rainbow', after = 'nvim-treesitter'}
|
||||||
use {'nvim-treesitter/playground', after = 'nvim-treesitter'}
|
use {'nvim-treesitter/playground', after = 'nvim-treesitter'}
|
||||||
use {'romgrk/nvim-treesitter-context', after = 'nvim-treesitter'}
|
use {'romgrk/nvim-treesitter-context', after = 'nvim-treesitter'}
|
||||||
use {'nvim-treesitter/nvim-treesitter-textobjects', after = 'nvim-treesitter'}
|
use {'nvim-treesitter/nvim-treesitter-textobjects', after = 'nvim-treesitter'}
|
||||||
@ -83,12 +84,6 @@ return packer.startup(function(use)
|
|||||||
after = 'nvim-treesitter',
|
after = 'nvim-treesitter',
|
||||||
config = editor.blankline_conf
|
config = editor.blankline_conf
|
||||||
}
|
}
|
||||||
use {
|
|
||||||
'p00f/nvim-ts-rainbow',
|
|
||||||
after = 'nvim-treesitter',
|
|
||||||
-- Putting config into `treesitter_conf` doesn't work for some reason
|
|
||||||
config = editor.rainbow_conf
|
|
||||||
}
|
|
||||||
use {
|
use {
|
||||||
'mizlan/iswap.nvim',
|
'mizlan/iswap.nvim',
|
||||||
cmd = {'ISwapWith', 'ISwap'},
|
cmd = {'ISwapWith', 'ISwap'},
|
||||||
|
@ -11,19 +11,13 @@ function M.set(theme)
|
|||||||
vim.g.colors_name = theme
|
vim.g.colors_name = theme
|
||||||
|
|
||||||
-- Load highlight groups
|
-- Load highlight groups
|
||||||
local async
|
t.highlight_editor()
|
||||||
async = vim.loop.new_async(vim.schedule_wrap(function()
|
t.highlight_syntax()
|
||||||
t.set_vim_termcolors()
|
t.set_vim_termcolors()
|
||||||
t.highlight_plugins()
|
t.highlight_plugins()
|
||||||
t.highlight_languages()
|
t.highlight_languages()
|
||||||
t.highlight_treesitter()
|
t.highlight_treesitter()
|
||||||
t.highlight_lsp()
|
t.highlight_lsp()
|
||||||
async:close()
|
|
||||||
end))
|
|
||||||
|
|
||||||
t.highlight_editor()
|
|
||||||
t.highlight_syntax()
|
|
||||||
async:send() -- Load the rest later
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
@ -2,7 +2,7 @@ local cmd = vim.api.nvim_command
|
|||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
local c = require('themes.nord.colors')
|
local c = require('themes.nord.colors')
|
||||||
local hi = require('themes.util').highlight
|
local hi = require('util').highlight
|
||||||
|
|
||||||
-- Set terminal colors
|
-- Set terminal colors
|
||||||
function M.set_vim_termcolors()
|
function M.set_vim_termcolors()
|
||||||
@ -286,24 +286,6 @@ function M.highlight_lsp()
|
|||||||
hi('LspReferenceRead', c.fg, c.grey_bright, '', '')
|
hi('LspReferenceRead', c.fg, c.grey_bright, '', '')
|
||||||
hi('LspReferenceWrite', c.fg, c.grey_bright, '', '')
|
hi('LspReferenceWrite', c.fg, c.grey_bright, '', '')
|
||||||
cmd('hi! link LspCodeLens Comment')
|
cmd('hi! link LspCodeLens Comment')
|
||||||
|
|
||||||
-- Theses are for neovim 0.6
|
|
||||||
-- cmd('hi! link DiagnosticVirtualTextWarn LspDiagnosticsVirtualTextWarning')
|
|
||||||
-- cmd('hi! link DiagnosticUnderlineWarn LspDiagnosticsUnderlineWarning')
|
|
||||||
-- cmd('hi! link DiagnosticFloatingWarn LspDiagnosticsFloatingWarning')
|
|
||||||
-- cmd('hi! link DiagnosticSignWarn LspDiagnosticsSignWarning')
|
|
||||||
-- cmd('hi! link DiagnosticVirtualTextError LspDiagnosticsVirtualTextError')
|
|
||||||
-- cmd('hi! link DiagnosticUnderlineError LspDiagnosticsUnderlineError')
|
|
||||||
-- cmd('hi! link DiagnosticFloatingError LspDiagnosticsFloatingError')
|
|
||||||
-- cmd('hi! link DiagnosticSignError LspDiagnosticsSignError')
|
|
||||||
-- cmd('hi! link DiagnosticVirtualTextInfo LspDiagnosticsVirtualTextInformation')
|
|
||||||
-- cmd('hi! link DiagnosticUnderlineInfo LspDiagnosticsUnderlineInformation')
|
|
||||||
-- cmd('hi! link DiagnosticFloatingInfo LspDiagnosticsFloatingInformation')
|
|
||||||
-- cmd('hi! link DiagnosticSignInfo LspDiagnosticsSignInformation')
|
|
||||||
-- cmd('hi! link DiagnosticVirtualTextHint LspDiagnosticsVirtualTextHint')
|
|
||||||
-- cmd('hi! link DiagnosticUnderlineHint LspDiagnosticsUnderlineHint')
|
|
||||||
-- cmd('hi! link DiagnosticFloatingHint LspDiagnosticsFloatingHint')
|
|
||||||
-- cmd('hi! link DiagnosticSignHint LspDiagnosticsSignHint')
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Specify groups for plugins
|
-- Specify groups for plugins
|
||||||
@ -319,6 +301,7 @@ function M.highlight_plugins()
|
|||||||
hi('GitSignsAddNr' , c.green , '', '', '')
|
hi('GitSignsAddNr' , c.green , '', '', '')
|
||||||
hi('GitSignsChangeNr', c.yellow, '', '', '')
|
hi('GitSignsChangeNr', c.yellow, '', '', '')
|
||||||
hi('GitSignsDeleteNr', c.red , '', '', '')
|
hi('GitSignsDeleteNr', c.red , '', '', '')
|
||||||
|
hi('GitSignsCurrentLineBlame', c.grey_bright, '', 'italic,bold', '')
|
||||||
|
|
||||||
-- ts-rainbow
|
-- ts-rainbow
|
||||||
hi('rainbowcol1', c.red, '', 'bold', '')
|
hi('rainbowcol1', c.red, '', 'bold', '')
|
||||||
@ -371,7 +354,7 @@ function M.highlight_plugins()
|
|||||||
|
|
||||||
-- Indent Blankline
|
-- Indent Blankline
|
||||||
hi('IndentBlanklineChar', c.grey1, '', '', '')
|
hi('IndentBlanklineChar', c.grey1, '', '', '')
|
||||||
hi('IndentBlanklineContextChar', c.grey1, '', '', '')
|
hi('IndentBlanklineContextChar', c.grey_bright, '', '', '')
|
||||||
|
|
||||||
-- window-picker.nvim
|
-- window-picker.nvim
|
||||||
hi('WindowPicker', c.fg, c.blue, 'bold', '')
|
hi('WindowPicker', c.fg, c.blue, 'bold', '')
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
local c = require('themes.onedark.colors')
|
local c = require('themes.onedark.colors')
|
||||||
local hi = require('themes.util').highlight
|
local hi = require('util').highlight
|
||||||
|
|
||||||
function M.highlight_editor()
|
function M.highlight_editor()
|
||||||
hi('ModeMsg', c.fg, '', '', '')
|
hi('ModeMsg', c.fg, '', '', '')
|
||||||
|
Loading…
Reference in New Issue
Block a user