summaryrefslogtreecommitdiff
path: root/plugins/zsh-navigation-tools/n-history
diff options
context:
space:
mode:
authorpsprint <sgniazdowski@gmail.com>2016-11-02 13:08:58 +0100
committerMarc Cornellà <marc.cornella@live.com>2016-11-02 13:08:58 +0100
commit73591101b6db1e67ad3a0c2f90c81bc8174f4056 (patch)
treeb4439737be96f0a715b5e1f87f07a0fcc1a6e557 /plugins/zsh-navigation-tools/n-history
parent0f62b7a8d8708910e75fedb9d7b8e3d8559a34da (diff)
downloadzsh-73591101b6db1e67ad3a0c2f90c81bc8174f4056.tar.gz
zsh-73591101b6db1e67ad3a0c2f90c81bc8174f4056.tar.bz2
zsh-73591101b6db1e67ad3a0c2f90c81bc8174f4056.zip
znt: Update to v2.2.7 (#5576)
Diffstat (limited to 'plugins/zsh-navigation-tools/n-history')
-rw-r--r--plugins/zsh-navigation-tools/n-history32
1 files changed, 24 insertions, 8 deletions
diff --git a/plugins/zsh-navigation-tools/n-history b/plugins/zsh-navigation-tools/n-history
index af475dcb8..b425ecd10 100644
--- a/plugins/zsh-navigation-tools/n-history
+++ b/plugins/zsh-navigation-tools/n-history
@@ -307,7 +307,7 @@ while (( 1 )); do
elif [ "$active_view" = "1" ]; then
if [ -s "$private_history_db" ]; then
local title=$'\x1b[00;32m'"Private history:"$'\x1b[00;00m\0'
- () { fc -ap -R "$private_history_db"; list=( "$title" ${history[@]} ) }
+ () { fc -Rap "$private_history_db" 20000 0; list=( "$title" ${history[@]} ) }
else
list=( "Private history - history entries selected via this tool will be put here" )
fi
@@ -335,21 +335,37 @@ done
if [ "$REPLY" -gt 0 ]; then
selected="$reply[REPLY]"
+
+ # Append to private history
+ if [[ "$active_view" = "0" ]]; then
+ local newline=$'\n'
+ local selected_ph="${selected//$newline/\\$newline}"
+ print -r -- "$selected_ph" >> "$private_history_db"
+ fi
+
+ # TMUX?
+ if [[ "$ZNT_TMUX_MODE" = "1" ]]; then
+ tmux send -t "$ZNT_TMUX_ORIGIN_SESSION:$ZNT_TMUX_ORIGIN_WINDOW.$ZNT_TMUX_ORIGIN_PANE" "$selected"
+ tmux kill-window
+ return 0
# ZLE?
- if [ "${(t)CURSOR}" = "integer-local-special" ]; then
+ elif [ "${(t)CURSOR}" = "integer-local-special" ]; then
zle .redisplay
zle .kill-buffer
LBUFFER+="$selected"
-
- # Append to private history
- local newline=$'\n'
- selected="${selected//$newline/\\$newline}"
- [ "$active_view" = "0" ] && print -r -- "$selected" >> "$private_history_db"
else
print -zr -- "$selected"
fi
else
- [ "${(t)CURSOR}" = "integer-local-special" ] && zle redisplay
+ # TMUX?
+ if [[ "$ZNT_TMUX_MODE" = "1" ]]; then
+ tmux kill-window
+ # ZLE?
+ elif [[ "${(t)CURSOR}" = "integer-local-special" ]]; then
+ zle redisplay
+ fi
fi
+return 0
+
# vim: set filetype=zsh: