Kak works now!

This commit is contained in:
Steph 2022-07-25 20:19:50 +02:00
parent 45eeb1c767
commit e4a51f1b14
2 changed files with 87 additions and 3 deletions

View File

@ -139,6 +139,8 @@
fd
htop
vim
wl-clipboard
tmux
];
# Some programs need SUID wrappers, can be configured further or are
@ -174,5 +176,42 @@
};
programs.bash.interactiveShellInit = ''
# Prompt
if [ -n "$PS1" ]; then
# A temporary variable to contain our prompt command
NEW_PROMPT_COMMAND='
MY_PWD="$PWD"
[[ "$MY_PWD" =~ ^"$HOME"(/|$) ]] && MY_PWD="~''${MY_PWD#$HOME}"
TRIMMED_PWD=''${MY_PWD: -40};
TRIMMED_PWD=''${TRIMMED_PWD:-$MY_PWD}
[[ "''${#MY_PWD}" -ge 41 ]] && TRIMMED_PWD="…$TRIMMED_PWD"
SHELL_PREFIX=""
[[ -n "$IN_NIX_SHELL" ]] && SHELL_PREFIX="$SHELL_PREFIX 🯇"
[[ -n "$AWS_VAULT" ]] && SHELL_PREFIX="$SHELL_PREFIX 🔓"
[[ -n "$FLUTTER_ENV" ]] && SHELL_PREFIX="$SHELL_PREFIX "
[[ -n "$REACTNATIVE_ENV" ]] && SHELL_PREFIX="$SHELL_PREFIX "
'
# If there's an existing prompt command, let's not
# clobber it
if [ -n "''${PROMPT_COMMAND// /}" ]; then
PROMPT_COMMAND="$PROMPT_COMMAND;$NEW_PROMPT_COMMAND"
else
PROMPT_COMMAND="$NEW_PROMPT_COMMAND"
fi
# We're done with our temporary variable
unset NEW_PROMPT_COMMAND
# Set PS1 with our new variable
# \h - hostname, \u - username
# PS1='\u@\h:$TRIMMED_PWD\$ '
export PS1="[\t \[\e[32m\]\u\[\e[m\]\[\e[32m\]@\[\e[m\]\[\e[32m\]\h\[\e[m\]]"'$SHELL_PREFIX'" \[\e[36m\]"'$TRIMMED_PWD'"\[\e[m\] \$ "
fi
'';
}

View File

@ -1,14 +1,30 @@
{ pkgs, lib, config, specialArgs, options, modulesPath }:
with pkgs;
with pkgs.kakouneUtils;
let
config = writeTextFile (rec { name = "kakrc.kak";
config = writeTextFile (rec {
name = "kakrc.kak";
destination = "/share/kak/autoload/${name}";
text = ''
hook global KakBegin .* %{
colorscheme colors
}
map global user y <a-|>${wl-clipboard}/bin/wl-copy<ret>
map global user p !${wl-clipboard}/bin/wl-paste<ret>
hook global WinSetOption filetype=kaktree %{
remove-highlighter buffer/numbers
remove-highlighter buffer/matching
remove-highlighter buffer/wrap
set-option global kaktree_indentation 1
set-option global kaktree_dir_icon_open ' 🗁 '
set-option global kaktree_dir_icon_close ' 🗀 '
set-option global kaktree_file_icon '🖺'
remove-highlighter buffer/show-whitespaces
}
kaktree-enable
'';
});
lsp-config = writeTextFile (rec {
@ -132,11 +148,40 @@ let
'';
};
kak-crosshairs = buildKakounePlugin (rec {
name = "kak-crosshairs";
src = (pkgs.fetchFromGitHub {
owner = "insipx";
repo = name;
rev = "7edba13c535ce1bc67356b1c9461f5d261949d29";
sha256 = "sha256-VOn9GGHludJasEwcCv6t1Q3/63w9139MCEkdRDnTw6E";
});
});
kaktree = buildKakounePlugin (rec {
name = "kaktree";
src = (pkgs.fetchFromGitHub {
owner = "andreyorst";
repo = name;
rev = "acd47e0c8549afe1634a79a5bbd6d883daa8ba0a";
sha256 = "sha256-9wiJFVxm+xZndUUpqrQ9eld/Df3wcp7gFDZTdInGPQQ=";
});
});
kak-wrap = (writeShellApplication {
name = "edit";
runtimeInputs = [ myKakoune ];
text = ''
tmux -L editor new-session -d -s editor 'kak -e kaktree-toggle'
tmux -L editor set -g status off
tmux -L editor attach -t editor
'';
});
myKakoune = kakoune.override {
plugins = with kakounePlugins; [ config lsp colors ];
plugins = with kakounePlugins; [ config lsp colors kak-crosshairs kaktree ];
};
in
{
environment.systemPackages = [ myKakoune ];
environment.systemPackages = [ myKakoune kak-wrap ];
}