diff options
author | Jesse Luehrs <doy@tozt.net> | 2012-08-08 21:39:40 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2012-08-08 22:10:00 -0500 |
commit | 92397cf7070653ba5a06abfa5778cbc8b51b40cd (patch) | |
tree | 92648d77ae9d68398bc3637c569f77d20b3ed1c5 /zshrc | |
parent | 23fe370756678a4a2d36943c96e27ccd452ecdc9 (diff) | |
download | conf-92397cf7070653ba5a06abfa5778cbc8b51b40cd.tar.gz conf-92397cf7070653ba5a06abfa5778cbc8b51b40cd.zip |
make editing files in vim add to zsh history
Diffstat (limited to 'zshrc')
-rw-r--r-- | zshrc | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -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 |