kak and niri

This commit is contained in:
Charlie Root 2025-03-12 19:08:13 +01:00
commit a7b0020125
Signed by: faukah
SSH key fingerprint: SHA256:Uj2AXqvtdCA4hn5Hq0ZonhIAyUqI1q4w2sMG3Z1TH7E
3 changed files with 550 additions and 0 deletions

75
kak/kakrc Normal file
View file

@ -0,0 +1,75 @@
# some usable colorscheme
colorscheme gruvbox-dark
# line numbers
add-highlighter global/ number-lines -hlcursor -relative -separator " " -cursor-separator " |"
# show matching parens
add-highlighter global/ show-matching
set-option global tabstop 4
set-option global indentwidth 4
# show trailing whitespace
add-highlighter global/ regex \h+$ 0:Error
# softwrap long lines
add-highlighter global/ wrap -word -indent
# no terminal assistant
set global ui_options terminal_assistant=none terminal_enable_mouse=false
# tab completions
hook global InsertCompletionShow .* %{
try %{
# this command temporarily removes cursors preceded by whitespace;
# if there are no cursors left, it raises an error, does not
# continue to execute the mapping commands, and the error is eaten
# by the `try` command so no warning appears.
execute-keys -draft 'h<a-K>\h<ret>'
map window insert <tab> <c-n>
map window insert <s-tab> <c-p>
hook -once -always window InsertCompletionHide .* %{
unmap window insert <tab> <c-n>
unmap window insert <s-tab> <c-p>
}
}
}
# lsp
eval %sh{kak-lsp}
lsp-enable
lsp-auto-signature-help-enable
lsp-auto-hover-enable
lsp-auto-hover-insert-mode-enable
map global user l ':enter-user-mode lsp<ret>' -docstring 'LSP mode'
map global insert <tab> '<a-;>:try lsp-snippets-select-next-placeholders catch %{ execute-keys -with-hooks <lt>tab> }<ret>' -docstring 'Select next snippet placeholder'
map global object a '<a-semicolon>lsp-object<ret>' -docstring 'LSP any symbol'
map global object <a-a> '<a-semicolon>lsp-object<ret>' -docstring 'LSP any symbol'
map global object f '<a-semicolon>lsp-object Function Method<ret>' -docstring 'LSP function or method'
map global object t '<a-semicolon>lsp-object Class Interface Struct<ret>' -docstring 'LSP class interface or struct'
map global object d '<a-semicolon>lsp-diagnostic-object --include-warnings<ret>' -docstring 'LSP errors and warnings'
map global object D '<a-semicolon>lsp-diagnostic-object<ret>' -docstring 'LSP errors'
# copy to device clipboard
hook global RegisterModified '"' %{ nop %sh{
wl-copy -- "$kak_main_reg_dquote" 2> /dev/null;
}}
# plugins
source "%val{config}/plugins/plug.kak/rc/plug.kak"
plug "andreyorst/plug.kak" noload
plug "andreyorst/fzf.kak"
map global user f ': fzf-mode<ret>' -docstring 'fzf mode'
# # custom plugins
# source ~/.config/kak/tv/tv.kak

32
kak/tv/tv.kak Normal file
View file

@ -0,0 +1,32 @@
# define-command run-tv %{ evaluate-commands %sh{
# # Create a temporary fifo for communication
# tv_tmp="$(mktemp -d "${TMPDIR:-/tmp}"/tv.kak.XXXXXX)"
# tv_out="${tv_tmp}/tvcmd"
# result="${tv_tmp}/result"
# mkfifo ${tv_out}
# # run command detached from the shell
# { tv > ${tv_out} } > /dev/null 2>&1 < /dev/null &
# # Open the file in Kakoune and add a hook to remove the fifo
# echo "edit! -fifo ${tv_out} *buffer-name*
# hook buffer BufClose .* %{ nop %sh{ rm -r $(dirname ${tv_tmp})} }"
# }
# }
#
#
define-command bla %{ evaluate-commands %sh{
# Create a temporary fifo for communication
output=$(mktemp -d -t kak-temp-XXXXXXXX)/fifo
mkfifo ${output}
# run command detached from the shell
{ lazygit > ${output} } > /dev/null 2>&1 < /dev/null &
# Open the file in Kakoune and add a hook to remove the fifo
echo "edit! -fifo ${output} *buffer-name*
hook buffer BufClose .* %{ nop %sh{ rm -r $(dirname ${output})} }"
} }