不幸的是,答案是否定的。但是如果您允许将其放入H您的打字命令中,那么这也许是可能的。这个怎么样?
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>)
Run Code Online (Sandbox Code Playgroud)
将此文件作为 ~/.vim/plugin/h.vim 放入
:H buffers
Run Code Online (Sandbox Code Playgroud)
这没有存储在 中:history,但是
:H ls
Run Code Online (Sandbox Code Playgroud)
这将被存储。