From 92397cf7070653ba5a06abfa5778cbc8b51b40cd Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Wed, 8 Aug 2012 21:39:40 -0500 Subject: make editing files in vim add to zsh history --- zshrc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'zshrc') diff --git a/zshrc b/zshrc index 260d1d6..b7c4c49 100644 --- a/zshrc +++ b/zshrc @@ -22,6 +22,22 @@ case ${TERM} in esac # }}} # aliases {{{ [ -f "$HOME/.aliases" ] && source $HOME/.aliases +function vim { + local zsh_hist_fname + zsh_hist_fname=$HOME/.vim/hist$$ + command vim --cmd "let g:_zsh_hist_fname = '$zsh_hist_fname'" "$@" + if [[ -r $zsh_hist_fname ]]; then + while read line; do + if echo $line | grep -q "[[:space:]']"; then + line=${line/\'/\'\\\\\'\'} + line="'$line'" + fi + print -s "vim $line" + done < $zsh_hist_fname + fc -AI + rm -f $zsh_hist_fname + fi +} # }}} # external files {{{ source ~/.zshcomplete -- cgit v1.2.3-54-g00ecf