Create a gist now

Instantly share code, notes, and snippets.

@mattn /h.vim
Last active Dec 18, 2015

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