2020" press zR , in normal mode to OPEN all folds
2121" press zM , in normal mode to CLOSE all folds
2222
23- " Already been loaded? ~~
24- if exists (' Tb_loaded' ) || &diff == 1 || has ( ' gui_running ' )
23+ " Already been loaded? ~~ and don't execute when using vimdiff
24+ if exists (' Tb_loaded' ) || &diff == 1
2525 finish
2626else
2727 let Tb_loaded= 1
@@ -80,14 +80,14 @@ if ! hasmapto('1') || !hasmapto('<M-1>')
8080 inoremap <unique> <script> <M-0> <esc> :call <SID> Bf_SwitchTo( 10)<CR> :<BS> a
8181 else
8282 " NORMAL mode bindings for vim( dos32 )
83- noremap <unique> <script> ± :call <SID> Bf_SwitchTo( 1)<CR> :<BS>
84- noremap <unique> <script> ² :call <SID> Bf_SwitchTo( 2)<CR> :<BS>
85- noremap <unique> <script> ³ :call <SID> Bf_SwitchTo( 3)<CR> :<BS>
86- noremap <unique> <script> ´ :call <SID> Bf_SwitchTo( 4)<CR> :<BS>
87- noremap <unique> <script> µ :call <SID> Bf_SwitchTo( 5)<CR> :<BS>
88- noremap <unique> <script> ¶ :call <SID> Bf_SwitchTo( 6)<CR> :<BS>
89- noremap <unique> <script> · :call <SID> Bf_SwitchTo( 7)<CR> :<BS>
90- noremap <unique> <script> ¸ :call <SID> Bf_SwitchTo( 8)<CR> :<BS>
83+ " noremap <unique> <script> ? :call <SID>Bf_SwitchTo( 1)<CR>:<BS>
84+ " noremap <unique> <script> ? :call <SID>Bf_SwitchTo( 2)<CR>:<BS>
85+ " noremap <unique> <script> ? :call <SID>Bf_SwitchTo( 3)<CR>:<BS>
86+ " noremap <unique> <script> ? :call <SID>Bf_SwitchTo( 4)<CR>:<BS>
87+ " noremap <unique> <script> ? :call <SID>Bf_SwitchTo( 5)<CR>:<BS>
88+ " noremap <unique> <script> ? :call <SID>Bf_SwitchTo( 6)<CR>:<BS>
89+ " noremap <unique> <script> ? :call <SID>Bf_SwitchTo( 7)<CR>:<BS>
90+ " noremap <unique> <script> ? :call <SID>Bf_SwitchTo( 8)<CR>:<BS>
9191 " else
9292 " NORMAL mode bindings for vim( terminal)
9393 noremap <unique> <script> 1 :call <SID> Bf_SwitchTo( 1)<CR> :<BS>
@@ -112,6 +112,7 @@ if ! hasmapto('1') || !hasmapto('<M-1>')
112112 inoremap <unique> <script> 9 <esc> :call <SID> Bf_SwitchTo( 9)<CR> :<BS> a
113113 inoremap <unique> <script> 0 <esc> :call <SID> Bf_SwitchTo( 10)<CR> :<BS> a
114114 endif
115+ " nnoremap bd :call <SID>Bf_DelWithD()<CR>:<BS>
115116endif " %%
116117
117118
@@ -143,7 +144,7 @@ endif
143144if ! exists (' :Tbbn' )
144145 command ! Tbbn call <SID> Bf_Cycle (1 )
145146endif
146- if ! exists (' :Tbbp ' )
147+ if ! exists (' :Tbp ' )
147148 command ! Tbbp call <SID> Bf_Cycle (0 )
148149endif
149150if ! exists (' :Tbbd' )
@@ -325,6 +326,7 @@ augroup TabBar
325326autocmd TabBar BufDelete * call <SID> DEBUG (' -=> BufDelete AutoCmd' , 10 ) |call <SID> Tb_AutoUpdt (expand (' <abuf>' ))
326327autocmd TabBar BufEnter * call <SID> DEBUG (' -=> BufEnter AutoCmd' , 10 ) |call <SID> Tb_AutoUpdt (-1 )
327328autocmd TabBar VimEnter * call <SID> DEBUG (' -=> VimEnter AutoCmd' , 10 ) |let g: Tb_AutoUpdt = 1 |call <SID> Tb_AutoUpdt (-1 )
329+ augroup END
328330" %%
329331
330332
@@ -372,9 +374,6 @@ function! <SID>Tb_Start(sticky, delBufNum)
372374 setlocal foldcolumn = 0
373375 setlocal nonumber
374376
375- " Keeps the TabBar window size when resizing the whole application
376- set winfixheight
377-
378377 if has (" syntax" )
379378 syn clear
380379 syn match Tb_Normal ' \[ [^\] ]*\] '
@@ -420,7 +419,9 @@ function! <SID>Tb_Start(sticky, delBufNum)
420419 call <SID> Bf_SafePrint (a: delBufNum )
421420
422421 if (l: curBuf != -1 )
423- call search (' \[' .l: curBuf .' :' .expand (' #' .l: curBuf .' :t' ).' \]' )
422+ " call search('\['.l:curBuf.':'.expand('#'.l:curBuf.':t').'\]')
423+ " escape some characters
424+ call search (escape (' \[' .l: curBuf .' :' .expand (' #' .l: curBuf .' :t' ).' \]' , ' \\/.*$^~[]' ))
424425 else
425426 call <SID> DEBUG (' Tb_Start: No current buffer to search for' ,9 )
426427 endif
@@ -574,6 +575,8 @@ function! <SID>Tb_AutoUpdt(delBufNum)
574575 wincmd p
575576 endif
576577 else
578+ " build tabbar list anyway
579+ let l: ListChanged = <SID> Bf_BuildList (a: delBufNum , 0 )
577580 if g: Tb_DBG_LVL > 0
578581 call <SID> DEBUG (' Tb_AutoUpdt: Failed in eligible check' , 9 )
579582 endif
@@ -655,6 +658,7 @@ function! <SID>Win_Goto_Main()
655658" endwhile
656659 endif
657660endfunction " %%
661+
658662" Win_Find - Return the window number of a named buffer ~~
659663" If none is found then returns -1.
660664function ! <SID> Win_Find (bufName)
@@ -910,6 +914,7 @@ function! <SID>Bf_Choosed()
910914 endif
911915endfunction " %%
912916
917+
913918" Bf_DelWithD - From the -TabBar- window, delete selected buffer from list ~~
914919" After making sure that we are in our explorer, This will delete the buffer
915920" under the cursor. If the buffer under the cursor is being displayed in a
@@ -1068,6 +1073,7 @@ function! <SID>Bf_DelWithD()
10681073 call <SID> Win_Goto_Main ()
10691074endfunction " %%
10701075
1076+
10711077" Bf_SafePrint - Wrapper for getting -TabBar- window shown ~~
10721078"
10731079" Makes sure we are in our explorer, then erases the current buffer and turns
@@ -1685,6 +1691,18 @@ endfunc " %%
16851691" ````````````````````````````````````````````````````````````````
16861692" %%
16871693
1694+ " handle tabbar open window problem
1695+ command ! - bang -nargs =? -complete =file E call <SID> Wrapper_Edit (<f-args> )
1696+ function <SID> Wrapper_Edit (filename)
1697+ " echo a:filename
1698+ if getbufvar (a: filename , " &buftype" ) != " nofile"
1699+ " open file below or above tabbar
1700+ call <SID> Win_Goto_Main ()
1701+ exe " e " . a: filename
1702+ endif
1703+ endfunction
1704+
1705+
16881706" BUGFIX:
16891707" 0.7. Removed mapping to <tt>, to avoid delayed response to <<
16901708" 0.6. Fixed the "delete with d" bug.
0 commit comments