Skip to content

Commit 53fe6ad

Browse files
committed
integration: No need to record commmand history
1 parent 50b8282 commit 53fe6ad

File tree

3 files changed

+11
-15
lines changed

3 files changed

+11
-15
lines changed

sphinxnotes/snippet/integration/binding.sh

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# :Author: Shengyu Zhang
55
# :Date: 2021-08-114
6-
# :Version: 20210814
6+
# :Version: 20211114
77
#
88
# .. note:: Must source :file:`./plugin.sh` to get `snippet_list` functions.
99

@@ -22,16 +22,15 @@ function snippet_url() {
2222
}
2323

2424
function snippet_sh_bind_wrapper() {
25-
READLINE_LINE="$($1)"
26-
READLINE_POINT=${#READLINE_LINE}
25+
cmd=$($1)
26+
if [ ! -z "$cmd" ]; then
27+
eval "$cmd"
28+
fi
2729
}
2830

2931
function snippet_sh_do_bind() {
30-
bind '"\XXacceptline": accept-line'
31-
bind -x '"\XXsnippetedit": snippet_sh_bind_wrapper snippet_edit'
32-
bind -x '"\XXsnippeturl": snippet_sh_bind_wrapper snippet_url'
33-
bind '"\C-ke": "\XXsnippetedit\XXacceptline"'
34-
bind '"\C-ku": "\XXsnippeturl\XXacceptline"'
32+
bind -x '"\C-ke": snippet_sh_bind_wrapper snippet_edit'
33+
bind -x '"\C-ku": snippet_sh_bind_wrapper snippet_url'
3534
}
3635

3736
# Bind key if bind command exists

sphinxnotes/snippet/integration/binding.zsh

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,12 @@
33
#
44
# :Author: Shengyu Zhang
55
# :Date: 2021-04-12
6-
# :Version: 20210814
6+
# :Version: 20211114
77

88
# $1: One of snippet_* functions
99
function snippet_z_bind_wrapper() {
10-
cmd=$($1)
11-
if [ ! -z "$cmd" ]; then
12-
BUFFER="$cmd"
13-
zle accept-line
14-
fi
10+
snippet_sh_bind_wrapper $1
11+
zle redisplay
1512
}
1613

1714
function snippet_z_edit() {

sphinxnotes/snippet/integration/plugin.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# :Author: Shengyu Zhang
55
# :Date: 2021-03-20
6-
# :Version: 20210814
6+
# :Version: 20211114
77

88
# Make sure we have $SNIPPET
99
[ -z "$SNIPPET"] && SNIPPET='snippet'

0 commit comments

Comments
 (0)