Wikia

Vim Tips Wiki

Script:107

Talk0
1,613pages on
this wiki
Revision as of 23:43, April 18, 2012 by JohnBeckett (Talk | contribs)

Use this page to discuss script 107 SelectBuf: fast and extensible buffer explorer

  • Add constructive comments, bug reports, or discuss improvements (see the guideline).
  • Do not document the script here (the author should do that on vim.org).
  • This page may be out of date: check the script's vim.org page above, and its release notes.

Fixes

This is a great script. Over time I acumulated two fixes and cannot reach original author.

Stop screen jumping when entering buffer number:

--- autoload/selectbuf.vim      (revision 4183)
+++ autoload/selectbuf.vim      (revision 4184)
@@ -1836,14 +1836,6 @@
 endfunction " }}}
 
 function! s:InputBufNumber() " {{{
-  " Generate a line with spaces to clear the previous message.
-  let i = 1
-  let clearLine = "\r"
-  while i < &columns
-    let clearLine = clearLine . ' '
-    let i = i + 1
-  endwhile
-
   let bufNr = ''
   let abort = 0
   call s:Prompt(bufNr)
@@ -1868,7 +1860,6 @@
     else
       let bufNr = bufNr . char
     endif
-    echon clearLine
     call s:Prompt(bufNr)
   endwhile
   if !abort && bufNr != ''
@@ -1877,7 +1868,8 @@
 endfunction
 
 function! s:Prompt(bufNr)
-  echon "\rEnter Buffer Number: " . a:bufNr
+  redraw
+  echon "Enter Buffer Number: " . a:bufNr
 endfunction " }}}
 
 let s:mySNR = ''

Stop error message when you edit new (nonexisting) file and immediately you run :e to reopen it:

--- autoload/selectbuf.vim      (revision 4223)
+++ autoload/selectbuf.vim      (revision 4224)
@@ -1660,7 +1660,10 @@
     return
   endif
 
-  call remove(g:SB_MRUlist, index(g:SB_MRUlist, a:bufNum))
+  let l:pos = index(g:SB_MRUlist, a:bufNum)
+  if l:pos != -1
+    call remove(g:SB_MRUlist, l:pos)
+  endif
   call insert(g:SB_MRUlist, a:bufNum, 0)
   if s:GetSortNameByType(g:selBufDefaultSortOrder) ==# 'mru'
     call s:DynUpdate('m', a:bufNum + 0, !a:updImm)

--April 18, 2012

Comments

Around Wikia's network

Random Wiki