diff options
author | Hsieh Chin Fan <pham@topo.tw> | 2024-07-08 23:24:22 +0800 |
---|---|---|
committer | Hsieh Chin Fan <pham@topo.tw> | 2024-07-08 23:24:22 +0800 |
commit | 7a98c89f22253177d9f5a0f83c9dbaa297eb54b0 (patch) | |
tree | 566f70c7c7777bd1983708f9bf6e285d28c93639 /vim/init/basic.vim | |
parent | d834d6da82ba20e32699380d335a65936bad16f9 (diff) |
Update
Diffstat (limited to 'vim/init/basic.vim')
-rw-r--r-- | vim/init/basic.vim | 34 |
1 files changed, 28 insertions, 6 deletions
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 | |||
120 | nnoremap <silent> <C-c> :call Bye()<CR> | 120 | nnoremap <silent> <C-c> :call Bye()<CR> |
121 | 121 | ||
122 | " }}} | 122 | " }}} |
123 | 123 | " Go to last cursor position ----------------{{{ | |
124 | " Don't unload a buffer when no longer shown in a window | ||
125 | " This allows you open a new buffer and leaves current buffer modified | ||
126 | set hidden | ||
127 | |||
128 | " ":augroup vimStartup | au! | augroup END" | ||
129 | augroup vimStartup | 124 | augroup vimStartup |
130 | au! | 125 | au! |
131 | " When editing a file, always jump to the last known cursor position. | 126 | " When editing a file, always jump to the last known cursor position. |
@@ -139,6 +134,7 @@ augroup vimStartup | |||
139 | augroup END | 134 | augroup END |
140 | 135 | ||
141 | " }}} | 136 | " }}} |
137 | " }}} | ||
142 | " TABSIZE ----------------{{{ | 138 | " TABSIZE ----------------{{{ |
143 | 139 | ||
144 | set expandtab | 140 | set expandtab |
@@ -178,6 +174,32 @@ set backupdir=~/.vim/tmp | |||
178 | " backup when write file | 174 | " backup when write file |
179 | set writebackup | 175 | set writebackup |
180 | " }}} | 176 | " }}} |
177 | " HIGHLIGHT ----------------{{{ | ||
178 | syntax enable | ||
179 | |||
180 | function! GetHighlightGroupName() | ||
181 | let l:syntaxID = synID(line('.'), col('.'), 1) | ||
182 | let l:groupName = synIDattr(l:syntaxID, 'name') | ||
183 | echo "Highlight Group Name: " . l:groupName | ||
184 | endfunction | ||
185 | |||
186 | " Defualt highlight for matched parenthesis is so weird in many colorscheme | ||
187 | " Why the background color is lighter than my caret !? | ||
188 | " highlight MatchParen ctermfg=NONE ctermbg=darkgrey cterm=NONE | ||
189 | highlight LuaParen ctermfg=NONE ctermbg=darkgrey cterm=NONE | ||
190 | |||
191 | " Show trailing spaces | ||
192 | highlight ExtraWhitespace ctermbg=red guibg=red | ||
193 | match ExtraWhitespace /\s\+$/ | ||
194 | |||
195 | " Persist visualized lines | ||
196 | " define line highlight color | ||
197 | highlight MultiLineHighlight ctermbg=LightYellow guibg=LightYellow ctermfg=Black guifg=Black | ||
198 | " highlight the current line | ||
199 | nnoremap <silent> <leader>gh :call matchadd('MultiLineHighlight', '\%'.line('.').'l')<CR> | ||
200 | " clear all the highlighted lines | ||
201 | nnoremap <silent> <leader>gH :call clearmatches()<CR> | ||
202 | " }}} | ||
181 | " MISC ----------------{{{ | 203 | " MISC ----------------{{{ |
182 | 204 | ||
183 | " Use Unix way to add newline | 205 | " Use Unix way to add newline |