diff options
| author | Mike Vink <mike1994vink@gmail.com> | 2023-05-20 12:44:16 +0200 |
|---|---|---|
| committer | Mike Vink <mike1994vink@gmail.com> | 2023-05-20 12:44:16 +0200 |
| commit | 9a840faa58623f54acb383aa1a64aef825b7a304 (patch) | |
| tree | 914f52cd9f22f0cad11fe2ae73bb43b22b6ca927 /home | |
| parent | 95321e53131e825afd40bada92a00b7e06ac699e (diff) | |
fixup
Diffstat (limited to 'home')
| -rw-r--r-- | home/kakoune.nix | 103 | ||||
| -rw-r--r-- | home/packages.nix | 1 |
2 files changed, 22 insertions, 82 deletions
diff --git a/home/kakoune.nix b/home/kakoune.nix index e759474..20567fa 100644 --- a/home/kakoune.nix +++ b/home/kakoune.nix @@ -5,91 +5,32 @@ home-manager, ... }: { + home.activation = { + kakoune-symlink = home-manager.lib.hm.dag.entryAfter ["writeBoundary"] '' + KAK_CONFIG="${config.home.homeDirectory}/kakoune" + XDG_CONFIG_HOME_KAK="${config.xdg.configHome}/kak" + if [ -L $XDG_CONFIG_HOME_KAK ] && [ -e $XDG_CONFIG_HOME_KAK ]; then + $DRY_RUN_CMD echo "kakoune linked" + else + $DRY_RUN_CMD ln -s $KAK_CONFIG $XDG_CONFIG_HOME_KAK + fi + if [ -L $XDG_CONFIG_HOME_KAK/autoload/default ] && [ -e $XDG_CONFIG_HOME_KAK/autoload/default ]; then + $DRY_RUN_CMD echo "kakoune share linked" + else + ln -sf ${pkgs.kakoune-unwrapped}/share/kak/autoload $XDG_CONFIG_HOME_KAK/autoload/default + fi + ''; + }; programs.kakoune = { enable = true; - - extraConfig = '' - colorscheme gruvbox-dark - set-option global autoreload yes - - declare-option -hidden bool init_done - evaluate-commands %sh{ - $kak_opt_init_done && exit - printf ' -set global windowing_modules "" -require-module tmux -require-module tmux-repl -add-highlighter global/ number-lines -relative -declare-user-mode split -' - } - eval %sh{ - $kak_opt_init_done && exit - kak-lsp --kakoune -s $kak_session - } - set-option global init_done true - - hook global WinSetOption filetype=(rust|python|go|javascript|typescript|c|cpp) %{ - lsp-enable-window - lsp-auto-signature-help-enable - 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 - } - } - - hook global WinClose .* %{ - echo "Winclosed!" - tmux selectl "even-vertical" - } - - # Source a local project kak config if it exists - # Make sure it is set as a kak filetype - hook global BufCreate (.*/)?(\.kakrc\.local) %{ - set-option buffer filetype kak - } - try %{ source .kakrc.local } - - 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 e '<a-semicolon>lsp-object Function Method<ret>' -docstring 'LSP function or method' - map global object k '<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' - - map global insert <c-w> '<left><a-;>B<a-;>d' -docstring "Delete word before cursor" - - define-command -override -hidden -params 1.. tmux %{ - echo %sh{ - tmux=''${kak_client_env_TMUX} - pane=''${kak_client_env_TMUX_PANE} - if [ -z "$tmux" ]; then - echo "fail 'This command is only available in a tmux session'" - exit - fi - eval TMUX_PANE=$pane TMUX=$tmux tmux ''${@} - } - } - define-command -override -params 0.. split %{ - tmux split-window -t %val{client_env_TMUX_PANE} kak -c %val{session} %val{buffile} - } - alias global sp split - map global normal <c-w> %{:enter-user-mode split<ret>} -docstring "Navigate splits" - map global split j %{:tmux select-pane -t "{down-of}"<ret>} -docstring "Down" - map global split k %{:tmux select-pane -t "{up-of}"<ret>} -docstring "Up" - map global split h %{:tmux select-pane -t "{left-of}"<ret>} -docstring "Left" - map global split l %{:tmux select-pane -t "{right-of}"<ret>} -docstring "Right" - map global split = %{:tmux select-layout even-vertical<ret>} -docstring "Balance" - map global split o %{:tmux kill-pane -a<ret>} -docstring "Only" - - ''; - plugins = with pkgs.kakounePlugins; [ kak-lsp ]; + extraConfig = '' + set global windowing_modules "" + require-module tmux + require-module tmux-repl + alias global terminal tmux-terminal-vertical + ''; }; } diff --git a/home/packages.nix b/home/packages.nix index 436120e..6d44c88 100644 --- a/home/packages.nix +++ b/home/packages.nix @@ -33,7 +33,6 @@ github-cli fd argocd - docker-client parallel ] ++ (import ../shell-scripts.nix {inherit pkgs config;}); |
