2021-09-29 21:11:33 +00:00
|
|
|
# Color scheme
|
2022-04-27 18:56:29 +00:00
|
|
|
colorscheme github
|
2022-05-06 17:40:27 +00:00
|
|
|
face global Default rgb:121213,default
|
|
|
|
face global BufferPadding rgb:A0A0A0,default
|
2021-09-29 21:11:33 +00:00
|
|
|
face global MenuForeground blue,white+bF
|
|
|
|
face global MenuBackground bright-blue,white+F
|
2022-05-06 17:40:27 +00:00
|
|
|
face global Information bright-blue,white
|
|
|
|
# Markdown help color scheme
|
|
|
|
face global InfoDefault Information
|
|
|
|
face global InfoBlock @block
|
|
|
|
face global InfoBlockQuote +i@block
|
|
|
|
face global InfoBullet @bullet
|
|
|
|
face global InfoHeader @header
|
|
|
|
face global InfoLink @link
|
|
|
|
face global InfoLinkMono +b@mono
|
|
|
|
face global InfoMono @mono
|
|
|
|
face global InfoRule +b@Information
|
|
|
|
face global InfoDiagnosticError @DiagnosticError
|
|
|
|
face global InfoDiagnosticHint @DiagnosticHint
|
|
|
|
face global InfoDiagnosticInformation @Information
|
|
|
|
face global InfoDiagnosticWarning @DiagnosticWarning
|
|
|
|
# Extra faces
|
|
|
|
face global macro +b@function
|
|
|
|
face global method +i@function
|
|
|
|
face global format_specifier +i@string
|
|
|
|
face global mutable_variable +u@variable
|
|
|
|
face global class +b@variable
|
2021-09-29 21:11:33 +00:00
|
|
|
|
|
|
|
# Enable line numbers
|
|
|
|
addhl global/ number-lines
|
|
|
|
|
|
|
|
set global grepcmd "rg --line-number --no-column --no-heading --color=never ''"
|
|
|
|
|
|
|
|
# Floating terminal
|
|
|
|
# define-command floating-terminal -params 1 -docstring "Open a floating terminal running the given command" %{
|
|
|
|
# evaluate-commands -save-regs 'a' %{
|
|
|
|
# set-register a %arg{@}
|
|
|
|
# evaluate-commands %sh{
|
|
|
|
# alacritty \
|
|
|
|
# --class=alacritty,floating \
|
|
|
|
# -o window.dimensions.lines=24 \
|
|
|
|
# -o window.dimensions.columns=120 \
|
|
|
|
# -e sh -c "$kak_quoted_reg_a" < /dev/null > /dev/null 2>&1 &
|
|
|
|
# }
|
|
|
|
# }
|
|
|
|
# }
|
2022-06-10 17:41:53 +00:00
|
|
|
# map global user t -docstring "Open a side terminal on the current directory" ' :iterm-terminal-horizontal fish<ret>'
|
2021-09-29 21:11:33 +00:00
|
|
|
|
|
|
|
# Comment line and block
|
|
|
|
map global normal <#> ': comment-line<ret>'
|
|
|
|
map global normal <a-#> ': comment-block<ret>'
|
|
|
|
|
|
|
|
# Go to grep-jump
|
2022-01-30 18:49:25 +00:00
|
|
|
map global goto f -docstring "current grep-jump match" '<esc>: grep-jump<ret>'
|
2021-09-29 21:11:33 +00:00
|
|
|
|
|
|
|
# System clipboard interactions
|
|
|
|
hook global RegisterModified '"' %{ nop %sh{
|
2022-04-20 17:05:02 +00:00
|
|
|
printf "%s" "$kak_main_reg_dquote" | pbcopy >/dev/null 2>/dev/null &
|
2021-09-29 21:11:33 +00:00
|
|
|
}}
|
|
|
|
map global user P -docstring "Paste before cursor from clipboard" '! pbpaste<ret>'
|
|
|
|
map global user p -docstring "Paste after cursor from clipboard" '<a-!> pbpaste<ret>'
|
|
|
|
map global user R -docstring "Replace selection with text from clipboard" '<a-d>! pbpaste<ret>'
|
|
|
|
define-command -params 0 -docstring "Copy line down" copyline %{
|
2022-04-20 17:05:02 +00:00
|
|
|
execute-keys -draft 'xy'%val{count}'P'
|
2021-09-29 21:11:33 +00:00
|
|
|
}
|
|
|
|
map global normal <+> -docstring "Copy line down" ': copyline<ret>'
|
|
|
|
define-command -params 0 -docstring "Delete current character" delete-one %{
|
|
|
|
execute-keys 'm<a-:>'
|
|
|
|
execute-keys -draft '<a-S>d'
|
|
|
|
execute-keys 'H'
|
|
|
|
}
|
|
|
|
map global normal D ": delete-one<ret>"
|
|
|
|
|
|
|
|
# Disable write-to
|
|
|
|
# unalias global w
|
|
|
|
# define-command -params 0 -docstring "Writes the current file" w "write"
|
|
|
|
|
|
|
|
# Tab sizes
|
|
|
|
hook global InsertChar \t %{ exec -draft -itersel h@ }
|
|
|
|
set global tabstop 4
|
|
|
|
set global indentwidth 4
|
2021-11-03 22:42:02 +00:00
|
|
|
hook global WinSetOption filetype=(c|cpp|haskell|nix|yaml) %{
|
2021-09-29 21:11:33 +00:00
|
|
|
set global tabstop 2
|
|
|
|
set global indentwidth 2
|
|
|
|
}
|
|
|
|
|
|
|
|
# Ctrl + a in insert mode = esc
|
|
|
|
map global insert <c-a> '<esc>'
|
|
|
|
|
|
|
|
# Tab completion
|
|
|
|
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 global InsertCompletionHide .* %{
|
|
|
|
unmap window insert <tab> <c-n>
|
|
|
|
unmap window insert <s-tab> <c-p>
|
|
|
|
}
|
|
|
|
|
|
|
|
# Enable LSP
|
|
|
|
try %{
|
|
|
|
eval %sh{test -z "$WE_STARTED_KAK" && kak-lsp --kakoune -s $kak_session}
|
|
|
|
}
|
2021-10-29 04:25:58 +00:00
|
|
|
hook global WinSetOption filetype=(racket|rust|python|go|javascript|typescript|c|cpp|tex|latex|fsharp|ocaml|haskell|nix) %{
|
2021-09-29 21:11:33 +00:00
|
|
|
lsp-enable-window
|
|
|
|
map global normal <c-l> ": enter-user-mode lsp<ret>"
|
|
|
|
lsp-auto-hover-enable
|
|
|
|
# lsp-auto-hover-insert-mode-enable
|
2022-05-12 22:57:09 +00:00
|
|
|
set window lsp_hover_anchor true
|
2021-09-29 21:11:33 +00:00
|
|
|
}
|
2022-01-12 20:55:53 +00:00
|
|
|
hook global WinSetOption filetype=(racket|rust|python|go|javascript|typescript|c|cpp|tex|latex|haskell|nix) %{
|
2021-09-29 21:11:33 +00:00
|
|
|
# Format the document if possible
|
2022-01-30 18:51:08 +00:00
|
|
|
hook window BufWritePre .* %{ lsp-formatting-sync }
|
2021-09-29 21:11:33 +00:00
|
|
|
}
|
|
|
|
|
2022-05-12 22:57:09 +00:00
|
|
|
hook global WinSetOption filetype=(rust) %{
|
|
|
|
# Enable inlay hints
|
|
|
|
lsp-inlay-hints-enable window
|
|
|
|
}
|
|
|
|
|
2022-05-06 17:40:27 +00:00
|
|
|
hook global WinSetOption filetype=(rust|go|fsharp) %{
|
2021-09-29 21:11:33 +00:00
|
|
|
hook window -group semantic-tokens BufReload .* lsp-semantic-tokens
|
|
|
|
hook window -group semantic-tokens NormalIdle .* lsp-semantic-tokens
|
|
|
|
hook window -group semantic-tokens InsertIdle .* lsp-semantic-tokens
|
|
|
|
hook -once -always window WinSetOption filetype=.* %{
|
|
|
|
remove-hooks window semantic-tokens
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# <a-a> in Insert mode moves to end of line.
|
|
|
|
map global insert <a-a> '<esc>A'
|
|
|
|
|
2022-05-12 22:57:09 +00:00
|
|
|
hook global WinSetOption filetype=(fsharp) %{
|
|
|
|
set-option window comment_line "//"
|
|
|
|
# Set up formatting
|
|
|
|
set-option window formatcmd "~/.dotnet/tools/fantomas --stdin --stdout"
|
|
|
|
hook window -group fsharp-format BufWritePre .* %{ format }
|
2021-09-29 21:11:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
hook global WinSetOption filetype=(ocaml) %{
|
|
|
|
unset-option buffer comment_line
|
|
|
|
set-option buffer comment_block_begin "(*"
|
|
|
|
set-option buffer comment_block_end "*)"
|
|
|
|
}
|
|
|
|
|
|
|
|
hook global WinSetOption filetype=(haskell) %{
|
|
|
|
set-option buffer makecmd "cabal build"
|
|
|
|
}
|
|
|
|
|
|
|
|
hook global WinSetOption filetype=(rust) %{
|
|
|
|
set-option buffer makecmd "cargo check"
|
|
|
|
}
|
|
|
|
|
|
|
|
def -hidden insert-c-n %{
|
|
|
|
try %{
|
|
|
|
lsp-snippets-select-next-placeholders
|
|
|
|
exec '<a-;>d'
|
|
|
|
} catch %{
|
|
|
|
exec -with-hooks '<c-n>'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
map global insert <c-n> "<a-;>: insert-c-n<ret>"
|
|
|
|
|
|
|
|
# Use C++ for .h headers
|
|
|
|
hook global BufCreate .*[.](h) %{
|
|
|
|
set-option buffer filetype cpp
|
|
|
|
}
|
|
|
|
|
|
|
|
hook global BufCreate .*[.]kakrc %{
|
|
|
|
set-option buffer filetype kak
|
|
|
|
}
|
|
|
|
|
|
|
|
hook global BufCreate .*[.]md %{
|
|
|
|
add-highlighter buffer/ wrap
|
|
|
|
}
|
|
|
|
|
|
|
|
hook global BufOpenFile .* %{
|
|
|
|
modeline-parse
|
|
|
|
}
|
|
|
|
|
|
|
|
map global normal <a-[> ':inc-dec-modify-numbers + %val{count}<ret>'
|
|
|
|
map global normal <a-]> ':inc-dec-modify-numbers - %val{count}<ret>'
|
2022-06-02 20:11:48 +00:00
|
|
|
|
|
|
|
# Discord integration
|
|
|
|
discord-presence-enable
|