aboutsummaryrefslogtreecommitdiff
path: root/autoload/surround.kak
blob: 5c691ef3eb0effe6f30a970058d48aa6a1855635 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
declare-user-mode surround
declare-user-mode surround-append
declare-user-mode surround-delete
declare-user-mode surround-select
map global user k ': enter-user-mode surround<ret>'
map global surround a ': enter-user-mode surround-append<ret>'
map global surround s ': enter-user-mode surround-select<ret>'

define-command define-surround -params 4 -docstring ': <trigger> <surrounddesc> <start> <end>' %{
  map global surround-append %arg{1} %sh{ echo "i${3}<esc>a${4}" }
  map global surround-delete %arg{1} %sh{ echo "<a-a>${2}<a-S>d," }
  map global surround-select %arg{1} %sh{ echo "<a-a>${2}<a-S>" }
}

define-surround '(' '(' '(' ')'
define-surround '[' '[' '[' ']'
define-surround '{' '{' '{' '}'
define-surround '`' '`' '`' '`'
define-surround '"' '"' '"' '"'
define-surround "'" "'" "'" "'"
define-surround t "c<lt>div,<lt>/div<gt><ret>" "<lt>div<gt>" "<lt>/div<gt>"


# declare-option range-specs ghost_completion;
# add-highlighter global/ replace-ranges ghost_completion

# hook global ModeChange .*:insert:.* %{
#   unset buffer ghost_completion
# }

# map global insert <c-o> '<a-;>: appsugg<ret>'

# def appsugg %{
#   set buffer ghost_completion %val{timestamp} %sh{
#     result=$(ai "$kak_selections")
#     echo -e "$kak_selection_desc|{comment}$result{Default}"
#   }
# }