From 7a98c89f22253177d9f5a0f83c9dbaa297eb54b0 Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Mon, 8 Jul 2024 23:24:22 +0800 Subject: Update --- vim/init/basic.vim | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) (limited to 'vim/init/basic.vim') diff --git a/vim/init/basic.vim b/vim/init/basic.vim index b268c6b..e18423d 100644 --- a/vim/init/basic.vim +++ b/vim/init/basic.vim @@ -120,12 +120,7 @@ endfunction nnoremap :call Bye() " }}} - -" Don't unload a buffer when no longer shown in a window -" This allows you open a new buffer and leaves current buffer modified -set hidden - -" ":augroup vimStartup | au! | augroup END" +" Go to last cursor position ----------------{{{ augroup vimStartup au! " When editing a file, always jump to the last known cursor position. @@ -138,6 +133,7 @@ augroup vimStartup \ | endif augroup END +" }}} " }}} " TABSIZE ----------------{{{ @@ -178,6 +174,32 @@ set backupdir=~/.vim/tmp " backup when write file set writebackup " }}} +" HIGHLIGHT ----------------{{{ +syntax enable + +function! GetHighlightGroupName() + let l:syntaxID = synID(line('.'), col('.'), 1) + let l:groupName = synIDattr(l:syntaxID, 'name') + echo "Highlight Group Name: " . l:groupName +endfunction + +" Defualt highlight for matched parenthesis is so weird in many colorscheme +" Why the background color is lighter than my caret !? +" highlight MatchParen ctermfg=NONE ctermbg=darkgrey cterm=NONE +highlight LuaParen ctermfg=NONE ctermbg=darkgrey cterm=NONE + +" Show trailing spaces +highlight ExtraWhitespace ctermbg=red guibg=red +match ExtraWhitespace /\s\+$/ + +" Persist visualized lines +" define line highlight color +highlight MultiLineHighlight ctermbg=LightYellow guibg=LightYellow ctermfg=Black guifg=Black +" highlight the current line +nnoremap gh :call matchadd('MultiLineHighlight', '\%'.line('.').'l') +" clear all the highlighted lines +nnoremap gH :call clearmatches() +" }}} " MISC ----------------{{{ " Use Unix way to add newline -- cgit v1.2.3-70-g09d2