From d50dd19f6f93becacf30419695e21200dc210a34 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Thu, 8 Mar 2018 02:40:01 -0500 Subject: initial implementation --- sh/history-sync.zsh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 sh/history-sync.zsh (limited to 'sh') diff --git a/sh/history-sync.zsh b/sh/history-sync.zsh new file mode 100644 index 0000000..586417f --- /dev/null +++ b/sh/history-sync.zsh @@ -0,0 +1,17 @@ +mkdir -p $HOME/.cache/vim/hist +function vim { + local zsh_hist_fname + zsh_hist_fname=$HOME/.cache/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 +} -- cgit v1.2.3-54-g00ecf