Browse Source

Add some documentation and leader command, and fix typo in comment.

Phil Runninger 11 năm trước cách đây
mục cha
commit
84a7598b5d
2 tập tin đã thay đổi với 10 bổ sung2 xóa
  1. 3 0
      doc/bufexplorer.txt
  2. 7 2
      plugin/bufexplorer.vim

+ 3 - 0
doc/bufexplorer.txt

@@ -42,6 +42,8 @@ USAGE                                                      *bufexplorer-usage*
 
 To start exploring in the current window, use: >
  \be   or   :BufExplorer   or   Your custom key mapping
+To toggle bufexplorer on or off in the current window, use:
+ \bt   or   :ToggleBufExplorer   or   Your custom key mapping
 To start exploring in a newly split horizontal window, use: >
  \bs   or   :BufExplorerHorizontalSplit   or   Your custom key mapping
 To start exploring in a newly split vertical window, use: >
@@ -130,6 +132,7 @@ override bufexplorer's default mappings by setting up something like the
 following in your vimrc file:
 
   noremap <silent> <F11> :BufExplorer<CR>
+  noremap <silent> <s-F11> :ToggleBufExplorer<CR>
   noremap <silent> <m-F11> :BufExplorerHorizontalSplit<CR>
   noremap <silent> <c-F11> :BufExplorerVerticalSplit<CR>
 

+ 7 - 2
plugin/bufexplorer.vim

@@ -44,6 +44,7 @@
 "               You may use the default keymappings of
 "
 "                 <Leader>be  - Opens BufExplorer
+"                 <Leader>bt  - Toggles BufExplorer open or closed
 "                 <Leader>bs  - Opens horizontally split window BufExplorer
 "                 <Leader>bv  - Opens vertically split window BufExplorer
 "
@@ -51,6 +52,7 @@
 "               in your vimrc file, for example:
 "
 "                   noremap <silent> <F11> :BufExplorer<CR>
+"                   noremap <silent> <s-F11> :ToggleBufExplorer<CR>
 "                   noremap <silent> <m-F11> :BufExplorerHorizontalSplit<CR>
 "                   noremap <silent> <c-F11> :BufExplorerVerticalSplit<CR>
 "
@@ -913,7 +915,6 @@ endfunction
 function! s:Close()
     " Get only the listed buffers.
     let listed = filter(copy(s:MRUList), "buflisted(v:val)")
-
     " If we needed to split the main window, close the split one.
     if s:splitMode != "" && bufwinnr(s:originBuffer) != -1
         execute "wincmd c"
@@ -925,7 +926,7 @@ function! s:Close()
         " buffers.
         execute "enew"
     else
-        " Since there are buffers left to switch to, swith to the previous and
+        " Since there are buffers left to switch to, switch to the previous and
         " then the current.
         for b in reverse(listed[0:1])
             execute "keepjumps silent b ".b
@@ -1216,6 +1217,10 @@ if !hasmapto('BufExplorer') && g:bufExplorerDisableDefaultKeyMapping == 0
     noremap <script> <silent> <unique> <Leader>be :BufExplorer<CR>
 endif
 
+if !hasmapto('BufExplorer') && g:bufExplorerDisableDefaultKeyMapping == 0
+    noremap <script> <silent> <unique> <Leader>bt :ToggleBufExplorer<CR>
+endif
+
 if !hasmapto('BufExplorerHorizontalSplit') && g:bufExplorerDisableDefaultKeyMapping == 0
     noremap <script> <silent> <unique> <Leader>bs :BufExplorerHorizontalSplit<CR>
 endif