Compare commits
5 Commits
fc7ff7f450
...
d0e49183a0
Author | SHA1 | Date |
---|---|---|
Riley Apeldoorn | d0e49183a0 | |
Riley Apeldoorn | 55a7cb8b00 | |
Riley Apeldoorn | a646e3e016 | |
Riley Apeldoorn | b313f64189 | |
Riley Apeldoorn | 8af394d0bd |
|
@ -61,8 +61,8 @@ let inherit (builtins) mapAttrs map; in rec {
|
|||
};
|
||||
|
||||
green = {
|
||||
bright = "29f26c";
|
||||
normal = "8aff80";
|
||||
bright = "29f26c";
|
||||
pastel = "";
|
||||
};
|
||||
|
||||
|
@ -79,7 +79,7 @@ let inherit (builtins) mapAttrs map; in rec {
|
|||
};
|
||||
|
||||
purple = {
|
||||
normal = "bd78fa";
|
||||
normal = "b58aff";
|
||||
bright = "c97ffa";
|
||||
pastel = "d9b5ff";
|
||||
};
|
||||
|
@ -91,7 +91,7 @@ let inherit (builtins) mapAttrs map; in rec {
|
|||
};
|
||||
|
||||
pink = {
|
||||
normal = "f74ddb";
|
||||
normal = "ee8fff";
|
||||
bright = "ff63e5";
|
||||
pastel = "ff96e3";
|
||||
};
|
||||
|
|
|
@ -8,7 +8,15 @@
|
|||
|
||||
riley = {
|
||||
gui = true;
|
||||
kak.ide = true;
|
||||
kak = {
|
||||
|
||||
enable = true;
|
||||
|
||||
haskell = true;
|
||||
rust = true;
|
||||
nix = true;
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
system.stateVersion = "21.11";
|
||||
|
|
|
@ -8,12 +8,14 @@ with lib; (mkIf config.riley.gui {
|
|||
enable = true;
|
||||
|
||||
font = {
|
||||
name = "Fira Code Medium";
|
||||
name = "Fira Code";
|
||||
size = 11;
|
||||
};
|
||||
|
||||
settings = with config.riley.theme.hex; {
|
||||
|
||||
bold_font = "Fira Code Medium";
|
||||
|
||||
background = background.primary;
|
||||
foreground = foreground.primary;
|
||||
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
{ theme, lib, pkgs }:
|
||||
|
||||
pkgs.writeTextFile (rec {
|
||||
name = "colors.kak";
|
||||
destination = "/share/kak/colors/${name}";
|
||||
text = with theme; ''
|
||||
|
||||
face global comment rgb:828282
|
||||
|
||||
face global value rgb:${blue.normal}
|
||||
face global string rgb:${green.normal}
|
||||
face global keyword rgb:${cyan.normal}
|
||||
face global operator rgb:${cyan.normal}
|
||||
face global function rgb:${cyan.normal}
|
||||
face global builtin rgb:${orange.normal}
|
||||
face global module rgb:${yellow.normal}
|
||||
face global meta rgb:${green.bright}
|
||||
face global type rgb:${blue.bright}
|
||||
|
||||
face global LineNumbers rgb:${background.slight}
|
||||
face global BufferPadding rgb:${background.slight}
|
||||
face global LineNumberCursor rgb:${foreground.primary}
|
||||
face global crosshairs_line "default,rgb:212121"
|
||||
face global MenuForeground "default,rgb:${blue.normal}"
|
||||
face global MenuBackground "default,rgb:313131"
|
||||
|
||||
'';
|
||||
})
|
|
@ -1,19 +0,0 @@
|
|||
# Haskell text faces and other stuff related to syntax highlighting
|
||||
# for Haskell in Kakoune, because I prefer different color arrangements
|
||||
# per language.
|
||||
|
||||
{ theme, pkgs, ... }: pkgs.writeTextFile (rec {
|
||||
name = "common.kak";
|
||||
destination = "/share/kak/colors/${name}";
|
||||
text = with theme; ''
|
||||
face global value rgb:${yellow.bright}
|
||||
face global string rgb:${green.normal}
|
||||
face global variable +a
|
||||
face global module rgb:${green.normal}
|
||||
face global operator rgb:${cyan.bright}
|
||||
face global type rgb:${yellow.normal}
|
||||
face global function rgb:${cyan.bright}
|
||||
face global keyword rgb:${blue.normal}+b
|
||||
face global builtin +b
|
||||
'';
|
||||
})
|
|
@ -1,8 +0,0 @@
|
|||
# Import syntax themes
|
||||
|
||||
{ lib, theme, pkgs, ... }: [
|
||||
(import ./haskell.nix { inherit lib theme pkgs; })
|
||||
(import ./rust.nix { inherit lib theme pkgs; })
|
||||
(import ./nix.nix { inherit lib theme pkgs; })
|
||||
(import ./common.nix { inherit lib theme pkgs; })
|
||||
]
|
|
@ -1,21 +0,0 @@
|
|||
# Haskell text faces and other stuff related to syntax highlighting
|
||||
# for Haskell in Kakoune, because I prefer different color arrangements
|
||||
# per language.
|
||||
|
||||
{ theme, pkgs, ... }: pkgs.writeTextFile (rec {
|
||||
name = "haskell.kak";
|
||||
destination = "/share/kak/colors/${name}";
|
||||
text = with theme; ''
|
||||
face global value rgb:${green.bright}
|
||||
face global string rgb:${green.bright}
|
||||
face global variable +b
|
||||
face global module rgb:${green.normal}
|
||||
face global meta rgb:${misc.lime}
|
||||
face global operator rgb:${cyan.bright}
|
||||
face global type rgb:${yellow.normal}
|
||||
face global function rgb:${cyan.bright}
|
||||
face global attribute rgb:${blue.normal}
|
||||
face global keyword rgb:${blue.normal}
|
||||
face global builtin +b
|
||||
'';
|
||||
})
|
|
@ -1,19 +0,0 @@
|
|||
# Haskell text faces and other stuff related to syntax highlighting
|
||||
# for Haskell in Kakoune, because I prefer different color arrangements
|
||||
# per language.
|
||||
|
||||
{ theme, pkgs, ... }: pkgs.writeTextFile (rec {
|
||||
name = "nix.kak";
|
||||
destination = "/share/kak/colors/${name}";
|
||||
text = with theme; ''
|
||||
|
||||
add-highlighter buffer/ regex '\b\s*(=)' 1:operator
|
||||
|
||||
face global string rgb:${green.normal}
|
||||
face global operator rgb:${yellow.bright}+b
|
||||
face global keyword rgb:${blue.normal}+b
|
||||
face global meta rgb:${purple.bright}
|
||||
face global builtin rgb:${blue.bright}+b
|
||||
|
||||
'';
|
||||
})
|
|
@ -1,45 +0,0 @@
|
|||
# Haskell text faces and other stuff related to syntax highlighting
|
||||
# for Haskell in Kakoune, because I prefer different color arrangements
|
||||
# per language.
|
||||
|
||||
{ theme, pkgs, ... }: pkgs.writeTextFile (rec {
|
||||
name = "rust.kak";
|
||||
destination = "/share/kak/colors/${name}";
|
||||
text = with theme; ''
|
||||
|
||||
# Types
|
||||
face global variant rgb:${blue.normal}+b
|
||||
face global enum rgb:${blue.normal}+b
|
||||
face global struct rgb:${blue.normal}+b
|
||||
face global alias rgb:${blue.normal}+b
|
||||
face global primitive rgb:${blue.normal}+b
|
||||
face global union rgb:${blue.normal}+b
|
||||
face global trait rgb:${purple.bright}+b
|
||||
|
||||
# Other Rust-specific syntax elements
|
||||
face global lifetime rgb:${cyan.bright}
|
||||
face global macro rgb:${green.bright}+b
|
||||
face global format macro
|
||||
|
||||
# Keywords
|
||||
face global keyword rgb:${green.normal}
|
||||
|
||||
# Literals
|
||||
face global literal rgb:${misc.lime}
|
||||
face global string literal
|
||||
|
||||
# Items
|
||||
# face global function rgb:ff70cd
|
||||
face global function rgb:fc7cf8
|
||||
face global method function
|
||||
face global module rgb:${misc.blueGrey}
|
||||
|
||||
# Other stuff
|
||||
face global attribute comment
|
||||
face global variable rgb:f5f5f5
|
||||
face global property rgb:${misc.lime}
|
||||
face global operator rgb:${yellow.normal}
|
||||
face global punctuation rgb:${foreground.normal}
|
||||
|
||||
'';
|
||||
})
|
|
@ -1,158 +1,49 @@
|
|||
{ lib, pkgs, config, ... }:
|
||||
|
||||
let kakrc = pkgs.writeTextFile (rec {
|
||||
name = "kakrc.kak";
|
||||
destination = "/share/kak/autoload/${name}";
|
||||
text = with config.riley.theme; ''
|
||||
with pkgs.kakouneUtils;
|
||||
|
||||
# Line numbering
|
||||
add-highlighter global/ number-lines -separator ' │ ' -hlcursor
|
||||
|
||||
# Setting the tabstop to 4 (even though I have an ultrawide monitor)
|
||||
set-option global tabstop 4
|
||||
|
||||
set global ui_options ncurses_assistant=cat
|
||||
|
||||
# Use Alt-Tab to switch between open buffers
|
||||
map global insert <a-tab> <esc>:buffer-next<ret>
|
||||
map global normal <a-tab> :buffer-next<ret>
|
||||
|
||||
def new-tab %{ prompt -file-completion '>' 'terminal kak -c %val{session} %val{text}' }
|
||||
|
||||
map global normal <a-ret> ': new-tab<ret>'
|
||||
|
||||
colorscheme common
|
||||
|
||||
face global LineNumbers rgb:${background.slight}
|
||||
face global BufferPadding rgb:${background.slight}
|
||||
face global LineNumberCursor rgb:${foreground.primary}
|
||||
face global crosshairs_line "default,rgb:${background.normal}"
|
||||
face global MenuForeground "default,blue"
|
||||
face global MenuBackground "default,rgb:313131"
|
||||
face global InlayHint rgb:828282
|
||||
|
||||
face global comment rgb:${foreground.slight}
|
||||
|
||||
'' + (lib.optionalString (config.riley.kak.ide) ''
|
||||
|
||||
eval %sh{ kak-lsp --kakoune -s $kak_session }
|
||||
|
||||
hook global -group yeet ModuleLoaded rust %{
|
||||
|
||||
# Override the Rust highlighting with semantic
|
||||
# tokens supplied by the LSP client
|
||||
remove-hooks global rust-highlight
|
||||
remove-highlighter shared/rust
|
||||
|
||||
# Request tokens
|
||||
lsp-semantic-tokens
|
||||
|
||||
# Self-destruct this hook (it should only run once)
|
||||
remove-hooks global yeet
|
||||
|
||||
}
|
||||
|
||||
# Load language-specific color schemes
|
||||
hook global WinSetOption filetype=(haskell) %{
|
||||
|
||||
colorscheme haskell
|
||||
lsp-enable-window
|
||||
|
||||
lsp-inlay-diagnostics-enable window
|
||||
|
||||
map global normal <tab> ': lsp-code-actions<ret>'
|
||||
map global normal <ret> ': lsp-hover<ret>'
|
||||
|
||||
hook window ModeChange .*:.*:insert %{
|
||||
remove-highlighter window/lsp_diagnostics
|
||||
}
|
||||
|
||||
hook window ModeChange .*:insert:normal %{
|
||||
lsp-inlay-diagnostics-enable window
|
||||
}
|
||||
|
||||
set global lsp_inlay_diagnostic_sign '>'
|
||||
map global insert <tab> '<a-;><gt>'
|
||||
|
||||
}
|
||||
|
||||
hook global WinSetOption filetype=(rust) %{
|
||||
|
||||
lsp-enable-window
|
||||
lsp-inlay-diagnostics-enable window
|
||||
|
||||
colorscheme rust
|
||||
|
||||
git show-diff
|
||||
|
||||
hook buffer BufReload .* %{
|
||||
git update-diff
|
||||
}
|
||||
|
||||
hook buffer NormalIdle .* %{ git update-diff }
|
||||
hook buffer InsertIdle .* %{ git update-diff }
|
||||
|
||||
hook window -group semtok BufReload .* lsp-semantic-tokens
|
||||
hook window -group semtok NormalIdle .* lsp-semantic-tokens
|
||||
hook window -group semtok InsertIdle .* lsp-semantic-tokens
|
||||
|
||||
hook -once -always window WinSetOption filetype=.* %{
|
||||
remove-hooks window semtok
|
||||
}
|
||||
|
||||
hook window ModeChange .*:.*:insert %{
|
||||
remove-highlighter window/lsp_diagnostics
|
||||
}
|
||||
|
||||
hook window ModeChange .*:insert:normal %{
|
||||
lsp-inlay-diagnostics-enable window
|
||||
}
|
||||
|
||||
set global lsp_inlay_diagnostic_sign '>'
|
||||
|
||||
map global normal <tab> ': lsp-code-actions<ret>'
|
||||
map global normal <ret> ': lsp-hover<ret>'
|
||||
|
||||
}
|
||||
|
||||
hook global WinSetOption filetype=(nix) %{
|
||||
colorscheme nix
|
||||
lsp-enable-window
|
||||
}
|
||||
|
||||
face global InlayDiagnosticWarning rgb:a39e31+f
|
||||
face global InlayDiagnosticError rgb:ad494f+f
|
||||
face global InlayDiagnosticHint rgb:4d965a+f
|
||||
face global InlayDiagnosticInfo rgb:4d965a+f
|
||||
|
||||
'');
|
||||
});
|
||||
|
||||
# Syntax colors
|
||||
colors = (import ./colors {
|
||||
let cfg = config.riley.kak;
|
||||
theme = config.riley.theme;
|
||||
inherit lib pkgs;
|
||||
kak-crosshairs = buildKakounePlugin (rec {
|
||||
name = "kak-crosshairs";
|
||||
src = (pkgs.fetchFromGitHub {
|
||||
owner = "insipx";
|
||||
repo = name;
|
||||
rev = "7edba13c535ce1bc67356b1c9461f5d261949d29";
|
||||
sha256 = "sha256-VOn9GGHludJasEwcCv6t1Q3/63w9139MCEkdRDnTw6E";
|
||||
});
|
||||
});
|
||||
in
|
||||
|
||||
in with lib; {
|
||||
with lib; {
|
||||
|
||||
options.riley = {
|
||||
|
||||
kak.enable = (mkEnableOption "kakoune editor") // { default = true; };
|
||||
kak.ide = mkEnableOption "kakoune with ide plugins";
|
||||
|
||||
kak.rust = mkEnableOption "Rust support in Kakoune";
|
||||
kak.ts = mkEnableOption "TypeScript support in Kakoune";
|
||||
kak.haskell = mkEnableOption "Haskell support in Kakoune";
|
||||
kak.python = mkEnableOption "Python 3.9 support in Kakoune";
|
||||
kak.nix = (mkEnableOption "Nix support in Kakoune") // { default = true; };
|
||||
|
||||
};
|
||||
|
||||
config = mkIf (config.riley.kak.enable || config.riley.kak.ide) {
|
||||
config = mkIf (cfg.enable) {
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
(pkgs.kakoune.override {
|
||||
plugins = [
|
||||
environment.systemPackages = [
|
||||
(import ./kakoune.nix {
|
||||
|
||||
# Custom config
|
||||
kakrc
|
||||
typescript = cfg.ts;
|
||||
haskell = cfg.haskell;
|
||||
python = cfg.python;
|
||||
rust = cfg.rust;
|
||||
nix = cfg.nix;
|
||||
|
||||
inherit kak-crosshairs;
|
||||
|
||||
inherit pkgs lib theme;
|
||||
|
||||
] ++ (lib.optionals config.riley.kak.ide (import ./lsp.nix {
|
||||
inherit pkgs lib config;
|
||||
})) ++ colors;
|
||||
})
|
||||
];
|
||||
|
||||
|
|
|
@ -0,0 +1,121 @@
|
|||
{
|
||||
# Feature flags
|
||||
typescript ? false,
|
||||
haskell ? false,
|
||||
python ? false,
|
||||
rust ? false,
|
||||
nix ? true,
|
||||
|
||||
# Build context
|
||||
pkgs,
|
||||
lib
|
||||
}:
|
||||
|
||||
with lib;
|
||||
with pkgs;
|
||||
|
||||
let semantic-tokens =
|
||||
let mk = (name: value: ''
|
||||
[[semantic_tokens]]
|
||||
token = "${name}"
|
||||
face = "${value}"
|
||||
''); in concatStringsSep "\n" (mapAttrsToList mk {
|
||||
"enumMember" = "variant";
|
||||
"enum" = "enum";
|
||||
"union" = "union";
|
||||
"struct" = "struct";
|
||||
"typeAlias" = "alias";
|
||||
"builtinType" = "primitive";
|
||||
"trait" = "trait";
|
||||
"interface" = "trait";
|
||||
"method" = "method";
|
||||
"function" = "function";
|
||||
"namespace" = "module";
|
||||
"boolean" = "literal";
|
||||
"character" = "literal";
|
||||
"number" = "literal";
|
||||
"string" = "string";
|
||||
"keyword" = "keyword";
|
||||
"documentation" = "comment";
|
||||
"comment" = "comment";
|
||||
"escapeSequence" = "format";
|
||||
"formatSpecifier" = "format";
|
||||
"operator" = "operator";
|
||||
"arithmetic" = "operator";
|
||||
"bitwise" = "operator";
|
||||
"comparison" = "operator";
|
||||
"logical" = "operator";
|
||||
"macro" = "macro";
|
||||
"lifetime" = "lifetime";
|
||||
"variable" = "variable";
|
||||
"attribute" = "attribute";
|
||||
"punctuation" = "punctuation";
|
||||
});
|
||||
|
||||
kak-lsp-config-text = concatStringsSep "\n" (
|
||||
(optional (rust || haskell) semantic-tokens)
|
||||
++ (optional rust ''
|
||||
[language.rust]
|
||||
filetypes = [ "rust" ]
|
||||
roots = [ "Cargo.toml" ]
|
||||
command = "rust-analyzer"
|
||||
[language.rust.settings.rust-analyzer]
|
||||
semanticTokens = true
|
||||
diagnostics.enabled = [ "unresolved-proc-macro" ]
|
||||
cargo.loadOutDirsFromCheck = true
|
||||
procMacro.enable = false
|
||||
'')
|
||||
++ (optional nix ''
|
||||
[language.nix]
|
||||
filetypes = [ "nix" ]
|
||||
roots = [ "flake.nix", "shell.nix", ".git", ".hg" ]
|
||||
command = "rnix-lsp"
|
||||
'')
|
||||
++ (optional haskell ''
|
||||
[language.haskell]
|
||||
filetypes = [ "haskell" ]
|
||||
roots = [ "Setup.hs", "stack.yaml", "*.cabal" ]
|
||||
command = "haskell-language-server-wrapper"
|
||||
args = [ "--lsp" ]
|
||||
'')
|
||||
++ (optional python ''
|
||||
[language.python]
|
||||
filetypes = [ "python" ]
|
||||
roots = [ "setup.py", ".git", ".hg" ]
|
||||
command = "pylsp"
|
||||
'')
|
||||
++ (optional typescript ''
|
||||
[language.typescript]
|
||||
filetypes = ["typescript", "javascript"]
|
||||
roots = ["package.json"]
|
||||
command = "rslint-lsp"
|
||||
''));
|
||||
|
||||
kak-lsp-config = (pkgs.writeTextFile (rec {
|
||||
name = "kak-lsp.toml";
|
||||
destination = "/share/kak-lsp/${name}";
|
||||
text = kak-lsp-config-text;
|
||||
}));
|
||||
|
||||
in (symlinkJoin {
|
||||
|
||||
paths = with kakounePlugins; [
|
||||
|
||||
# The language server client
|
||||
kak-lsp
|
||||
|
||||
# Overwrite kak-lsp.toml
|
||||
kak-lsp-config
|
||||
|
||||
] ++ (optional nix rnix-lsp)
|
||||
++ (optional typescript rslint)
|
||||
++ (optional haskell haskell-language-server)
|
||||
++ (optional python python39Packages.python-lsp-server)
|
||||
++ (optional rust rust-analyzer);
|
||||
|
||||
name = "kak-lsp-${kak-lsp.version}";
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
postBuild = ''
|
||||
wrapProgram $out/bin/kak-lsp --add-flags "--config $out/share/kak-lsp/kak-lsp.toml"
|
||||
'';
|
||||
})
|
|
@ -0,0 +1,65 @@
|
|||
# Preconfigured kakoune editor.
|
||||
|
||||
{
|
||||
# Feature flags
|
||||
typescript ? false,
|
||||
haskell ? false,
|
||||
python ? false,
|
||||
rust ? false,
|
||||
nix ? true,
|
||||
|
||||
# Allow extra plugins to be defined
|
||||
# outside of the package
|
||||
extraPlugins ? [],
|
||||
|
||||
# Plugins
|
||||
kak-crosshairs,
|
||||
|
||||
# Color theme
|
||||
theme,
|
||||
|
||||
# Build context
|
||||
pkgs,
|
||||
lib
|
||||
}:
|
||||
|
||||
let kakrc = (import ./kakrc.nix {
|
||||
inherit typescript
|
||||
haskell
|
||||
python
|
||||
rust
|
||||
nix
|
||||
theme
|
||||
pkgs
|
||||
lib;
|
||||
});
|
||||
|
||||
colors = (import ./colors.nix {
|
||||
inherit theme
|
||||
pkgs
|
||||
lib;
|
||||
});
|
||||
|
||||
kak-lsp = (import ./kak-lsp.nix {
|
||||
inherit typescript
|
||||
haskell
|
||||
python
|
||||
rust
|
||||
nix
|
||||
pkgs
|
||||
lib;
|
||||
});
|
||||
|
||||
in (pkgs.kakoune.override {
|
||||
plugins = [
|
||||
|
||||
# Configuration
|
||||
kak-lsp
|
||||
colors
|
||||
kakrc
|
||||
|
||||
# Plugins
|
||||
kak-crosshairs
|
||||
|
||||
] ++ extraPlugins;
|
||||
})
|
|
@ -0,0 +1,176 @@
|
|||
# Defines the kakrc.
|
||||
|
||||
{
|
||||
# Feature flags
|
||||
typescript ? false,
|
||||
haskell ? false,
|
||||
python ? false,
|
||||
rust ? false,
|
||||
nix ? true,
|
||||
|
||||
# Color theme
|
||||
theme,
|
||||
|
||||
# Build tools
|
||||
pkgs,
|
||||
lib,
|
||||
}:
|
||||
|
||||
|
||||
let keybinds = ''
|
||||
map global insert <a-tab> <esc>:buffer-next<ret>
|
||||
map global normal <a-tab> :buffer-next<ret>
|
||||
'';
|
||||
|
||||
# Initialization code for IDE mode needed for every supported
|
||||
# language, and inlay diagnostics.
|
||||
ide-init = ''
|
||||
eval %sh{ kak-lsp --kakoune -s $kak_session }
|
||||
lsp-enable-window
|
||||
|
||||
lsp-inlay-diagnostics-enable window
|
||||
|
||||
hook window ModeChange .*:.*:insert %{
|
||||
remove-highlighter window/lsp_diagnostics
|
||||
}
|
||||
|
||||
hook window ModeChange .*:insert:normal %{
|
||||
lsp-inlay-diagnostics-enable window
|
||||
}
|
||||
|
||||
'';
|
||||
|
||||
# Implies `ide-init`. Adds code actions and hover.
|
||||
ide-core = ''
|
||||
|
||||
${ide-init}
|
||||
|
||||
map buffer normal <tab> ': lsp-code-actions<ret>'
|
||||
map buffer normal <ret> ': lsp-hover<ret>'
|
||||
|
||||
'';
|
||||
|
||||
# Implies `ide-core`, which implies `ide-init`.
|
||||
ide-full = ''
|
||||
|
||||
${ide-core}
|
||||
|
||||
hook window -group semtok BufReload .* lsp-semantic-tokens
|
||||
hook window -group semtok NormalIdle .* lsp-semantic-tokens
|
||||
hook window -group semtok InsertIdle .* lsp-semantic-tokens
|
||||
|
||||
hook -once -always window WinSetOption filetype=.* %{
|
||||
remove-hooks window semtok
|
||||
}
|
||||
|
||||
map global normal <a-down> ': lsp-next-function<ret>'
|
||||
map global normal <a-up> ': lsp-previous-function<ret>'
|
||||
map global normal <a-left> ': lsp-previous-location *goto*<ret>'
|
||||
map global normal <a-right> ': lsp-next-location *goto*<ret>'
|
||||
|
||||
''; in
|
||||
|
||||
|
||||
# Nix hacking-related configuration. Nix has a very weak language
|
||||
# server, and it basically only supports `ide-init` (for completions).
|
||||
let nix-config = (lib.optionalString nix ''
|
||||
hook global WinSetOption filetype=nix %{
|
||||
${ide-init}
|
||||
}
|
||||
'');
|
||||
|
||||
# Sometimes work requires me to touch the frontend. Ew. `ide-core`
|
||||
# suffices here.
|
||||
typescript-config = (lib.optionalString typescript ''
|
||||
hook global WinSetOption filetype=(javascript|typescript) %{
|
||||
${ide-core}
|
||||
}
|
||||
'');
|
||||
|
||||
# Python-related config. Python does not support more features than
|
||||
# those in `ide-core`.
|
||||
python-config = (lib.optionalString python ''
|
||||
hook global WinSetOption filetype=python %{
|
||||
|
||||
${ide-core}
|
||||
|
||||
face window keyword rgb:${theme.green.bright}
|
||||
face window meta keyword
|
||||
|
||||
}
|
||||
'');
|
||||
|
||||
# Haskell development. Haskell has a language server with
|
||||
# the features in `ide-full`.
|
||||
haskell-config = (lib.optionalString haskell ''
|
||||
hook global WinSetOption filetype=haskell %{
|
||||
|
||||
${ide-full}
|
||||
|
||||
set-option buffer tabstop 2
|
||||
|
||||
face global variable rgb:${theme.purple.normal}
|
||||
face global attribute keyword
|
||||
face global operator keyword
|
||||
face global keyword rgb:${theme.blue.bright}
|
||||
face global value string
|
||||
face global meta rgb:${theme.pink.normal}
|
||||
|
||||
}
|
||||
'');
|
||||
|
||||
# Rust development. Rust's language servers all support the
|
||||
# `ide-full` features.
|
||||
rust-config = (lib.optionalString rust ''
|
||||
hook global WinSetOption filetype=rust %{
|
||||
|
||||
${ide-full}
|
||||
|
||||
hook global -group yeet ModuleLoaded rust %{
|
||||
|
||||
# Override the Rust highlighting with semantic
|
||||
# tokens supplied by the LSP client
|
||||
remove-hooks global rust-highlight
|
||||
remove-highlighter shared/rust
|
||||
|
||||
# Request tokens
|
||||
lsp-semantic-tokens
|
||||
|
||||
# Self-destruct this hook (it should only run once)
|
||||
remove-hooks global yeet
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
'');
|
||||
|
||||
in pkgs.writeTextFile (rec {
|
||||
name = "kakrc.kak";
|
||||
destination = "/share/kak/autoload/${name}";
|
||||
text = ''
|
||||
|
||||
colorscheme colors;
|
||||
|
||||
add-highlighter global/ number-lines -separator ' │ ' -hlcursor
|
||||
|
||||
set global tabstop 4
|
||||
|
||||
face global InlayHint rgb:828282
|
||||
face global InlayDiagnosticWarning rgb:a39e31+f
|
||||
face global InlayDiagnosticError rgb:ad494f+f
|
||||
face global InlayDiagnosticHint rgb:4d965a+f
|
||||
face global InlayDiagnosticInfo rgb:4d965a+f
|
||||
|
||||
${keybinds}
|
||||
|
||||
${typescript-config}
|
||||
${haskell-config}
|
||||
${python-config}
|
||||
${rust-config}
|
||||
${nix-config}
|
||||
|
||||
hook global KakBegin .* %{
|
||||
cursorline
|
||||
}
|
||||
'';
|
||||
})
|
|
@ -1,90 +0,0 @@
|
|||
{ config, pkgs, lib, ... }: with pkgs;
|
||||
|
||||
let lsp-config = (writeTextFile (rec {
|
||||
name = "kak-lsp.toml";
|
||||
destination = "/share/kak-lsp/${name}";
|
||||
text = let semTok = (name: value: ''
|
||||
[[semantic_tokens]]
|
||||
token = "${name}"
|
||||
face = "${value}"
|
||||
''); in ''
|
||||
|
||||
[language.rust]
|
||||
filetypes = [ "rust" ]
|
||||
roots = [ "Cargo.toml" ]
|
||||
command = "rust-analyzer"
|
||||
[language.rust.settings.rust-analyzer]
|
||||
semanticTokens = true
|
||||
diagnostics.enabled = [ "unresolved-proc-macro" ]
|
||||
cargo.loadOutDirsFromCheck = true
|
||||
procMacro.enable = false
|
||||
|
||||
[language.haskell]
|
||||
filetypes = [ "haskell" ]
|
||||
roots = [ "Setup.hs", "stack.yaml", "*.cabal" ]
|
||||
command = "haskell-language-server-wrapper"
|
||||
args = [ "--lsp" ]
|
||||
|
||||
[language.nix]
|
||||
filetypes = [ "nix" ]
|
||||
roots = [ "flake.nix", "shell.nix", ".git", ".hg" ]
|
||||
command = "rnix-lsp"
|
||||
|
||||
${lib.concatStringsSep "\n" (lib.mapAttrsToList semTok {
|
||||
"enumMember" = "variant";
|
||||
"enum" = "enum";
|
||||
"union" = "union";
|
||||
"struct" = "struct";
|
||||
"typeAlias" = "alias";
|
||||
"builtinType" = "primitive";
|
||||
"trait" = "trait";
|
||||
"interface" = "trait";
|
||||
"method" = "method";
|
||||
"function" = "function";
|
||||
"namespace" = "module";
|
||||
"boolean" = "literal";
|
||||
"character" = "literal";
|
||||
"number" = "literal";
|
||||
"string" = "string";
|
||||
"keyword" = "keyword";
|
||||
"documentation" = "comment";
|
||||
"comment" = "comment";
|
||||
"escapeSequence" = "format";
|
||||
"formatSpecifier" = "format";
|
||||
"operator" = "operator";
|
||||
"arithmetic" = "operator";
|
||||
"bitwise" = "operator";
|
||||
"comparison" = "operator";
|
||||
"logical" = "operator";
|
||||
"macro" = "macro";
|
||||
"lifetime" = "lifetime";
|
||||
"variable" = "variable";
|
||||
"attribute" = "attribute";
|
||||
"punctuation" = "punctuation";
|
||||
}) }
|
||||
'';
|
||||
}));
|
||||
|
||||
in [
|
||||
# Kakoune language server support
|
||||
(symlinkJoin {
|
||||
paths = with kakounePlugins; [
|
||||
|
||||
# The language server client
|
||||
kak-lsp
|
||||
|
||||
# Include default language servers
|
||||
rnix-lsp
|
||||
haskell-language-server
|
||||
|
||||
# Overwrite kak-lsp.toml
|
||||
lsp-config
|
||||
|
||||
];
|
||||
name = "kak-lsp-${kak-lsp.version}";
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
postBuild = ''
|
||||
wrapProgram $out/bin/kak-lsp --add-flags "--config $out/share/kak-lsp/kak-lsp.toml"
|
||||
'';
|
||||
})
|
||||
]
|
Loading…
Reference in New Issue