Browse Source

Use `X` to toggle the showing of terminal buffers.

When the feature to toggle showing terminal buffers was introduced, a
mapping was added for `H` to perform this toggling in the BufExplorer
window; however, the `H` key was immediately mapped again by
BufExplorer's logic to use `:keepjumps` with some movement keys (`H`,
`M`, `L`, etc.), thus disabling the intended `H` mapping:

  ```vim
  nnoremap <script> <silent> <nowait> <buffer> H             :call <SID>ToggleShowTerminal()<CR>

  for k in ["G", "n", "N", "L", "M", "H"]
      execute "nnoremap <buffer> <silent>" k ":keepjumps normal!" k."<CR>"
  endfor
  ```

As these movement keys are useful for navigating the BufExplorer window,
use `X` instead of `H` to toggle the showing of terminal buffers, as `X`
is normally an editing feature (for deleting characters before the
cursor) that's not needed in the BufExplorer window.

In addition, the `X` command has been documented in `bufexplorer.txt`
and in BufExplorer's `<F1>` help text.
Michael Henry 1 year ago
parent
commit
f0f6de036f
2 changed files with 3 additions and 1 deletions
  1. 1 0
      doc/bufexplorer.txt
  2. 2 1
      plugin/bufexplorer.vim

+ 1 - 0
doc/bufexplorer.txt

@@ -103,6 +103,7 @@ Commands to use once exploring:
  u             Toggles the showing of "unlisted" buffers.
  u             Toggles the showing of "unlisted" buffers.
  V             Open the selected buffer in another window on the left of the current.
  V             Open the selected buffer in another window on the left of the current.
  v             Open the selected buffer in another window on the right of the current.
  v             Open the selected buffer in another window on the right of the current.
+ X             Toggles the showing of terminal buffers.
 
 
 Once invoked, Buffer Explorer displays a sorted list (MRU is the default
 Once invoked, Buffer Explorer displays a sorted list (MRU is the default
 sort method) of all the buffers that are currently opened. You are then
 sort method) of all the buffers that are currently opened. You are then

+ 2 - 1
plugin/bufexplorer.vim

@@ -714,7 +714,7 @@ function! s:MapKeys()
     nnoremap <script> <silent> <nowait> <buffer> u             :call <SID>ToggleShowUnlisted()<CR>
     nnoremap <script> <silent> <nowait> <buffer> u             :call <SID>ToggleShowUnlisted()<CR>
     nnoremap <script> <silent> <nowait> <buffer> v             :call <SID>SelectBuffer("split", "vr")<CR>
     nnoremap <script> <silent> <nowait> <buffer> v             :call <SID>SelectBuffer("split", "vr")<CR>
     nnoremap <script> <silent> <nowait> <buffer> V             :call <SID>SelectBuffer("split", "vl")<CR>
     nnoremap <script> <silent> <nowait> <buffer> V             :call <SID>SelectBuffer("split", "vl")<CR>
-    nnoremap <script> <silent> <nowait> <buffer> H             :call <SID>ToggleShowTerminal()<CR>
+    nnoremap <script> <silent> <nowait> <buffer> X             :call <SID>ToggleShowTerminal()<CR>
 
 
 
 
     for k in ["G", "n", "N", "L", "M", "H"]
     for k in ["G", "n", "N", "L", "M", "H"]
@@ -839,6 +839,7 @@ function! s:CreateHelp()
         call add(header, '" u : toggle showing unlisted buffers')
         call add(header, '" u : toggle showing unlisted buffers')
         call add(header, '" V : open buffer in another window on the left of the current')
         call add(header, '" V : open buffer in another window on the left of the current')
         call add(header, '" v : open buffer in another window on the right of the current')
         call add(header, '" v : open buffer in another window on the right of the current')
+        call add(header, '" X : toggle showing terminal buffers')
     else
     else
         call add(header, '" Press <F1> for Help')
         call add(header, '" Press <F1> for Help')
     endif
     endif