Skip to content

Instantly share code, notes, and snippets.

@mattn
Last active December 18, 2015 23:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattn/5864587 to your computer and use it in GitHub Desktop.
Save mattn/5864587 to your computer and use it in GitHub Desktop.
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>)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment