2022-07-20 21:00:50 +02:00
|
|
|
|
{ pkgs, lib, config, specialArgs, options, modulesPath }:
|
|
|
|
|
|
|
|
|
|
with pkgs;
|
2022-07-25 20:19:50 +02:00
|
|
|
|
with pkgs.kakouneUtils;
|
2022-07-20 21:00:50 +02:00
|
|
|
|
|
|
|
|
|
let
|
2022-07-25 20:19:50 +02:00
|
|
|
|
config = writeTextFile (rec {
|
|
|
|
|
name = "kakrc.kak";
|
2022-07-20 21:00:50 +02:00
|
|
|
|
destination = "/share/kak/autoload/${name}";
|
|
|
|
|
text = ''
|
2022-07-23 13:50:27 +02:00
|
|
|
|
hook global KakBegin .* %{
|
|
|
|
|
colorscheme colors
|
|
|
|
|
}
|
2022-07-25 20:19:50 +02:00
|
|
|
|
map global user y <a-|>${wl-clipboard}/bin/wl-copy<ret>
|
|
|
|
|
map global user p !${wl-clipboard}/bin/wl-paste<ret>
|
2022-08-04 10:23:55 +02:00
|
|
|
|
addhl global/ wrap
|
2022-07-25 20:19:50 +02:00
|
|
|
|
|
|
|
|
|
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
|
2022-08-04 10:17:02 +02:00
|
|
|
|
set window modelinefmt ' '
|
2022-07-25 20:19:50 +02:00
|
|
|
|
}
|
2022-07-25 21:33:38 +02:00
|
|
|
|
|
|
|
|
|
hook global WinSetOption filetype=(javascript|typescript) %{
|
|
|
|
|
map buffer normal <tab> ': lsp-code-actions<ret>'
|
|
|
|
|
map buffer normal <ret> ': lsp-hover<ret>'
|
|
|
|
|
|
|
|
|
|
lsp-enable-window
|
|
|
|
|
hook window ModeChange .*:.*:insert %{
|
|
|
|
|
lsp-inlay-diagnostics-disable window
|
|
|
|
|
remove-highlighter window/lsp_diagnostics
|
|
|
|
|
}
|
|
|
|
|
hook window ModeChange .*:insert:normal %{
|
|
|
|
|
lsp-inlay-diagnostics-enable window
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
2022-08-04 10:17:02 +02:00
|
|
|
|
|
|
|
|
|
hook global WinCreate [^*]* %{
|
|
|
|
|
editorconfig-load
|
2022-09-18 18:34:44 +02:00
|
|
|
|
kaktree-enable
|
2022-08-04 10:17:02 +02:00
|
|
|
|
}
|
2022-07-25 21:33:38 +02:00
|
|
|
|
|
2022-07-20 21:00:50 +02:00
|
|
|
|
'';
|
|
|
|
|
});
|
|
|
|
|
lsp-config = writeTextFile (rec {
|
|
|
|
|
name = "kak-lsp.toml";
|
|
|
|
|
destination = "/share/kak-lsp/${name}";
|
|
|
|
|
text = ''
|
|
|
|
|
[language.typescript]
|
|
|
|
|
filetypes = ["typescript", "javascript"]
|
|
|
|
|
roots = ["package.json"]
|
|
|
|
|
command = "rslint-lsp"
|
|
|
|
|
'';
|
|
|
|
|
});
|
|
|
|
|
colors = writeTextFile (rec {
|
|
|
|
|
name = "colors.kak";
|
|
|
|
|
destination = "/share/kak/colors/${name}";
|
2022-07-25 21:33:38 +02:00
|
|
|
|
text = ''# Kanagawa theme for Kakoune
|
2022-07-20 21:00:50 +02:00
|
|
|
|
|
|
|
|
|
# Color palette
|
2022-07-25 21:33:38 +02:00
|
|
|
|
# declare-option str black 'rgb:0a0e14'
|
2022-07-20 21:00:50 +02:00
|
|
|
|
declare-option str black default
|
2022-07-25 21:33:38 +02:00
|
|
|
|
declare-option str dark 'rgb:090618'
|
|
|
|
|
declare-option str gray 'rgb:727169'
|
|
|
|
|
declare-option str aqua 'rgb:6A9589'
|
|
|
|
|
declare-option str white 'rgb:DCD7BA'
|
|
|
|
|
declare-option str blue 'rgb:7E9CD8'
|
|
|
|
|
declare-option str cyan 'rgb:7FB4CA'
|
|
|
|
|
declare-option str blue_green 'rgb:7AA89F'
|
|
|
|
|
declare-option str green 'rgb:98BB6C'
|
|
|
|
|
declare-option str light_orange 'rgb:DCA561'
|
|
|
|
|
declare-option str orange 'rgb:FFA066'
|
|
|
|
|
declare-option str pink 'rgb:D27E99'
|
|
|
|
|
declare-option str purple 'rgb:957fb8'
|
|
|
|
|
declare-option str red 'rgb:C34043'
|
|
|
|
|
declare-option str yellow 'rgb:E6C384'
|
|
|
|
|
declare-option str lime 'rgb:C0A36E'
|
|
|
|
|
declare-option str psel 'rgba:2D4F6780'
|
|
|
|
|
declare-option str ssel 'rgba:22324980'
|
|
|
|
|
declare-option str dimgray 'rgb:54546D'
|
2022-07-20 21:00:50 +02:00
|
|
|
|
|
|
|
|
|
declare-option str background %opt{black}
|
|
|
|
|
declare-option str dimmed_background %opt{gray}
|
|
|
|
|
declare-option str foreground %opt{white}
|
|
|
|
|
|
|
|
|
|
# Reference
|
|
|
|
|
# https://github.com/mawww/kakoune/blob/master/colors/default.kak
|
|
|
|
|
# For code
|
2022-07-25 21:33:38 +02:00
|
|
|
|
set-face global value "%opt{yellow}"
|
2022-07-20 21:00:50 +02:00
|
|
|
|
set-face global type "%opt{cyan}"
|
2022-07-25 21:33:38 +02:00
|
|
|
|
set-face global variable "%opt{yellow}"
|
2022-07-20 21:00:50 +02:00
|
|
|
|
set-face global module "%opt{white}"
|
|
|
|
|
set-face global function "%opt{blue}"
|
|
|
|
|
set-face global string "%opt{green}"
|
|
|
|
|
set-face global keyword "%opt{purple}"
|
2022-07-25 21:33:38 +02:00
|
|
|
|
set-face global operator "%opt{lime}"
|
|
|
|
|
set-face global attribute "%opt{blue_green}"
|
|
|
|
|
set-face global bracket "%opt{white}+b"
|
|
|
|
|
set-face global arguement "%opt{light_orange}"
|
2022-07-20 21:00:50 +02:00
|
|
|
|
set-face global comma "%opt{white}"
|
2022-07-25 21:33:38 +02:00
|
|
|
|
set-face global constant "%opt{blue_green}+b"
|
|
|
|
|
set-face global class "%opt{pink}"
|
2022-07-20 21:00:50 +02:00
|
|
|
|
set-face global comment "%opt{gray}+i"
|
2022-07-25 21:33:38 +02:00
|
|
|
|
set-face global meta "%opt{aqua}"
|
|
|
|
|
set-face global builtin "%opt{cyan}+b"
|
2022-07-20 21:00:50 +02:00
|
|
|
|
|
|
|
|
|
# For markup
|
|
|
|
|
set-face global title "%opt{pink}"
|
|
|
|
|
set-face global header "%opt{orange}"
|
|
|
|
|
set-face global bold "%opt{pink}"
|
|
|
|
|
set-face global italic "%opt{purple}"
|
|
|
|
|
set-face global mono "%opt{green}"
|
|
|
|
|
set-face global block "%opt{cyan}"
|
|
|
|
|
set-face global link "%opt{green}"
|
|
|
|
|
set-face global bullet "%opt{green}"
|
|
|
|
|
set-face global list "%opt{white}"
|
|
|
|
|
|
|
|
|
|
# Builtin faces
|
|
|
|
|
set-face global Default "%opt{white},%opt{black}"
|
|
|
|
|
# set-face global Default "%opt{white},default"
|
|
|
|
|
set-face global PrimarySelection "default,%opt{psel}"
|
|
|
|
|
set-face global SecondarySelection "default,%opt{ssel}"
|
2022-07-25 21:33:38 +02:00
|
|
|
|
set-face global PrimaryCursor "%opt{dark},%opt{cyan}"
|
|
|
|
|
set-face global SecondaryCursor "%opt{dark},%opt{aqua}"
|
|
|
|
|
set-face global PrimaryCursorEol "%opt{dark},%opt{light_orange}"
|
|
|
|
|
set-face global SecondaryCursorEol "%opt{dark},%opt{blue}"
|
2022-07-20 21:00:50 +02:00
|
|
|
|
set-face global LineNumbers "%opt{gray},%opt{black}"
|
2022-07-25 21:33:38 +02:00
|
|
|
|
set-face global LineNumberCursor "%opt{purple},%opt{black}+b"
|
2022-07-20 21:00:50 +02:00
|
|
|
|
set-face global LineNumbersWrapped "%opt{gray},%opt{black}+i"
|
2022-07-25 21:33:38 +02:00
|
|
|
|
set-face global MenuForeground "%opt{dark},%opt{white}+b"
|
2022-07-20 21:00:50 +02:00
|
|
|
|
set-face global MenuBackground "%opt{white},%opt{dark}"
|
2022-07-25 21:33:38 +02:00
|
|
|
|
set-face global MenuInfo "%opt{dark},%opt{orange}"
|
2022-07-20 21:00:50 +02:00
|
|
|
|
set-face global Information "%opt{yellow},%opt{black}"
|
|
|
|
|
set-face global Error "%opt{red},%opt{black}"
|
|
|
|
|
set-face global StatusLine "%opt{white},%opt{black}"
|
2022-07-25 21:33:38 +02:00
|
|
|
|
set-face global StatusLineMode "%opt{aqua},%opt{black}"
|
2022-07-20 21:00:50 +02:00
|
|
|
|
set-face global StatusLineInfo "%opt{purple},%opt{black}"
|
|
|
|
|
set-face global StatusLineValue "%opt{orange},%opt{black}"
|
|
|
|
|
set-face global StatusCursor "%opt{white},%opt{blue}"
|
|
|
|
|
set-face global Prompt "%opt{green},%opt{black}"
|
2022-07-25 21:33:38 +02:00
|
|
|
|
set-face global MatchingChar "%opt{blue},%opt{black}"
|
2022-07-20 21:00:50 +02:00
|
|
|
|
set-face global Whitespace "%opt{dimgray},%opt{black}+f"
|
|
|
|
|
set-face global WrapMarker Whitespace
|
2022-07-25 21:33:38 +02:00
|
|
|
|
set-face global BufferPadding "%opt{black},%opt{black}"
|
|
|
|
|
|
|
|
|
|
|
2022-07-20 21:00:50 +02:00
|
|
|
|
|
|
|
|
|
'';
|
|
|
|
|
});
|
|
|
|
|
lsp = symlinkJoin {
|
|
|
|
|
|
|
|
|
|
name = "kak-lsp-${kak-lsp.version}";
|
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
|
|
|
|
|
|
paths = with kakounePlugins; [
|
|
|
|
|
kak-lsp
|
|
|
|
|
lsp-config
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
postBuild = ''
|
2022-07-23 13:50:27 +02:00
|
|
|
|
wrapProgram $out/bin/kak-lsp --add-flags "--config $out/share/kak-lsp/kak-lsp.toml"
|
2022-07-20 21:00:50 +02:00
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
};
|
2022-07-25 20:19:50 +02:00
|
|
|
|
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 = ''
|
2022-09-18 18:24:27 +02:00
|
|
|
|
BUFFER_NAME=''$(echo -n "''$PWD" | xxd -ps -c 200 | tr -d '\n' | shasum | head -c -4)
|
2022-08-31 16:21:35 +02:00
|
|
|
|
|
|
|
|
|
tmux -L "$BUFFER_NAME" has-session -t "$BUFFER_NAME" || {
|
2022-09-18 18:34:44 +02:00
|
|
|
|
tmux -L "$BUFFER_NAME" new-session -d -s "$BUFFER_NAME" "kak -e 'kaktree-enable; kaktree-toggle'"
|
2022-08-31 16:21:35 +02:00
|
|
|
|
tmux -L "$BUFFER_NAME" set -g status off
|
|
|
|
|
tmux -L "$BUFFER_NAME" set -g pane-border-style fg=#0c0c0c
|
|
|
|
|
tmux -L "$BUFFER_NAME" set -g pane-active-border-style "bg=default fg=#0c0c0c"
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-04 10:17:02 +02:00
|
|
|
|
tmux -L "$BUFFER_NAME" attach -t "$BUFFER_NAME"
|
2022-07-25 20:19:50 +02:00
|
|
|
|
'';
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
2022-07-20 21:00:50 +02:00
|
|
|
|
|
2022-07-23 13:50:27 +02:00
|
|
|
|
myKakoune = kakoune.override {
|
2022-08-04 10:17:02 +02:00
|
|
|
|
plugins = with kakounePlugins; [ config lsp colors kak-crosshairs kaktree kakoune-state-save ];
|
2022-07-20 21:00:50 +02:00
|
|
|
|
};
|
|
|
|
|
in
|
|
|
|
|
{
|
2022-07-25 20:19:50 +02:00
|
|
|
|
environment.systemPackages = [ myKakoune kak-wrap ];
|
2022-07-20 21:00:50 +02:00
|
|
|
|
}
|