File tree Expand file tree Collapse file tree 3 files changed +11
-15
lines changed
sphinxnotes/snippet/integration Expand file tree Collapse file tree 3 files changed +11
-15
lines changed Original file line number Diff line number Diff line change 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
2424function 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
2931function 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
Original file line number Diff line number Diff line change 33#
44# :Author: Shengyu Zhang
55# :Date: 2021-04-12
6- # :Version: 20210814
6+ # :Version: 20211114
77
88# $1: One of snippet_* functions
99function 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
1714function snippet_z_edit() {
Original file line number Diff line number Diff line change 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'
You can’t perform that action at this time.
0 commit comments