Is there an option similar to Bash's HISTIGNORE to dump some useless lines from the command history (let's say :wq
or :help.*
)?
If not, I reckon a simple DIY way would be to parse manually the .viminfo
file with a regex predicate. Is there a specific VIM linking that could sync the parsing with a change in the .viminfo
file ?
Unfortunately, answer is No. But if you allow put H
into your typing commands, it maybe possible. How about this?
https://gist.github.com/5864587
let g:histignore = '^buf:^history'
function! s:h(commandline)
call histdel(':', '^H\s')
let oldhist=&history
try
if len(filter(split(g:histignore, ':'), 'a:commandline =~ v:val')) == 0
call histadd(':', a:commandline)
endif
set history=0
exe a:commandline
catch
echohl ErrorMsg | echomsg v:exception | echohl None
finally
let &history=oldhist
unlet oldhist
endtry
endfunction
command! -nargs=+ H call s:h(<q-args>)
Put into this file as your ~/.vim/plugin/h.vim
:H buffers
This is not stored in :history
, But
:H ls
This will be stored.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With