aboutsummaryrefslogtreecommitdiffhomepage
path: root/vim/init
diff options
context:
space:
mode:
Diffstat (limited to 'vim/init')
-rw-r--r--vim/init/basic.vim65
-rw-r--r--vim/init/config.vim1
-rw-r--r--vim/init/keymaps.vim230
3 files changed, 168 insertions, 128 deletions
diff --git a/vim/init/basic.vim b/vim/init/basic.vim
index a54bf59..c066f07 100644
--- a/vim/init/basic.vim
+++ b/vim/init/basic.vim
@@ -12,8 +12,10 @@ augroup filetype_vim
12 execute "autocmd FileType vim :inoreabbrev <buffer> --- ----------------{".."{{" 12 execute "autocmd FileType vim :inoreabbrev <buffer> --- ----------------{".."{{"
13 autocmd FileType vim setlocal foldmethod=marker foldlevel=0 13 autocmd FileType vim setlocal foldmethod=marker foldlevel=0
14augroup END 14augroup END
15
15" }}} 16" }}}
16" GERERNAL ----------------{{{ 17" GERERNAL ----------------{{{
18
17let mapleader = "," " Always use comma as leader key 19let mapleader = "," " Always use comma as leader key
18set nocompatible " Disable vi compatible, today is 20XX 20set nocompatible " Disable vi compatible, today is 20XX
19set path=.,** " Allow :find with completion 21set path=.,** " Allow :find with completion
@@ -32,6 +34,7 @@ filetype plugin indent on
32" Unnamed buffer like CmdWindows should prevent this 34" Unnamed buffer like CmdWindows should prevent this
33set autoread 35set autoread
34autocmd FocusGained,BufEnter .* checktime 36autocmd FocusGained,BufEnter .* checktime
37
35" }}} 38" }}}
36" VISUAL ----------------{{{ 39" VISUAL ----------------{{{
37 40
@@ -64,14 +67,12 @@ set wildmenu wildoptions=pum,fuzzy
64" Format of error message 67" Format of error message
65set errorformat+=[%f:%l]\ ->\ %m,[%f:%l]:%m 68set errorformat+=[%f:%l]\ ->\ %m,[%f:%l]:%m
66 69
67" 顯示分隔符號
68set listchars=tab:\|\ ,trail:.,extends:>,precedes:<
69
70" }}} 70" }}}
71" EDIT ----------------{{{ 71" EDIT ----------------{{{
72 72
73set backspace=eol,start,indent " Set Backspace behaviors 73set backspace=eol,start,indent " Set Backspace behaviors
74set autoindent " If current line has indent, automatically set indent for next line 74set autoindent smartindent
75set shiftwidth=2
75set cindent 76set cindent
76set ttimeout 77set ttimeout
77set ttimeoutlen=50 78set ttimeoutlen=50
@@ -80,14 +81,14 @@ set ttimeoutlen=50
80 81
81imap <C-c> <Esc>l 82imap <C-c> <Esc>l
82 83
83" TABSIZE ----------------{{{ 84" TAB ----------------{{{
84 85
85set expandtab 86set expandtab
86set shiftwidth=2 87set softtabstop=-1
87set autoindent 88
88set tabstop=4 89" 顯示分隔符號
89set softtabstop=0 90set list
90set smartindent 91set listchars=tab:▷▷,extends:>,precedes:<
91 92
92" }}} 93" }}}
93 94
@@ -99,39 +100,15 @@ set suffixesadd=.md " Enable reference markdown file without extension
99 100
100" }}} 101" }}}
101" SEARCH ----------------{{{ 102" SEARCH ----------------{{{
102set ignorecase " Search case without case sensation 103
104set ignorecase " Search case without case sensation
103set smartcase 105set smartcase
104set hlsearch " Hilight all matched texts 106set hlsearch " Hilight all matched texts
105set incsearch " Show matched strings when typing 107set incsearch " Show matched strings when typing
108
106" }}} 109" }}}
107" BUFFERS ----------------{{{ 110" BUFFERS ----------------{{{
108 111
109" Use <C-c> to quit the last buffer ----------------{{{
110let g:quitVimWhenPressingCtrlC = 1
111function! ToggleQuit()
112 let g:quitVimWhenPressingCtrlC = g:quitVimWhenPressingCtrlC ? 0 : 1
113 let message = g:quitVimWhenPressingCtrlC ? "Unlock" : "Lock"
114 echo message
115endfunction
116
117nnoremap <leader><leader>gl :call ToggleQuit()<CR>
118
119function! Bye()
120 if len(getbufinfo({'buflisted': 1})) == 1 && len(getwininfo()) == 1
121 if g:quitVimWhenPressingCtrlC
122 :silent! quit
123 else
124 :echo "Press <leader><leader>gl to allow quit with <C-c>"
125 endif
126 else
127 :bdelete
128 endif
129endfunction
130
131" Ctrl-C rules!!!
132nnoremap <silent> <C-c> :call Bye()<CR>
133
134" }}}
135" Go to last cursor position ----------------{{{ 112" Go to last cursor position ----------------{{{
136augroup vimStartup 113augroup vimStartup
137 au! 114 au!
@@ -141,7 +118,7 @@ augroup vimStartup
141 " (it's likely a different one than last time). 118 " (it's likely a different one than last time).
142 autocmd BufReadPost * 119 autocmd BufReadPost *
143 \ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit' 120 \ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit'
144 \ | exe "normal! g`\"" 121 \ | exe "normal! g`\"zv"
145 \ | endif 122 \ | endif
146augroup END 123augroup END
147 124
@@ -158,10 +135,12 @@ if has('multi_byte')
158endif 135endif
159 136
160" }}} 137" }}}
161" FOLDING ----------------{{{ 138" FOLD ----------------{{{
139
162set foldenable " Allow fold 140set foldenable " Allow fold
163set foldmethod=indent " Fold contents by indent 141set foldmethod=indent " Fold contents by indent
164set foldlevel=2 142set foldlevel=2
143
165" }}} 144" }}}
166" BACKUP ----------------{{{ 145" BACKUP ----------------{{{
167 146
@@ -176,8 +155,10 @@ set backupdir=~/.vim/tmp
176 155
177" backup when write file 156" backup when write file
178set writebackup 157set writebackup
158
179" }}} 159" }}}
180" HIGHLIGHT ----------------{{{ 160" HIGHLIGHT ----------------{{{
161
181syntax enable 162syntax enable
182set conceallevel=1 163set conceallevel=1
183 164
@@ -186,6 +167,7 @@ function! GetHighlightGroupName()
186 let l:groupName = synIDattr(l:syntaxID, 'name') 167 let l:groupName = synIDattr(l:syntaxID, 'name')
187 echo "Highlight Group Name: " . l:groupName 168 echo "Highlight Group Name: " . l:groupName
188endfunction 169endfunction
170nnoremap <leader>H :call GetHighlightGroupName()<CR>
189 171
190" Defualt highlight for matched parenthesis is so weird in many colorscheme 172" Defualt highlight for matched parenthesis is so weird in many colorscheme
191" Why the background color is lighter than my caret !? 173" Why the background color is lighter than my caret !?
@@ -203,6 +185,7 @@ highlight MultiLineHighlight ctermbg=LightYellow guibg=LightYellow ctermfg=Black
203nnoremap <silent> <leader>gh :call matchadd('MultiLineHighlight', '\%'.line('.').'l')<CR> 185nnoremap <silent> <leader>gh :call matchadd('MultiLineHighlight', '\%'.line('.').'l')<CR>
204" clear all the highlighted lines 186" clear all the highlighted lines
205nnoremap <silent> <leader>gH :call clearmatches()<CR> 187nnoremap <silent> <leader>gH :call clearmatches()<CR>
188
206" }}} 189" }}}
207" MISC ----------------{{{ 190" MISC ----------------{{{
208 191
diff --git a/vim/init/config.vim b/vim/init/config.vim
index ae623ec..074f09d 100644
--- a/vim/init/config.vim
+++ b/vim/init/config.vim
@@ -6,6 +6,7 @@
6" Unnamed Buffer ----------------{{{ 6" Unnamed Buffer ----------------{{{
7 7
8augroup DeleteUnnamedEmptBuffer! 8augroup DeleteUnnamedEmptBuffer!
9 au!
9 au BufLeave {} if getline(1, '$') == [''] | setlocal bufhidden=wipe | endif 10 au BufLeave {} if getline(1, '$') == [''] | setlocal bufhidden=wipe | endif
10augroup END 11augroup END
11 12
diff --git a/vim/init/keymaps.vim b/vim/init/keymaps.vim
index f46e67b..38bdd0e 100644
--- a/vim/init/keymaps.vim
+++ b/vim/init/keymaps.vim
@@ -1,7 +1,6 @@
1"====================================================================== 1"======================================================================
2" Only for key mapping 2" Only for key mapping
3"====================================================================== 3"======================================================================
4" vim: set ts=4 sw=4 tw=78 noet :
5 4
6" COMMON_MAPPING ----------------{{{ 5" COMMON_MAPPING ----------------{{{
7 6
@@ -14,29 +13,22 @@ vnoremap * y/\V<C-R>=escape(@",'/\')<CR><CR>
14" Disable highlight when <leader><CR> is pressed 13" Disable highlight when <leader><CR> is pressed
15map <silent> <leader><CR> :noh<CR> 14map <silent> <leader><CR> :noh<CR>
16 15
17" Paste register 0 16" Set wrap
18nnoremap <C-p> "0p 17nnoremap <leader>W :set wrap!<CR>:set wrap?<CR>
19 18
20" Fast saving 19" Fast saving
21nmap <leader>w :w!<CR> 20nmap <leader>w :w!<CR>
22 21
22" :W sudo saves the file
23" (useful for handling the permission-denied error)
24command! W execute 'w !sudo -S tee %' <bar> edit!
25
23" Fast quit with error 26" Fast quit with error
24nmap <leader>q :q<CR> 27nmap <leader>q :q<CR>
25 28
26" Fast quit with error 29" Fast quit with error
27nmap cq :cq<CR> 30nmap cq :cq<CR>
28 31
29" Switch wrap
30nmap <leader>W :set wrap!<CR>
31
32" :W sudo saves the file
33" (useful for handling the permission-denied error)
34command! W execute 'w !sudo -S tee %' <bar> edit!
35
36" Enter to open file
37nnoremap <CR> gf
38nnoremap gF :e <cfile><CR>
39
40" Remap <CR> in Quickfix, Cmdwin Location list 32" Remap <CR> in Quickfix, Cmdwin Location list
41augroup vimrc_CRfix 33augroup vimrc_CRfix
42 au! 34 au!
@@ -49,13 +41,25 @@ augroup END
49" nnoremap <leader>, :terminal ++noclose<CR> 41" nnoremap <leader>, :terminal ++noclose<CR>
50vnoremap <leader>, :terminal<CR> 42vnoremap <leader>, :terminal<CR>
51 43
44" Paste register 0
45nnoremap <C-p> "0p
46
52" Toggle paste mode on and off 47" Toggle paste mode on and off
53map <leader>pp :setlocal paste!<CR> 48map <leader>pp :setlocal paste!<CR>
54 49
50" Copy from system clipboard
51nnoremap <leader>P :r !xsel -ob<CR>
52vnoremap Y :w !xsel -ib<CR>
53
55" Switch CWD to the directory of the open buffer 54" Switch CWD to the directory of the open buffer
56nnoremap cd :cd %:p:h<CR>:pwd<CR> 55nnoremap cd :cd %:p:h<CR>:pwd<CR>
57" Switch CWD to root git directory 56" Switch CWD to root git directory
58nnoremap cdg :execute 'cd' fnameescape(fnamemodify(finddir('.git', escape(expand('%:p:h'), ' ') . ';'), ':h'))<CR>:pwd<CR> 57function! CdToGitRepo()
58 let l:git_dir = finddir('.git', escape(expand('%:p:h'), ' ') . ';')
59 let l:repo = fnameescape(fnamemodify(l:git_dir, ':h'))
60 execute "cd" l:repo
61endfunction
62nnoremap cdg :call CdToGitRepo()<CR>:pwd<CR>
59 63
60" alias for cd 64" alias for cd
61nnoremap cdd :cd<space> 65nnoremap cdd :cd<space>
@@ -83,10 +87,6 @@ nnoremap <C-k> ddkP
83" execute "set <M-l>=\el" 87" execute "set <M-l>=\el"
84" execute "set <M-h>=\eh" 88" execute "set <M-h>=\eh"
85 89
86" Copy from system clipboard
87nnoremap <leader>P :r !xsel -ob<CR>
88vnoremap Y :w !xsel -ib<CR>
89
90" Spell 90" Spell
91nnoremap <leader><leader>sp :set spell!<CR> 91nnoremap <leader><leader>sp :set spell!<CR>
92nnoremap <leader>ss ]s 92nnoremap <leader>ss ]s
@@ -99,11 +99,6 @@ nnoremap <C-g> 1<C-g>
99vnoremap Tz :!trans -t zh-TW -b<CR> 99vnoremap Tz :!trans -t zh-TW -b<CR>
100vnoremap Te :!trans -t en-US -b<CR> 100vnoremap Te :!trans -t en-US -b<CR>
101 101
102" source .vimrc
103nnoremap <leader>so V:so<CR>
104nnoremap <leader><leader>so :source ~/.vimrc<CR>
105vnoremap so :source<CR>
106
107" }}} 102" }}}
108" MOVE ----------------{{{ 103" MOVE ----------------{{{
109 104
@@ -115,15 +110,11 @@ noremap <silent> <expr> k (v:count == 0 ? 'gk' : 'k')
115noremap <C-h> 30h 110noremap <C-h> 30h
116noremap <C-l> 30l 111noremap <C-l> 30l
117 112
118" }}} 113" File under the cursor
119" MANAGE_VIMRC ----------------{{{ 114nnoremap <CR> gf
115nnoremap gF :e <cfile><CR>
120 116
121nnoremap <leader>e :scriptnames<space> 117" READLINE_FEATURES ----------------{{{
122nnoremap <leader>ee :edit $MYVIMRC<CR>
123autocmd! BUFWRITEPOST $MYVIMRC source $MYVIMRC
124
125" }}}
126" MOVING_WITH_READLINE ----------------{{{
127 118
128inoremap <C-f> <Right> 119inoremap <C-f> <Right>
129inoremap <C-b> <Left> 120inoremap <C-b> <Left>
@@ -157,15 +148,6 @@ noremap <m-k> gk
157inoremap <m-j> <c-\><c-o>gj 148inoremap <m-j> <c-\><c-o>gj
158inoremap <m-k> <c-\><c-o>gk 149inoremap <m-k> <c-\><c-o>gk
159" }}} 150" }}}
160" INSERT_SURROUNDING ----------------{{{
161
162inoremap ' ''<Left>
163inoremap " ""<Left>
164inoremap ( ()<Left>
165inoremap [ []<Left>
166inoremap { {}<Left>
167
168" }}}
169" JUMP_TO_TABS_WITH_ALT ----------------{{{ 151" JUMP_TO_TABS_WITH_ALT ----------------{{{
170 152
171noremap <silent><A-1> :tabn 1<CR> 153noremap <silent><A-1> :tabn 1<CR>
@@ -188,87 +170,122 @@ inoremap <silent><M-8> <Esc>:tabn 8<CR>
188inoremap <silent><M-9> <Esc>:tablast<CR> 170inoremap <silent><M-9> <Esc>:tablast<CR>
189 171
190" }}} 172" }}}
191" MANAGE_TABS ----------------{{{
192 173
193" Useful mappings for managing tabs 174" }}}
194map <leader>tn :tabnew<CR> 175" MANAGE_VIMRC ----------------{{{
195map <leader>tc :tabclose<CR>
196map <leader>tm :tabmove<SPACE>
197map <leader>to :tabonly<CR>
198
199noremap <silent><m-h> :call Tab_MoveLeft()<CR>
200noremap <silent><m-l> :call Tab_MoveRight()<CR>
201 176
202" Let <leader>tl toggle between this and the last accessed tab 177" source .vimrc
203let g:lasttab = 1 178nnoremap <leader>so V:so<CR>
204nmap <Leader>tl :exe "tabn ".g:lasttab<CR> 179nnoremap <leader><leader>so :source ~/.vimrc<CR>
205autocmd TabLeave * let g:lasttab = tabpagenr() 180vnoremap so :source<CR>
181autocmd! BUFWRITEPOST $MYVIMRC source $MYVIMRC
206 182
207" Opens a new tab with the current buffer's path 183" Find scripts
208" Super useful when editing files in the same directory 184nnoremap <leader>e :scriptnames<space>
209map <leader>te :tabedit <C-r>=expand("%:p:h")<CR> 185nnoremap <leader>ee :edit $MYVIMRC<CR>
210 186
211" Tab move functions
212function! Tab_MoveLeft()
213 let l:tabnr = tabpagenr() - 2
214 if l:tabnr >= 0
215 exec 'tabmove '.l:tabnr
216 endif
217endfunc
218function! Tab_MoveRight()
219 let l:tabnr = tabpagenr() + 1
220 if l:tabnr <= tabpagenr('$')
221 exec 'tabmove '.l:tabnr
222 endif
223endfunc
224" }}} 187" }}}
225" MANAGE_BUFFERS ----------------{{{ 188" MANAGE_BUFFERS ----------------{{{
226 189
227" set buflisted 190" Set options
228noremap <leader>st :set<space> 191noremap <leader>st :set<space>
192noremap <leader><leader>ft :<C-\>e'set filetype='..&filetype<CR>
229 193
230" Open a new buffer 194" Open a new buffer
231nmap <leader><leader>b :enew<CR>
232nmap <leader>B :enew<CR> 195nmap <leader>B :enew<CR>
233nmap <leader>O :e /tmp/buffer<CR> 196nmap <leader>O :e /tmp/buffer<CR>
234 197
235" Next buffer
236noremap <leader>l :exe "buffer ".g:lastbuffer<CR>
237" noremap <Tab> :exe 'buffer '.g:lastbuffer<CR>
238
239" set filetype
240noremap <leader><leader>ft :<C-\>e'set filetype='..&filetype<CR>
241
242" Let <leader>l toggle between this and the last accessed buffer 198" Let <leader>l toggle between this and the last accessed buffer
243augroup SaveLastBuffer 199augroup SaveLastBuffer
244 let g:lastbuffer = 1 200 let g:lastbuffer = 1
245 au BufLeave * let g:lastbuffer = bufnr() 201 au BufLeave * let g:lastbuffer = bufnr()
246augroup END 202augroup END
203noremap <leader>l :exe "buffer ".g:lastbuffer<CR>
204
205" Use Ctrl-C for buffer delete or quit vim ----------------{{{
206
207" Toggle behavior for the last buffer in the last window
208let g:quitVimWhenPressingCtrlC = 1
209function! ToggleQuit()
210 let g:quitVimWhenPressingCtrlC = g:quitVimWhenPressingCtrlC ? 0 : 1
211 let message = g:quitVimWhenPressingCtrlC ? "Unlock" : "Lock"
212 echo message
213endfunction
214nnoremap <leader><leader>gl :call ToggleQuit()<CR>
215
216function! CheckSave()
217 if &modified
218 let answer = confirm("Save changes?", "&Yes\n&No\n&Cancel")
219 if answer == 1 | write | endif
220 if answer == 3 | return | endif
221 endif
222
223 if len(getbufinfo({'buflisted': 1})) == 2
224 try | buffer # | bdelete! # | catch | endtry
225 else
226 bdelete!
227 endif
228endfunction
229func! QuitWithCheck()
230 if g:quitVimWhenPressingCtrlC
231 silent! quit
232 else
233 echo "Press <leader><leader>gl to allow quit with <C-c>"
234 endif
235endfunc
236function! Bye()
237 let windows = gettabinfo(tabpagenr())[0]['windows']
238 let bufs = gettabinfo(tabpagenr())[0]['variables']['bufs']
239 if len(windows) == 1 && len(bufs) == 1
240 echo 'quit'
241 call QuitWithCheck()
242 elseif &diff
243 call CloseBuffersForDiff()
244 else
245 echo 'bdelete'
246 call CheckSave()
247 endif
248endfunction
249nnoremap <silent> <C-c> :call Bye()<CR>
250
251"}}}
252" Diff Mode ----------------{{{
253
254function! CloseBuffersForDiff()
255 windo | if &diff && &buftype == "nofile" | bdelete | endif
256 norm! zv
257endfunction
258
259command! DiffOrig vert new | set buftype=nofile nobuflisted | read ++edit # | 0d_
260\ | diffthis | wincmd p | diffthis
247 261
248" Uset <C-w>d to toggle Diff mode 262" Uset <C-w>d to toggle Diff mode
249function! s:SwitchDiff() 263function! s:SwitchDiff()
250 if &diff 264 if &diff
251 windo | if &buftype == "nofile" | bdelete | endif 265 call CloseBuffersForDiff()
252 else 266 else
253 DiffOrig 267 DiffOrig
254 wincmd p | set nobuflisted | wincmd p
255 endif 268 endif
256endfunction 269endfunction
257com! SwitchDiff call s:SwitchDiff() 270com! SwitchDiff call s:SwitchDiff()
258nnoremap <C-w>d <Cmd>silent! SwitchDiff<CR> 271nnoremap <C-w>d <Cmd>silent! SwitchDiff<CR>
259 272
260function! s:SwitchDiffForGitHEAD() 273function! s:SwitchDiffForGitHEAD()
261 nmap cdg 274 norm cdg
262 if &diff 275 if &diff
263 windo | if &buftype == "nofile" | bdelete | endif 276 windo | if &buftype == "nofile" | bdelete | endif
277 norm! zv
264 else 278 else
265 vert new | set buftype=nofile nobuflisted 279 vert new | set buftype=nofile nobuflisted
266 read !git show HEAD:# 280 read !git show HEAD:#
267 0d_ | diffthis | wincmd p | diffthis 281 0d_ | diffthis | wincmd p | diffthis
268 endif 282 endif
269endfunction 283endfunction
270com! SwitchDiffForGitHEAD call s:SwitchDiffForGitHEAD() 284command! SwitchDiffForGitHEAD call s:SwitchDiffForGitHEAD()
271nnoremap <C-w>D <Cmd>silent! SwitchDiffForGitHEAD<CR> 285nnoremap <C-w>D <Cmd>silent! SwitchDiffForGitHEAD<CR>
286
287" }}}
288
272" }}} 289" }}}
273" MANAGE_WINDOWS ----------------{{{ 290" MANAGE_WINDOWS ----------------{{{
274 291
@@ -306,7 +323,41 @@ elseif has('nvim')
306 tnoremap <m-q> <c-\><c-n> 323 tnoremap <m-q> <c-\><c-n>
307endif 324endif
308" }}} 325" }}}
309" FOLDING ----------------{{{ 326" MANAGE_TABS ----------------{{{
327
328" Useful mappings for managing tabs
329map <leader>tn :tabnew<CR>
330map <leader>tc :tabclose<CR>
331map <leader>tm :tabmove<SPACE>
332map <leader>to :tabonly<CR>
333
334noremap <silent><m-h> :call Tab_MoveLeft()<CR>
335noremap <silent><m-l> :call Tab_MoveRight()<CR>
336
337" Let <leader>tl toggle between this and the last accessed tab
338let g:lasttab = 1
339nmap <Leader>tl :exe "tabn ".g:lasttab<CR>
340autocmd TabLeave * let g:lasttab = tabpagenr()
341
342" Opens a new tab with the current buffer's path
343" Super useful when editing files in the same directory
344map <leader>te :tabedit <C-r>=expand("%:p:h")<CR>
345
346" Tab move functions
347function! Tvab_MoveLeft()
348 let l:tabnr = tabpagenr() - 2
349 if l:tabnr >= 0
350 exec 'tabmove '.l:tabnr
351 endif
352endfunc
353function! Tab_MoveRight()
354 let l:tabnr = tabpagenr() + 1
355 if l:tabnr <= tabpagenr('$')
356 exec 'tabmove '.l:tabnr
357 endif
358endfunc
359" }}}
360" FOLD ----------------{{{
310 361
311" Set foldmethod 362" Set foldmethod
312noremap <leader><leader>fm :<C-\>e'set foldmethod='..&foldmethod<CR> 363noremap <leader><leader>fm :<C-\>e'set foldmethod='..&foldmethod<CR>
@@ -317,13 +368,19 @@ nnoremap zr zr:set foldlevel<CR>
317 368
318" Use l to open fold 369" Use l to open fold
319nnoremap <expr> l foldclosed('.') == -1 ? 'l' : 'zo' 370nnoremap <expr> l foldclosed('.') == -1 ? 'l' : 'zo'
320sourcesourcesource 371
321" Open fold in next line 372" Open fold in next line
322nnoremap <expr> zo foldclosed('.') == -1 ? 'zjzo' : 'zo' 373nnoremap <expr> zo foldclosed('.') == -1 ? 'zjzo' : 'zo'
323nnoremap <expr> zO foldclosed('.') == -1 ? 'zjzO' : 'zO' 374nnoremap <expr> zO foldclosed('.') == -1 ? 'zjzO' : 'zO'
324 375
325" }}} 376" }}}
326" SURROURD_WITH_CHAR ----------------{{{ 377" SURROUND ----------------{{{
378
379inoremap ' ''<Left>
380inoremap " ""<Left>
381inoremap ( ()<Left>
382inoremap [ []<Left>
383inoremap { {}<Left>
327 384
328vnoremap S sa 385vnoremap S sa
329vnoremap ' <ESC>`<i'<ESC>`>la'<ESC> 386vnoremap ' <ESC>`<i'<ESC>`>la'<ESC>
@@ -403,7 +460,6 @@ let g:tig_explorer_keymap_commit_vsplit = '<C-v>'
403nnoremap <C-t> <Cmd>Tig<CR> 460nnoremap <C-t> <Cmd>Tig<CR>
404nnoremap <C-t>s <Cmd>TigStatus<CR> 461nnoremap <C-t>s <Cmd>TigStatus<CR>
405nnoremap <C-t>b <Cmd>TigBlame<CR> 462nnoremap <C-t>b <Cmd>TigBlame<CR>
406nnoremap <C-t>d :vertical TigOpenFileWithCommit <C-R>+ % 0<CR>
407 463
408" }}} 464" }}}
409" Markdown items (temproray solution) ----------------{{{ 465" Markdown items (temproray solution) ----------------{{{