aboutsummaryrefslogtreecommitdiff
path: root/core/autocommands.vim
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/autocommands.vim
parente348ca93b4dc4af3314c44781304f87b5d8f8e40 (diff)
refactor: set all custom highlight in one function
Diffstat (limited to 'core/autocommands.vim')
-rw-r--r--core/autocommands.vim29
1 files changed, 16 insertions, 13 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