Quellcode durchsuchen

Add toggle command for showing and closing BufExplorer.

Phil Runninger vor 11 Jahren
Ursprung
Commit
cbd6b7de83
1 geänderte Dateien mit 11 neuen und 0 gelöschten Zeilen
  1. 11 0
      plugin/bufexplorer.vim

+ 11 - 0
plugin/bufexplorer.vim

@@ -57,6 +57,7 @@
 "               Or you can use
 "
 "                 ":BufExplorer"                - Opens BufExplorer
+"                 ":ToggleBufExplorer"          - Opens/Closes BufExplorer
 "                 ":BufExplorerHorizontalSplit" - Opens horizontally window BufExplorer
 "                 ":BufExplorerVerticalSplit"   - Opens vertically split window BufExplorer
 "
@@ -84,6 +85,7 @@ endif
 
 " Create commands {{{2
 command! BufExplorer :call BufExplorer()
+command! ToggleBufExplorer :call ToggleBufExplorer()
 command! BufExplorerHorizontalSplit :call BufExplorerHorizontalSplit()
 command! BufExplorerVerticalSplit :call BufExplorerVerticalSplit()
 
@@ -339,6 +341,15 @@ function! BufExplorerVerticalSplit()
     execute "BufExplorer"
 endfunction
 
+" ToggleBufExplorer {{{2
+function! ToggleBufExplorer()
+    if exists("s:running") && s:running == 1
+        call s:Close()
+    else
+        call BufExplorer()
+    endif
+endfunction
+
 " BufExplorer {{{2
 function! BufExplorer()
     let name = s:name