blob: 9642c96967ecd2bff9b9d16254ee2cdd5354db18 (
plain)
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
colorscheme gruber-darker
add-highlighter global/ number-lines -relative
hook -once global KakBegin .* %{
require-module connect
require-module dtach-repl
# Removed a sh -c.
define-command -override -docstring %{
dtach-repl [<arguments>]: create a new terminal window for repl interaction
All optional parameters are forwarded to the new terminal window
} \
-params .. \
dtach-repl %{ terminal sh -c %{
file="$(mktemp -u -t kak_dtach_repl.XXXXX)"
trap 'rm -f "${file}"' EXIT
printf "evaluate-commands -try-client $1 \
'set-option current dtach_repl_id ${file}'" | kak -p "$2"
shift 2
dtach -c "${file}" -Ez "${@:-$SHELL}"
} -- %val{client} %val{session} %arg{@}
}
# Added bracketed paste support.
define-command -override dtach-send-text -params 0..1 -docstring %{
dtach-send-text [text]: Send text to the REPL.
If no text is passed, then the selection is used
} %{
nop %sh{
printf "\033[200~%s\033[201~\n" "${@:-$kak_selection}" | dtach -p "$kak_opt_dtach_repl_id"
}
}
alias global repl-new dtach-repl
alias global repl-send-text dtach-send-text
}
set-option global toolsclient t
set-option global jumpclient j
set-option global docsclient d
set-option global ui_options terminal_assistant=cat
map -docstring "Jump to next grep match" global goto n <esc>:grep-next-match<ret>
map -docstring "Jump to previous grep match" global goto p <esc>:grep-previous-match<ret>
map -docstring "Jump to next make error" global goto ] <esc>:make-next-error<ret>
map -docstring "Jump to previous make error" global goto [ <esc>:make-previous-error<ret>
hook global RegisterModified '"' %{ nop %sh{
export kak_client_pid="$kak_client_pid"
printf %s "$kak_main_reg_dquote" | vis-clipboard --copy
}}
hook global WinCreate ^[^*]+$ %{
editorconfig-load
map global insert <tab> '<a-;><a-gt>'
map global insert <s-tab> '<a-;><a-lt>'
}
hook global BufSetOption filetype=python %{
set-option buffer formatcmd 'ruff format -'
hook buffer -group format BufWritePost .* format
}
hook global BufSetOption filetype=terraform %{
set-option buffer formatcmd 'terraform fmt -'
hook buffer -group format BufWritePost .* format
}
hook global BufSetOption filetype=go %{
set-option buffer formatcmd 'gofumpt | goimports'
set-option global make_error_pattern '^\s*([^:\n]+):(\d+):?(?:(\d+):)? ?([^\n]+)?'
hook buffer -group format BufWritePost .* format
}
hook global BufSetOption filetype=sh %{
set-option window lintcmd "shellcheck -fgcc -Cnever"
}
define-command delete-buffers-matching -params 1..2 %{
evaluate-commands %sh{
cmd=delete-buffer
if [ "$1" = -f ]
then cmd=delete-buffer!
shift
fi
buffers_escaped=$(eval printf '%s\\n' "$kak_quoted_buflist" | grep "$@" | sed "s/'/''/g")
if [ -z "$buffers_escaped" ]
then echo fail no matching buffer
else {
nl=$(printf '\n.')
IFS=${nl%.}
printf '%s\n' "$buffers_escaped" |
while read bufname
do {
printf "$cmd '%s'\n" "$bufname"
}; done
} fi
}
}
map global user b ':enter-buffers-mode<ret>' -docstring 'buffers…'
map global user B ':enter-user-mode -lock buffers<ret>' -docstring 'buffers (lock)…'
# Suggested aliases
alias global bd delete-buffer
alias global bf buffer-first
alias global bl buffer-last
alias global bo buffer-only
alias global bo! buffer-only-force
define-command -override -params 1 C %{
execute-keys %sh{
printf "%s" "<esc>:cd "
printenv "${@}"
printf "%s" "<ret>"
}
}
map global user C "<esc>:C "
define-command -override el %{
execute-keys %sh{
printf "%s" "<esc>:e $(realpath --relative-to "$PWD" "${kak_buffile%/*}")/"
}
}
map global user e "<esc>:el<ret>"
define-command -override cdl %{
execute-keys %sh{
printf "%s" "<esc>:cd $(realpath --relative-to "$PWD" "${kak_buffile%/*}")/"
}
}
map global user c "<esc>:cdl<ret>"
map global user f "<esc>:> lf<ret>"
|