diff --git a/kak-lsp/kak-lsp.toml b/kak-lsp/kak-lsp.toml new file mode 100644 index 0000000..d7a8d09 --- /dev/null +++ b/kak-lsp/kak-lsp.toml @@ -0,0 +1,374 @@ +snippet_support = false +verbosity = 2 + +[server] +# exit session if no requests were received during given period in seconds +# works only in unix sockets mode (-s/--session) +# set to 0 to disable +timeout = 1800 # seconds = 30 minutes + +[language.bash] +filetypes = ["sh"] +roots = [".git", ".hg"] +command = "bash-language-server" +args = ["start"] + +[language.dhall] +filetypes = ["dhall"] +roots = [".git", ".hg"] +command = "dhall-lsp-server" + +[language.c_cpp] +filetypes = ["c", "cpp"] +roots = ["compile_commands.json", ".clangd", ".git", ".hg"] +command = "clangd" + +[language.crystal] +filetypes = ["crystal"] +roots = ["shard.yml"] +command = "scry" + +[language.css] +filetypes = ["css"] +roots = ["package.json", ".git", ".hg"] +command = "css-languageserver" +args = ["--stdio"] + +[language.less] +filetypes = ["less"] +roots = ["package.json", ".git", ".hg"] +command = "css-languageserver" +args = ["--stdio"] + +[language.scss] +filetypes = ["scss"] +roots = ["package.json", ".git", ".hg"] +command = "css-languageserver" +args = ["--stdio"] + +[language.d] +filetypes = ["d", "di"] +roots = [".git", "dub.sdl", "dub.json"] +command = "dls" + +[language.dart] +# start shell to find path to dart analysis server source +filetypes = ["dart"] +roots = ["pubspec.yaml", ".git", ".hg"] +command = "sh" +args = ["-c", "dart $(dirname $(command -v dart))/snapshots/analysis_server.dart.snapshot --lsp"] + +[language.elixir] +filetypes = ["elixir"] +roots = ["mix.exs"] +command = "elixir-ls" +settings_section = "elixirLS" +[language.elixir.settings.elixirLS] +# See https://github.com/elixir-lsp/elixir-ls/blob/master/apps/language_server/lib/language_server/server.ex +# dialyzerEnable = true + +[language.elm] +filetypes = ["elm"] +roots = ["elm.json"] +command = "elm-language-server" +args = ["--stdio"] +settings_section = "elmLS" +[language.elm.settings.elmLS] +# See https://github.com/elm-tooling/elm-language-server#server-settings +runtime = "node" +elmPath = "elm" +elmFormatPath = "elm-format" +elmTestPath = "elm-test" + +[language.erlang] +filetypes = ["erlang"] +# See https://github.com/erlang-ls/erlang_ls.git for more information and +# how to configure. This default config should work in most cases though. +roots = ["rebar.config", "erlang.mk", ".git", ".hg"] +command = "erlang_ls" + +[language.go] +filetypes = ["go"] +roots = ["Gopkg.toml", "go.mod", ".git", ".hg"] +command = "gopls" +settings_section = "gopls" +[language.go.settings.gopls] +# See https://github.com/golang/tools/blob/master/gopls/doc/settings.md +# "build.buildFlags" = [] +[language.haskell] +filetypes = ["haskell"] +roots = ["Setup.hs", "stack.yaml", "*.cabal"] +command = "haskell-language-server-wrapper" +args = ["--lsp"] +settings_section = "_" +[language.haskell.settings._] +# See https://haskell-language-server.readthedocs.io/en/latest/configuration.html +# # haskell.formattingProvider = "ormolu" + +[language.html] +filetypes = ["html"] +roots = ["package.json"] +command = "html-languageserver" +args = ["--stdio"] + +# Commented out by default because you still need to set the paths in the JDT +# Language Server arguments below before this can become a valid configuration. +[language.java] +filetypes = ["java"] +roots = [".git", "mvnw", "gradlew"] +command = "eclipse-jdt-ls" +[language.java.settings] +# See https://github.dev/eclipse/eclipse.jdt.ls +java.format.insertSpaces = true + +[language.javascript] +filetypes = ["javascript"] +roots = [".flowconfig"] +command = "flow" +args = ["lsp"] + +[language.json] +filetypes = ["json"] +roots = ["package.json"] +command = "json-languageserver" +args = ["--stdio"] + +# Requires Julia package "LanguageServer" # Run: `julia --project=@kak-lsp -e 'import Pkg; Pkg.add("LanguageServer")'` to install it +# Configuration adapted from https://github.com/neovim/nvim-lspconfig/blob/bcebfac7429cd8234960197dca8de1767f3ef5d3/lua/lspconfig/julials.lua +[language.julia] +filetypes = ["julia"] +roots = ["Project.toml", ".git", ".hg"] +command = "julia" +args = [ + "--startup-file=no", + "--history-file=no", + "-e", + """ + ls_install_path = joinpath(get(DEPOT_PATH, 1, joinpath(homedir(), ".julia")), "environments", "kak-lsp"); + pushfirst!(LOAD_PATH, ls_install_path); + using LanguageServer; + popfirst!(LOAD_PATH); + depot_path = get(ENV, "JULIA_DEPOT_PATH", ""); + buffer_file = ENV["kak_buffile"]; + project_path = let + dirname(something( + # 1. Check if there is an explicitly set project + Base.load_path_expand(( + p = get(ENV, "JULIA_PROJECT", nothing); + p === nothing ? nothing : isempty(p) ? nothing : p + )), + # 2. Check for Project.toml in current working directory + Base.current_project(pwd()), + # 3. Check for Project.toml from buffer's full file path excluding the file name + Base.current_project(dirname(buffer_file)), + # 4. Fallback to global environment + Base.active_project() + )) + end + server = LanguageServer.LanguageServerInstance(stdin, stdout, project_path, depot_path); + server.runlinter = true; + run(server); + """, +] +[language.julia.settings] +# See https://github.com/julia-vscode/LanguageServer.jl/blob/master/src/requests/workspace.jl +# Format options. See https://github.com/julia-vscode/DocumentFormat.jl/blob/master/src/DocumentFormat.jl +# "julia.format.indent" = 4 +# Lint options. See https://github.com/julia-vscode/StaticLint.jl/blob/master/src/linting/checks.jl +# "julia.lint.call" = true +# Other options, see https://github.com/julia-vscode/LanguageServer.jl/blob/master/src/requests/workspace.jl +# "julia.lint.run" = "true" + +[language.latex] +filetypes = ["latex"] +roots = [".git", ".hg"] +command = "texlab" +settings_section = "texlab" +[language.latex.settings.texlab] +# See https://github.com/latex-lsp/texlab/blob/master/docs/options.md +# +# Preview configuration for zathura with SyncTeX search. +# For other PDF viewers see https://github.com/latex-lsp/texlab/blob/master/docs/previewing.md +forwardSearch.executable = "zathura" +forwardSearch.args = [ + "%p", + "--synctex-forward", # Support texlab-forward-search + "%l:1:%f", + "--synctex-editor-command", # Inverse search: use Control+Left-Mouse-Button to jump to source. + """ + sh -c ' + echo " + evaluate-commands -client %opt{texlab_client} %{ + evaluate-commands -try-client %opt{jumpclient} %{ + edit -- %{input} %{line} + } + } + " | kak -p $kak_session + ' + """, +] + +[language.lua] +filetypes = ["lua"] +roots = [".git", ".hg"] +command = "lua-language-server" +[language.lua.settings.Lua] +# See https://github.com/sumneko/vscode-lua/blob/master/setting/schema.json +# diagnostics.enable = true + +[language.nim] +filetypes = ["nim"] +roots = ["*.nimble", ".git", ".hg"] +command = "nimlsp" + +[language.nix] +filetypes = ["nix"] +roots = ["flake.nix", "shell.nix", ".git", ".hg"] +command = "rnix-lsp" + +[language.ocaml] +filetypes = ["ocaml"] +roots = ["Makefile", "opam", "*.opam", "dune"] +command = "ocamllsp" + +[language.php] +filetypes = ["php"] +roots = [".htaccess", "composer.json"] +command = "intelephense" +args = ["--stdio"] +settings_section = "intelephense" +[language.php.settings] +intelephense.storagePath = "/tmp/intelephense" + +[language.python] +filetypes = ["python"] +roots = ["requirements.txt", "setup.py", ".git", ".hg"] +command = "pylsp" +# settings_section = "_" +offset_encoding = "utf-8" +[language.python.settings._] +# See https://github.com/python-lsp/python-lsp-server#configuration +# pylsp.configurationSources = ["flake8"] + +[language.r] +filetypes = ["r"] +roots = ["DESCRIPTION", ".git", ".hg"] +command = "R" +args = ["--slave", "-e", "languageserver::run()"] + +[language.racket] +filetypes = ["racket"] +roots = ["info.rkt"] +command = "racket" +args = ["-l", "racket-langserver"] + +[language.reason] +filetypes = ["reason"] +roots = ["package.json", "Makefile", ".git", ".hg"] +command = "ocamllsp" + +[language.ruby] +filetypes = ["ruby"] +roots = ["Gemfile"] +command = "solargraph" +args = ["stdio"] +[language.ruby.settings] +# See https://github.com/castwide/solargraph/blob/master/lib/solargraph/language_server/host.rb +# "solargraph.completion" = true + +# [language.rust] +# filetypes = ["rust"] +# roots = ["Cargo.toml"] +# command = "sh" +# args = [ +# "-c", +# """ +# if path=$(rustup which rls 2>/dev/null); then +# "$path" +# else +# rls +# fi +# """, +# ] +# [language.rust.settings.rust] +# # See https://github.com/rust-lang/rls#configuration +# # features = [] + +[language.rust] +filetypes = ["rust"] +roots = ["Cargo.toml"] +command = "rust-analyzer" +settings_section = "rust-analyzer" +[language.rust.settings.rust-analyzer] +# See https://rust-analyzer.github.io/manual.html#configuration +hoverActions.enable = false # kak-lsp doesn't support this at the moment +# cargo.features = [] + +[language.kotlin] +filetypes = ["kotlin"] +roots = [".git", "gradlew"] +command = "intelephense" +args = ["--stdio"] +settings_section = "intelephense" + +[language.terraform] +filetypes = ["terraform"] +roots = ["*.tf"] +command = "terraform-ls" +args = ["serve"] +[language.terraform.settings.terraform-ls] +# See https://github.com/hashicorp/terraform-ls/blob/main/docs/SETTINGS.md +# rootModulePaths = [] + +[language.tsx] +filetypes = ["typescript"] +roots = ["package.json", "tsconfig.json", ".git", ".hg"] +command = "typescript-language-server" +args = ["--stdio"] + +# [language.typescript] +# filetypes = ["typescript"] +# roots = ["package.json", "tsconfig.json", ".git", ".hg"] +# command = "deno" +# args = ["lsp"] +# [language.typescript.settings.deno] +# enable = true +# lint = true + +[language.yaml] +filetypes = ["yaml"] +roots = [".git", ".hg"] +command = "yaml-language-server" +args = ["--stdio"] +[language.yaml.settings] +# See https://github.com/redhat-developer/yaml-language-server#language-server-settings +# Defaults are at https://github.com/redhat-developer/yaml-language-server/blob/master/src/yamlSettings.ts +# yaml.format.enable = true + +[language.zig] +filetypes = ["zig"] +roots = ["build.zig"] +command = "zls" + +# Semantic tokens support +# See https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_semanticTokens +# for the default list of tokens and modifiers. +# However, many language servers implement their own values. +# Make sure to check the output of `lsp-capabilities` and each server's documentation and source code as well. +# Examples: +# - TypeScript: https://github.com/microsoft/vscode-languageserver-node/blob/2645fb54ea1e764aff71dee0ecc8aceff3aabf56/client/src/common/semanticTokens.ts#L58 +# - Rust Analyzer: https://github.com/rust-analyzer/rust-analyzer/blob/f6da603c7fe56c19a275dc7bab1f30fe1ad39707/crates/ide/src/syntax_highlighting.rs#L42 +[semantic_tokens] +faces = [ + {face="documentation", token="comment", modifiers=["documentation"]}, + {face="comment", token="comment"}, + {face="function", token="function"}, + {face="keyword", token="keyword"}, + {face="module", token="namespace"}, + {face="operator", token="operator"}, + {face="string", token="string"}, + {face="type", token="type"}, + {face="default+d", token="variable", modifiers=["readonly"]}, + {face="default+d", token="variable", modifiers=["constant"]}, + {face="variable", token="variable"}, +] diff --git a/kak/autoload/autoload b/kak/autoload/autoload new file mode 120000 index 0000000..a406aea --- /dev/null +++ b/kak/autoload/autoload @@ -0,0 +1 @@ +/usr/share/kak/autoload/ \ No newline at end of file diff --git a/kak/autoload/synonyms.kak b/kak/autoload/synonyms.kak new file mode 100644 index 0000000..65c6cc5 --- /dev/null +++ b/kak/autoload/synonyms.kak @@ -0,0 +1,158 @@ +# Find synonyms of a word in a MyThes thesaurus. +# Author: Francois Tonneau + +# This script assumes that the MyThes thesauri (or symbolic links to them) are +# installed in a 'synonyms' subdirectory of $HOME/.config/kak/ + +# PUBLIC OPTION + +declare-option \ +-docstring 'Character class to skip at word start. Default is [-_*"''`({[<]' \ +str synonyms_skip [-_*"'`({[<] + +# PRIVATE VARIABLES + +declare-option -hidden str synonyms_path synonyms +declare-option -hidden str synonyms_file '' + +declare-option -hidden str synonyms_word '' + +# PUBLIC COMMANDS + +define-command \ +-docstring 'synonyms-set-thesaurus : choose synonym book' \ +-params 1 \ +-shell-script-candidates %{ + path=$kak_config'/'$kak_opt_synonyms_path + find -L "$path" -mindepth 1 -maxdepth 1 -type f -name '*\.dat' \ + | sed -e 's,^.*/,,' -e 's,\.dat$,,' \ + | sort +} \ +synonyms-set-thesaurus %{ + evaluate-commands %sh{ + file=$kak_config'/'$kak_opt_synonyms_path'/'$1.dat + if [ -f "$file" ] && [ -r "$file" ]; then + printf %s\\n "set-option window synonyms_file $file" + else + printf %s\\n 'fail cannot access thesaurus' + fi + } +} + +define-command \ +-docstring 'synonyms-enable-on : find synonym with ' \ +-params 1 \ +synonyms-enable-on %{ + try %{ + remove-hooks global synonyms + } + hook -group synonyms global InsertKey %arg(1) %{ + synonyms-call-menu insert + } +} + +define-command \ +-docstring 'Disable synonym finding' \ +synonyms-disable %{ + remove-hooks global synonyms +} + +define-command \ +-docstring 'Replace selection(s) with synonym (in Normal mode)' \ +synonyms-replace-selection %{ + synonyms-call-menu normal +} + +alias global syr synonyms-replace-selection + +# IMPLEMENTATION + +define-command \ +-hidden \ +-params 1 \ +synonyms-call-menu %{ + # + # Arg = mode (insert or normal). + evaluate-commands synonyms-read-word %arg(1) + evaluate-commands %sh{ + mode=$1 + word=$kak_opt_synonyms_word + [ ! "$word" ] && exit + file=$kak_opt_synonyms_file + [ ! "$file" ] && printf %s\\n 'echo thesaurus not set' && exit + # + entries=$(grep -i -n "^$word|" "$file" 2>/dev/null) + [ ! "$entries" ] && exit + # + if [ "$mode" = insert ]; then + # + # Help undoing word replacement by committing changes. Then clean + # commit message. + printf %s\\n 'execute-keys ' + printf %s\\n echo + fi + # + printf %s 'menu -- ' + printf %s\\n "$entries" | while read entry; do + head=${entry%%:*} + count=${entry##*|} + # + # Select item lines, remove ...-| headers and parenthetical notes, + # replace braces with ! for string safety, and build menu content. + sed -n "$((head + 1)),$((head + count))p" "$file" \ + | \ + sed -e 's,^[^|]*|,,' -e 's, *([^()]*) *,,g' -e 's,[{}],!,g' \ + | tr '|' '\n' \ + | sort \ + | uniq \ + | awk -v mode="$mode" ' + { + printf "%%{%s} ", $0 + printf "%%{synonyms-do-replacement %s %%{%s}} ", mode, $0 + } + ' + done + } +} + +define-command \ +-hidden \ +-params 1 \ +synonyms-read-word %{ + # + # Arg = mode (insert or normal). + set-option window synonyms_word '' + evaluate-commands -draft %{ + evaluate-commands "synonyms-adjust-selection-%arg(1)" + set-option window synonyms_word %val(selection) + } +} + +define-command \ +-hidden \ +synonyms-adjust-selection-insert %{ + try %{ + execute-keys + execute-keys 1 s %opt(synonyms_skip)* (\S+?) \s* \z + } +} + +define-command \ +-hidden \ +synonyms-adjust-selection-normal %{ + nop +} + +define-command \ +-hidden \ +-params 2 \ +synonyms-do-replacement %{ + # + # Args: 1 = mode, 2 = replacement. + evaluate-commands -save-regs x -draft %{ + evaluate-commands "synonyms-adjust-selection-%arg(1)" + set-register x %arg(2) + execute-keys %{"} x R + } +} + diff --git a/kak/colors/default.kak b/kak/colors/default.kak new file mode 100644 index 0000000..f1abff2 --- /dev/null +++ b/kak/colors/default.kak @@ -0,0 +1,120 @@ +# One Light + +declare-option str fg "4b4c54" +declare-option str bg "fafafa" +declare-option str subbg "e6e6e6" + +declare-option str lightred "e45649" +declare-option str darkred "ca1243" +declare-option str green "50a14f" +declare-option str lightorange "c18401" +declare-option str darkorange "986801" +declare-option str blue "4078f2" +declare-option str magenta "a626a4" +declare-option str cyan "0184bc" + +declare-option str comment "a0a1a7" +declare-option str hint "000000" + +declare-option str cursoralpha "80" +declare-option str selectionalpha "40" + +# Menus do not support transparency, so we must hardcode the selection + sub bg colors +declare-option str menuselection "bbc9e8" + +# CODE + +set-face global value "rgb:%opt{darkorange}" +set-face global type "rgb:%opt{lightorange}" +set-face global variable "rgb:%opt{lightred}" +set-face global module "rgb:%opt{lightorange}" +set-face global function "rgb:%opt{blue}" +set-face global string "rgb:%opt{green}" +set-face global keyword "rgb:%opt{magenta}" +set-face global operator "rgb:%opt{fg}" +set-face global attribute "rgb:%opt{magenta}" +set-face global comment "rgb:%opt{comment}" +set-face global documentation "rgb:%opt{comment}" +set-face global meta "rgb:%opt{lightred}" +set-face global builtin "rgb:%opt{lightorange}" + +# MARKUP + +set-face global title "rgb:%opt{darkorange}" +set-face global header "rgb:%opt{green}" +set-face global mono "rgb:%opt{cyan}" +set-face global block "rgb:%opt{magenta}" +set-face global link "rgb:%opt{blue}" +set-face global bullet "rgb:%opt{lightorange}" +set-face global list "rgb:%opt{fg}" + +# BUILTIN + +set-face global Default "rgb:%opt{fg},rgb:%opt{bg}" +set-face global PrimarySelection "default,rgba:%opt{blue}%opt{selectionalpha}" +set-face global SecondarySelection "default,rgba:%opt{green}%opt{selectionalpha}" +set-face global PrimaryCursor "default,rgba:%opt{blue}%opt{cursoralpha}" +set-face global SecondaryCursor "default,rgba:%opt{green}%opt{cursoralpha}" +set-face global PrimaryCursorEol "default,rgba:%opt{lightred}%opt{cursoralpha}" +set-face global SecondaryCursorEol "default,rgba:%opt{darkorange}%opt{cursoralpha}" +set-face global LineNumbers "rgb:%opt{comment}" +set-face global LineNumberCursor "rgb:%opt{darkorange}" +set-face global LineNumbersWrapped "rgb:%opt{bg},rgb:%opt{bg}" +set-face global MenuForeground "rgb:%opt{fg},rgb:%opt{menuselection}" +set-face global MenuBackground "rgb:%opt{fg},rgb:%opt{subbg}" +set-face global MenuInfo "rgb:%opt{green}" +set-face global Information "rgb:%opt{fg},rgb:%opt{subbg}" +set-face global Error "rgb:%opt{lightred}" +set-face global StatusLine "rgb:%opt{fg},rgb:%opt{subbg}" +set-face global StatusLineMode "rgb:%opt{darkorange}" +set-face global StatusLineInfo "rgb:%opt{blue}" +set-face global StatusLineValue "rgb:%opt{fg}" +set-face global StatusCursor "default,rgba:%opt{blue}%opt{cursoralpha}" +set-face global Prompt "rgb:%opt{blue}" +set-face global MatchingChar "default,rgb:%opt{subbg}" +set-face global BufferPadding "rgb:%opt{bg},rgb:%opt{bg}" +set-face global Whitespace "rgb:%opt{comment}" + +# PLUGINS + +# kak-lsp +set-face global InlayHint "rgb:%opt{comment}" +set-face global parameter "rgb:%opt{lightred}+i" +set-face global enum "rgb:%opt{cyan}" +set-face global InlayDiagnosticError "rgb:%opt{lightred}" +set-face global InlayDiagnosticWarning "rgb:%opt{lightorange}" +set-face global InlayDiagnosticInfo "rgb:%opt{blue}" +set-face global InlayDiagnosticHint "rgb:%opt{hint}" +set-face global LineFlagError "rgb:%opt{lightred}" +set-face global LineFlagWarning "rgb:%opt{lightorange}" +set-face global LineFlagInfo "rgb:%opt{blue}" +set-face global LineFlagHint "rgb:%opt{hint}" +# Not all terminals support curly underlines, so use regular ones by default +set-face global DiagnosticError "default+u" +set-face global DiagnosticWarning "default+u" +set-face global DiagnosticInfo "default+u" +set-face global DiagnosticHint "default+u" +define-command -override one-enable-fancy-underlines %{ + set-face global DiagnosticError ",,rgb:%opt{lightred}+c" + set-face global DiagnosticWarning ",,rgb:%opt{lightorange}+c" + set-face global DiagnosticInfo ",,rgb:%opt{blue}+c" + set-face global DiagnosticHint ",,rgb:%opt{hint}+u" +} +# Infobox faces +set-face global InfoDefault Information +set-face global InfoBlock block +set-face global InfoBlockQuote block +set-face global InfoBullet bullet +set-face global InfoHeader header +set-face global InfoLink link +set-face global InfoLinkMono header +set-face global InfoMono mono +set-face global InfoRule comment +set-face global InfoDiagnosticError InlayDiagnosticError +set-face global InfoDiagnosticHint InlayDiagnosticHint +set-face global InfoDiagnosticInformation InlayDiagnosticInfo +set-face global InfoDiagnosticWarning InlayDiagnosticWarning + +# kak-rainbower +try %{ set-option global rainbow_colors "rgb:daa520" "rgb:9932cc" "rgb:00bfff" } + diff --git a/kak/colors/one.kak b/kak/colors/one.kak new file mode 100644 index 0000000..0648083 --- /dev/null +++ b/kak/colors/one.kak @@ -0,0 +1,120 @@ +# One Light +# +# declare-option str fg "4b4c54" +# declare-option str bg "fafafa" +# declare-option str subbg "e6e6e6" +# +# declare-option str lightred "e45649" +# declare-option str darkred "ca1243" +# declare-option str green "50a14f" +# declare-option str lightorange "c18401" +# declare-option str darkorange "986801" +# declare-option str blue "4078f2" +# declare-option str magenta "a626a4" +# declare-option str cyan "0184bc" +# +# declare-option str comment "a0a1a7" +# declare-option str hint "000000" +# +# declare-option str cursoralpha "80" +# declare-option str selectionalpha "40" +# +# # Menus do not support transparency, so we must hardcode the selection + sub bg colors +# declare-option str menuselection "bbc9e8" +# +# # CODE +# +# set-face global value "rgb:%opt{darkorange}" +# set-face global type "rgb:%opt{lightorange}" +# set-face global variable "rgb:%opt{lightred}" +# set-face global module "rgb:%opt{lightorange}" +# set-face global function "rgb:%opt{blue}" +# set-face global string "rgb:%opt{green}" +# set-face global keyword "rgb:%opt{magenta}" +# set-face global operator "rgb:%opt{fg}" +# set-face global attribute "rgb:%opt{magenta}" +# set-face global comment "rgb:%opt{comment}" +# set-face global documentation "rgb:%opt{comment}" +# set-face global meta "rgb:%opt{lightred}" +# set-face global builtin "rgb:%opt{lightorange}" +# +# # MARKUP +# +# set-face global title "rgb:%opt{darkorange}" +# set-face global header "rgb:%opt{green}" +# set-face global mono "rgb:%opt{cyan}" +# set-face global block "rgb:%opt{magenta}" +# set-face global link "rgb:%opt{blue}" +# set-face global bullet "rgb:%opt{lightorange}" +# set-face global list "rgb:%opt{fg}" +# +# # BUILTIN +# +# set-face global Default "rgb:%opt{fg},rgb:%opt{bg}" +# set-face global PrimarySelection "default,rgba:%opt{blue}%opt{selectionalpha}" +# set-face global SecondarySelection "default,rgba:%opt{green}%opt{selectionalpha}" +# set-face global PrimaryCursor "default,rgba:%opt{blue}%opt{cursoralpha}" +# set-face global SecondaryCursor "default,rgba:%opt{green}%opt{cursoralpha}" +# set-face global PrimaryCursorEol "default,rgba:%opt{lightred}%opt{cursoralpha}" +# set-face global SecondaryCursorEol "default,rgba:%opt{darkorange}%opt{cursoralpha}" +# set-face global LineNumbers "rgb:%opt{comment}" +# set-face global LineNumberCursor "rgb:%opt{darkorange}" +# set-face global LineNumbersWrapped "rgb:%opt{bg},rgb:%opt{bg}" +# set-face global MenuForeground "rgb:%opt{fg},rgb:%opt{menuselection}" +# set-face global MenuBackground "rgb:%opt{fg},rgb:%opt{subbg}" +# set-face global MenuInfo "rgb:%opt{green}" +# set-face global Information "rgb:%opt{fg},rgb:%opt{subbg}" +# set-face global Error "rgb:%opt{lightred}" +# set-face global StatusLine "rgb:%opt{fg},rgb:%opt{subbg}" +# set-face global StatusLineMode "rgb:%opt{darkorange}" +# set-face global StatusLineInfo "rgb:%opt{blue}" +# set-face global StatusLineValue "rgb:%opt{fg}" +# set-face global StatusCursor "default,rgba:%opt{blue}%opt{cursoralpha}" +# set-face global Prompt "rgb:%opt{blue}" +# set-face global MatchingChar "default,rgb:%opt{subbg}" +# set-face global BufferPadding "rgb:%opt{bg},rgb:%opt{bg}" +# set-face global Whitespace "rgb:%opt{comment}" +# +# # PLUGINS +# +# # kak-lsp +# set-face global InlayHint "rgb:%opt{comment}" +# set-face global parameter "rgb:%opt{lightred}+i" +# set-face global enum "rgb:%opt{cyan}" +# set-face global InlayDiagnosticError "rgb:%opt{lightred}" +# set-face global InlayDiagnosticWarning "rgb:%opt{lightorange}" +# set-face global InlayDiagnosticInfo "rgb:%opt{blue}" +# set-face global InlayDiagnosticHint "rgb:%opt{hint}" +# set-face global LineFlagError "rgb:%opt{lightred}" +# set-face global LineFlagWarning "rgb:%opt{lightorange}" +# set-face global LineFlagInfo "rgb:%opt{blue}" +# set-face global LineFlagHint "rgb:%opt{hint}" +# # Not all terminals support curly underlines, so use regular ones by default +# set-face global DiagnosticError "default+u" +# set-face global DiagnosticWarning "default+u" +# set-face global DiagnosticInfo "default+u" +# set-face global DiagnosticHint "default+u" +# define-command -override one-enable-fancy-underlines %{ +# set-face global DiagnosticError ",,rgb:%opt{lightred}+c" +# set-face global DiagnosticWarning ",,rgb:%opt{lightorange}+c" +# set-face global DiagnosticInfo ",,rgb:%opt{blue}+c" +# set-face global DiagnosticHint ",,rgb:%opt{hint}+u" +# } +# # Infobox faces +# set-face global InfoDefault Information +# set-face global InfoBlock block +# set-face global InfoBlockQuote block +# set-face global InfoBullet bullet +# set-face global InfoHeader header +# set-face global InfoLink link +# set-face global InfoLinkMono header +# set-face global InfoMono mono +# set-face global InfoRule comment +# set-face global InfoDiagnosticError InlayDiagnosticError +# set-face global InfoDiagnosticHint InlayDiagnosticHint +# set-face global InfoDiagnosticInformation InlayDiagnosticInfo +# set-face global InfoDiagnosticWarning InlayDiagnosticWarning +# +# # kak-rainbower +# try %{ set-option global rainbow_colors "rgb:daa520" "rgb:9932cc" "rgb:00bfff" } +# diff --git a/kak/kakrc b/kak/kakrc new file mode 100644 index 0000000..a1a38bf --- /dev/null +++ b/kak/kakrc @@ -0,0 +1,152 @@ +########### +# plugins # +########### +source "%val{config}/plugins/plug.kak/rc/plug.kak" +plug "andreyorst/plug.kak" noload + +######################### +# colors and appearance # +######################### +add-highlighter global/ number-lines -relative +add-highlighter -override global/number-lines number-lines -hlcursor + +colorscheme one + +#################### +# system clipboard # +#################### +plug "lePerdu/kakboard" %{ + hook global WinCreate .* %{ kakboard-enable } +} + +hook global NormalKey y|d|c %{ nop %sh{ + printf "%s" "$kak_reg_dquote" | xclip -selection clipboard >&- 2>&- +} } + +############ +# snippets # +############ +# plug "occivink/kakoune-snippets" config %{ +# set-option -add global snippets_directories "%opt{plug_install_dir}/kakoune-snippet-collection/snippets" +# # some other kakoune-snippets related configurations +# } +# +# plug "andreyorst/kakoune-snippet-collection" + + +########### +# buffers # +########### +plug "Delapouite/kakoune-buffers" %{ + map global normal ^ q + map global normal Q + map global normal q b + map global normal Q B + map global normal + map global normal + map global normal b ': enter-buffers-mode' -docstring 'buffers' + map global normal B ': enter-user-mode -lock buffers' -docstring 'buffers (lock)' +} + +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 + +hook global WinDisplay .* info-buffers + +map global user b ':enter-buffers-mode' -docstring 'buffers…' +map global user B ':enter-user-mode -lock buffers' -docstring 'buffers (dick)' + + +################## +# tabs expansion # +################## +plug "andreyorst/smarttab.kak" +hook global WinSetOption filetype=(python|rust) expandtab +map global insert '' + +####### +# lsp # +####### +eval %sh{kak-lsp --kakoune -s $kak_session} # Not needed if you load it with plug.kak. +lsp-enable + + +map global user l %{: enter-user-mode lsp} -docstring "LSP mode" + +# vim migration +# +define-command -hidden alt-x %{ + evaluate-commands %sh{ + width=$kak_window_width + printf "%s\n" "execute-keys '$width'lhl" + unset width + } +} +define-command -hidden alt-X %{ + evaluate-commands %sh{ + width=$kak_window_width + printf "%s\n" "execute-keys '$width'hlh" + unset width + } +} + + +############## +# formatters # +############## +# indentation +set-option global indentwidth 4 + +hook global WinSetOption filetype=python %{ + set-option window formatcmd 'black -q -' + + hook -group python-auto-format window BufWritePre .* format + + hook -once WinSetOption filetype=.* %{ + unset-option window formatcmd + remove-hooks window python-auto-format + } +} + +hook global WinSetOption filetype=rust %{ + set-option window formatcmd 'rustfmt' + + hook -group rust-autoformat window BufWritePre .* format + + hook -once WinSetOption filetype=.* %{ + unset-option window formatcmd + remove-hooks window rust-autoformat + } +} + +hook global BufSetOption filetype=markdown %{ + set-option buffer formatcmd 'pandoc -f commonmark -t commonmark' +} + + +hook global WinSetOption filetype=(nix|latex|yaml|markdown|haskell) %{ + set-option buffer indentwidth 2 + set window autowrap_column 80 + autowrap-enable +} + +map global user W '|fmt --width 80' -docstring "Wrap to 80 columns" + +############ +# spelling # +############ +# thesaurus langauge switchers? +map global normal ' :synonyms-set-thesaurus th_ru_RU_v2 :echo set ru thesaurus' +map global normal ' :synonyms-set-thesaurus th_en_US_v2 :echo set en thesaurus' + +hook global WinDisplay .* %{ synonyms-enable-on } + + +############### +# file search # +############### +plug "andreyorst/fzf.kak" +map global normal ': fzf-mode'