From 4d580d5730dbbb254a17f0e0550e5872d6eab356 Mon Sep 17 00:00:00 2001 From: Mike Vink Date: Fri, 19 May 2023 12:50:33 +0000 Subject: fixup --- home/kakoune.nix | 43 ++++++++++++++++--------------------------- shell-scripts/kakup | 9 +++++++++ 2 files changed, 25 insertions(+), 27 deletions(-) create mode 100755 shell-scripts/kakup diff --git a/home/kakoune.nix b/home/kakoune.nix index 6e81cf4..11f92d5 100644 --- a/home/kakoune.nix +++ b/home/kakoune.nix @@ -9,6 +9,7 @@ enable = true; config = { + colorScheme = "gruvbox-dark"; autoReload = "yes"; numberLines = { enable = true; @@ -16,16 +17,6 @@ }; }; extraConfig = '' - def ide %{ - rename-client main - set global jumpclient main - - new rename-client tools - set global toolsclient tools - - new rename-client docs - set global docsclient docs - } # Source a local project kak config if it exists # Make sure it is set as a kak filetype hook global BufCreate (.*/)?(\.kakrc\.local) %{ @@ -71,33 +62,31 @@ # {left-of} The pane to the left of the active pane # {right-of} The pane to the right of the active pane - map global user q ':new ' -docstring "Open quickfix window" - define-command -override -hidden -params 1.. split-impl %{ + declare-user-mode split + define-command -override -hidden -params 1.. tmux %{ echo %sh{ - tmux=$${kak_client_env_TMUX:-$TMUX} + tmux=''${kak_client_env_TMUX:-$TMUX} if [ -z "$tmux" ]; then echo "fail 'This command is only available in a tmux session'" exit fi - TMUX=$tmux tmux select-pane -t "$1" # < /dev/null > /dev/null 2>&1 & + eval TMUX=$tmux tmux ''${@} } } - + map global normal %{:enter-user-mode split} -docstring "Navigate splits" - map global split j %{:split-impl '{down-of}'} -docstring "Down" - map global split k %{:split-impl '{up-of}'} -docstring "Down" - map global split h %{:split-impl '{left-of}'} -docstring "Down" - map global split l %{:split-impl '{right-of}'} -docstring "Down" + map global split j %{:tmux select-pane -t "{down-of}"} -docstring "Down" + map global split k %{:tmux select-pane -t "{up-of}"} -docstring "Up" + map global split h %{:tmux select-pane -t "{left-of}"} -docstring "Left" + map global split l %{:tmux select-pane -t "{right-of}"} -docstring "Right" + map global split = %{:tmux select-layout even-vertical} -docstring "Balance" + map global split o %{:tmux kill-pane -a} -docstring "Only" + + map global insert 'Bd' -docstring "Delete word before cursor" define-command -override -params 0.. split %{ - echo %sh{ - tmux=$${kak_client_env_TMUX:-$TMUX} - if [ -z "$tmux" ]; then - echo "fail 'This command is only available in a tmux session'" - exit - fi - TMUX=$tmux tmux split-window -t "$${kak_client_env_TMUX_PANE}" kak "$${kak_buffile}" # < /dev/null > /dev/null 2>&1 & - } + tmux split-window -t %val{client_env_TMUX_PANE} kak -c %val{session} %val{buffile} + tmux select-layout even-vertical } alias global sp split ''; diff --git a/shell-scripts/kakup b/shell-scripts/kakup new file mode 100755 index 0000000..aa271fb --- /dev/null +++ b/shell-scripts/kakup @@ -0,0 +1,9 @@ +# #!@bash@/bin/bash +if ! tmux has-session -t kakoune-${USER}; then + tmux new -s kakoune-${USER} -d + export TMUX=$(tmux display-message -p '#{socket_path}') +fi +if ! kak -l | grep kakoune-${USER}; then + kak -s kakoune-${USER} -d & +fi +tmux attach -t kakoune-${USER} -- cgit v1.2.3