aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorjdhao <jdhao@hotmail.com>2021-08-07 21:33:00 +0800
committerjdhao <jdhao@hotmail.com>2021-08-07 21:33:00 +0800
commit644e8af39f27aaf00910094a9ed07c628ff8986b (patch)
tree678c1cd5fccabd3cc0665521cf96222fb2eda0f8 /core
parente348ca93b4dc4af3314c44781304f87b5d8f8e40 (diff)
refactor: set all custom highlight in one function
Diffstat (limited to 'core')
-rw-r--r--core/autocommands.vim29
-rw-r--r--core/plugins.vim12
2 files changed, 16 insertions, 25 deletions
diff --git a/core/autocommands.vim b/core/autocommands.vim
index 8e9f8f2..6f25e79 100644
--- a/core/autocommands.vim
+++ b/core/autocommands.vim
@@ -56,24 +56,27 @@ augroup END
" highlight yanked region, see `:h lua-highlight`
augroup custom_highlight
autocmd!
- autocmd ColorScheme * highlight YankColor ctermfg=59 ctermbg=41 guifg=#34495E guibg=#2ECC71
+ autocmd ColorScheme * call s:custom_highlight()
augroup END
-augroup highlight_yank
- autocmd!
- au TextYankPost * silent! lua vim.highlight.on_yank{higroup="YankColor", timeout=300}
-augroup END
+function! s:custom_highlight() abort
+ " For yank highlight
+ highlight YankColor ctermfg=59 ctermbg=41 guifg=#34495E guibg=#2ECC71
-" Highlight groups for cursor color
-augroup cursor_color
- autocmd!
- autocmd ColorScheme * highlight Cursor cterm=bold gui=bold guibg=#00c918 guifg=black
- autocmd ColorScheme * highlight Cursor2 guifg=red guibg=red
-augroup END
+ " For cursor colors
+ highlight Cursor cterm=bold gui=bold guibg=#00c918 guifg=black
+ highlight Cursor2 guifg=red guibg=red
-augroup float_border_color
+ " For floating windows border highlight
+ highlight FloatBorder guifg=LightGreen guibg=NONE
+
+ " highlight for matching parentheses
+ highlight MatchParen cterm=underline gui=underline
+endfunction
+
+augroup highlight_yank
autocmd!
- autocmd ColorScheme * highlight FloatBorder guifg=LightGreen guibg=NONE
+ au TextYankPost * silent! lua vim.highlight.on_yank{higroup="YankColor", timeout=300, on_visual=false}
augroup END
augroup auto_close_win
diff --git a/core/plugins.vim b/core/plugins.vim
index 23fb842..8f901fa 100644
--- a/core/plugins.vim
+++ b/core/plugins.vim
@@ -458,18 +458,6 @@ let g:matchup_delim_noskips = 0
" Show offscreen match pair in popup window
let g:matchup_matchparen_offscreen = {'method': 'popup'}
-" Change highlight color of matching bracket for better visual effects
-augroup matchup_matchparen_highlight
- autocmd!
- autocmd ColorScheme * highlight MatchParen cterm=underline gui=underline
-augroup END
-
-" Show matching keyword as underlined text to reduce color clutter
-augroup matchup_matchword_highlight
- autocmd!
- autocmd ColorScheme * hi MatchWord cterm=underline gui=underline
-augroup END
-
"""""""""""""""""""""""""" asyncrun.vim settings """"""""""""""""""""""""""
" Automatically open quickfix window of 6 line tall after asyncrun starts
let g:asyncrun_open = 6