Skip to content

Instantly share code, notes, and snippets.

@shun-shobon
Last active December 30, 2019 14:11
Show Gist options
  • Select an option

  • Save shun-shobon/017f98c6ed8a8c7b22e74ba1eb6fd0e7 to your computer and use it in GitHub Desktop.

Select an option

Save shun-shobon/017f98c6ed8a8c7b22e74ba1eb6fd0e7 to your computer and use it in GitHub Desktop.
パターンにマッチするコマンドを保存しない
" ヒストリーに保存しないコマンド
let s:histignore = [
\ 'history',
\ 'h\%[elp]',
\ 'qa\?!\?',
\ 'wq\?a\?!\?'
\ ]
function! s:delIgnoreHistory() abort
let l:history = histget(':', -1)
for l:ignore in s:histignore
if l:history =~# '^' . l:ignore . '$'
call histdel(':', -1)
break
endif
endfor
endfunction
autocmd vimrc CmdlineEnter,CmdwinEnter : call s:delIgnoreHistory()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment