Last active
December 18, 2015 23:49
-
-
Save mattn/5864587 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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