vim-fuzzbox/fuzzbox.vim

Current vim session`s command in 'fuzzycmdhistory' has a numeric prefix

Closed this issue · 2 comments

tongap commented

Hi! Great vim9script plugin. I've been using it for about six months.

While working in vim new command (one of the last) has a numeric prefix, it's probably equal to the number of all the commands. After restart vim all is ok

vim version: 9.1.866
fuzzy: 4ca6af5
vimrc:
g:enable_fuzzyy_keymaps = 0
packadd! fuzzyy
nnoremap <silent> <Leader>k :FuzzyCmdHistory<CR>
nnoremap <silent> <Leader>ff <Cmd>FuzzyFiles<CR>
nnoremap <silent> <Leader>fb <Cmd>FuzzyBuffers<CR>

Steps to reproduce:

  1. Run vim
  2. Execute command(s), eg.: junk1, junk2
  3. Execute FuzzyCmdHistory
  4. Type last command

issue_fuzzy1

This should fix it...

diff --git a/autoload/fuzzy/cmdhistory.vim b/autoload/fuzzy/cmdhistory.vim
index daff41c..a54dc47 100644
--- a/autoload/fuzzy/cmdhistory.vim
+++ b/autoload/fuzzy/cmdhistory.vim
@@ -12,7 +12,7 @@ export def Start()
 
     # remove index of command history
     cmds = reduce(cmds,
-       (a, v) => add(a, join(split(v)[1 : ])), [])
+        (a, v) => add(a, substitute(v, '^.*\d\+\s\+', '', '')), [])
 
     var wins = selector.Start(cmds, {
         select_cb:  function('Select'),

But there will still be a bug opening a fuzzyy command from :FuzzyCmdHistory. I can fix it in PR #49 as I'm on a bit of a roll there.

Fixed in PR #49, now merged