aboutsummaryrefslogtreecommitdiffhomepage
path: root/vim/init/basic.vim
diff options
context:
space:
mode:
authorHsieh Chin Fan <pham@topo.tw>2024-07-11 23:49:29 +0800
committerHsieh Chin Fan <pham@topo.tw>2024-07-11 23:49:29 +0800
commit058fa5ecbf152be3864b3a510aec418b18c35734 (patch)
treef72f404dd8fc76a6cb56b8106f7840c0f7dd0352 /vim/init/basic.vim
parent1f7d36d236965aa0f6ddff71321ebc755b79154c (diff)
Update
Diffstat (limited to 'vim/init/basic.vim')
-rw-r--r--vim/init/basic.vim48
1 files changed, 19 insertions, 29 deletions
diff --git a/vim/init/basic.vim b/vim/init/basic.vim
index c066f07..42dab16 100644
--- a/vim/init/basic.vim
+++ b/vim/init/basic.vim
@@ -76,19 +76,17 @@ set shiftwidth=2
76set cindent 76set cindent
77set ttimeout 77set ttimeout
78set ttimeoutlen=50 78set ttimeoutlen=50
79" set updatetime=1000 79" set updatetime=4000
80" autocmd CursorHold * normal! m' 80" autocmd CursorHold * normal! m'
81 81
82imap <C-c> <Esc>l
83
84" TAB ----------------{{{ 82" TAB ----------------{{{
85 83
86set expandtab 84set expandtab
87set softtabstop=-1 85set softtabstop=-1
88 86
89" 顯示分隔符號 87" Invisible chars
90set list 88set nolist
91set listchars=tab:▷▷,extends:>,precedes:< 89set listchars=tab:»·,extends:>,precedes:<
92 90
93" }}} 91" }}}
94 92
@@ -118,13 +116,27 @@ augroup vimStartup
118 " (it's likely a different one than last time). 116 " (it's likely a different one than last time).
119 autocmd BufReadPost * 117 autocmd BufReadPost *
120 \ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit' 118 \ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit'
121 \ | exe "normal! g`\"zv" 119 \ | try | silent execute 'normal! g`"zv' | endtry
122 \ | endif 120 \ | endif
123augroup END 121augroup END
124 122
125" }}} 123" }}}
126 124
127" }}} 125" }}}
126" FOLD ----------------{{{
127set foldenable " Allow fold
128set foldmethod=indent " Fold contents by indent
129set foldlevel=2
130set fillchars+=foldopen:▽,foldsep:│,foldclose:▶
131let g:defaut_foldcolumn = ""
132if has('nvim')
133 let g:defaut_foldcolumn = "auto:5"
134else
135 let g:defaut_foldcolumn = 5
136endif
137let &foldcolumn = g:defaut_foldcolumn
138
139" }}}
128" ENCODING_PREFERENCE ----------------{{{ 140" ENCODING_PREFERENCE ----------------{{{
129 141
130if has('multi_byte') 142if has('multi_byte')
@@ -135,13 +147,6 @@ if has('multi_byte')
135endif 147endif
136 148
137" }}} 149" }}}
138" FOLD ----------------{{{
139
140set foldenable " Allow fold
141set foldmethod=indent " Fold contents by indent
142set foldlevel=2
143
144" }}}
145" BACKUP ----------------{{{ 150" BACKUP ----------------{{{
146 151
147" Allow backup 152" Allow backup
@@ -162,13 +167,6 @@ set writebackup
162syntax enable 167syntax enable
163set conceallevel=1 168set conceallevel=1
164 169
165function! GetHighlightGroupName()
166 let l:syntaxID = synID(line('.'), col('.'), 1)
167 let l:groupName = synIDattr(l:syntaxID, 'name')
168 echo "Highlight Group Name: " . l:groupName
169endfunction
170nnoremap <leader>H :call GetHighlightGroupName()<CR>
171
172" Defualt highlight for matched parenthesis is so weird in many colorscheme 170" Defualt highlight for matched parenthesis is so weird in many colorscheme
173" Why the background color is lighter than my caret !? 171" Why the background color is lighter than my caret !?
174" highlight MatchParen ctermfg=NONE ctermbg=darkgrey cterm=NONE 172" highlight MatchParen ctermfg=NONE ctermbg=darkgrey cterm=NONE
@@ -178,14 +176,6 @@ highlight LuaParen ctermfg=NONE ctermbg=darkgrey cterm=NONE
178highlight ExtraWhitespace ctermbg=red guibg=red 176highlight ExtraWhitespace ctermbg=red guibg=red
179match ExtraWhitespace /\s\+$/ 177match ExtraWhitespace /\s\+$/
180 178
181" Persist visualized lines
182" define line highlight color
183highlight MultiLineHighlight ctermbg=LightYellow guibg=LightYellow ctermfg=Black guifg=Black
184" highlight the current line
185nnoremap <silent> <leader>gh :call matchadd('MultiLineHighlight', '\%'.line('.').'l')<CR>
186" clear all the highlighted lines
187nnoremap <silent> <leader>gH :call clearmatches()<CR>
188
189" }}} 179" }}}
190" MISC ----------------{{{ 180" MISC ----------------{{{
191 181