File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -2,3 +2,4 @@ include README.rst
22include LICENSE
33recursive-include doc *
44prune doc/_build
5+ include utils/plugin.zsh
Original file line number Diff line number Diff line change 1+ # Z Shell integration for sphinxnotes-snippet
2+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+ #
4+ # :Author: Shengyu Zhang
5+ # :Date: 2021-03-20
6+ # :License: BSD
7+
8+ snippet=" snippet"
9+
10+ # $1: kinds
11+ function snippet_list() {
12+ $snippet list --kinds $1 | \
13+ fzf --with-nth 2.. --no-hscroll --header-lines 1 | \
14+ cut -d ' ' -f1
15+ }
16+
17+ function snippet_view() {
18+ $snippet get --text $( snippet_list c)
19+ }
20+
21+ function snippet_edit() {
22+ $EDITOR $( $snippet get --file $( snippet_list c) )
23+ }
24+
25+ # Define a widget, mapped to our function above.
26+ zle -N snippet_view
27+ zle -N snippet_edit
28+
29+ # Bind it to ctrl-kv
30+ bindkey " ^kv" snippet_view
31+ # Bind it to ctrl-ke
32+ bindkey " ^ke" snippet_edit
33+
34+ # vim: set shiftwidth=2:
You can’t perform that action at this time.
0 commit comments