IDE mode letsgoo

This commit is contained in:
Riley Apeldoorn 2022-05-19 19:58:26 +02:00
parent 55a7cb8b00
commit d0e49183a0
6 changed files with 66 additions and 33 deletions

View File

@ -8,7 +8,15 @@
riley = {
gui = true;
kak.ide = true;
kak = {
enable = true;
haskell = true;
rust = true;
nix = true;
};
};
system.stateVersion = "21.11";

View File

@ -8,11 +8,13 @@ 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;

View File

@ -5,7 +5,7 @@ pkgs.writeTextFile (rec {
destination = "/share/kak/colors/${name}";
text = with theme; ''
face global comment rgb:525252
face global comment rgb:828282
face global value rgb:${blue.normal}
face global string rgb:${green.normal}
@ -20,7 +20,7 @@ pkgs.writeTextFile (rec {
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 crosshairs_line "default,rgb:212121"
face global MenuForeground "default,rgb:${blue.normal}"
face global MenuBackground "default,rgb:313131"

View File

@ -1,10 +1,23 @@
{ lib, pkgs, config, ... }:
let kakoune = import ./kakoune.nix; in
with pkgs.kakouneUtils;
let cfg = config.riley.kak;
theme = config.riley.theme;
kak-crosshairs = buildKakounePlugin (rec {
name = "kak-crosshairs";
src = (pkgs.fetchFromGitHub {
owner = "insipx";
repo = name;
rev = "7edba13c535ce1bc67356b1c9461f5d261949d29";
sha256 = "sha256-VOn9GGHludJasEwcCv6t1Q3/63w9139MCEkdRDnTw6E";
});
});
in
with lib; {
options.editor = {
options.riley = {
kak.enable = (mkEnableOption "kakoune editor") // { default = true; };
@ -16,18 +29,20 @@ with lib; {
};
config = with config.editor; mkIf (kak.enable) {
config = mkIf (cfg.enable) {
environment.systemPackages = [
(kakoune {
(import ./kakoune.nix {
inherit (kak) haskell python rust nix;
typescript = kak.ts;
typescript = cfg.ts;
haskell = cfg.haskell;
python = cfg.python;
rust = cfg.rust;
nix = cfg.nix;
kak-crosshairs = pkgs.kakounePlugins.kak-crosshairs;
inherit kak-crosshairs;
inherit pkgs lib;
theme = config.riley.theme;
inherit pkgs lib theme;
})
];

View File

@ -52,9 +52,9 @@ let semantic-tokens =
"punctuation" = "punctuation";
});
kak-lsp-config-text =
(optionalString (rust || haskell) semantic-tokens)
++ (optionalString rust ''
kak-lsp-config-text = concatStringsSep "\n" (
(optional (rust || haskell) semantic-tokens)
++ (optional rust ''
[language.rust]
filetypes = [ "rust" ]
roots = [ "Cargo.toml" ]
@ -65,31 +65,31 @@ let semantic-tokens =
cargo.loadOutDirsFromCheck = true
procMacro.enable = false
'')
++ (optionalString nix ''
++ (optional nix ''
[language.nix]
filetypes = [ "nix" ]
roots = [ "flake.nix", "shell.nix", ".git", ".hg" ]
command = "rnix-lsp"
'')
++ (optionalString haskell ''
++ (optional haskell ''
[language.haskell]
filetypes = [ "haskell" ]
roots = [ "Setup.hs", "stack.yaml", "*.cabal" ]
command = "haskell-language-server-wrapper"
args = [ "--lsp" ]
'')
++ (optionalString python ''
++ (optional python ''
[language.python]
filetypes = [ "python" ]
roots = [ "setup.py", ".git", ".hg" ]
command = "pylsp"
'')
++ (optionalString typescript ''
++ (optional typescript ''
[language.typescript]
filetypes = ["typescript", "javascript"]
roots = ["package.json"]
command = "rslint-lsp"
'');
''));
kak-lsp-config = (pkgs.writeTextFile (rec {
name = "kak-lsp.toml";

View File

@ -94,7 +94,7 @@ let nix-config = (lib.optionalString nix ''
${ide-core}
face window keyword rgb:${green.bright}
face window keyword rgb:${theme.green.bright}
face window meta keyword
}
@ -109,12 +109,12 @@ let nix-config = (lib.optionalString nix ''
set-option buffer tabstop 2
face global variable rgb:${purple.normal}
face global variable rgb:${theme.purple.normal}
face global attribute keyword
face global operator keyword
face global keyword rgb:${blue.bright}
face global keyword rgb:${theme.blue.bright}
face global value string
face global meta rgb:${pink.normal}
face global meta rgb:${theme.pink.normal}
}
'');
@ -147,9 +147,11 @@ let nix-config = (lib.optionalString nix ''
in pkgs.writeTextFile (rec {
name = "kakrc.kak";
destination = "/share/kak/autoload/${name}";
text = with theme; ''
text = ''
add-highlighter global/ number-lines -separator ' ' -hlcursor
colorscheme colors;
add-highlighter global/ number-lines -separator ' ' -hlcursor
set global tabstop 4
@ -159,10 +161,16 @@ in pkgs.writeTextFile (rec {
face global InlayDiagnosticHint rgb:4d965a+f
face global InlayDiagnosticInfo rgb:4d965a+f
'' ++ keybinds
++ typescript-config
++ haskell-config
++ python-config
++ rust-config
++ nix-config;
${keybinds}
${typescript-config}
${haskell-config}
${python-config}
${rust-config}
${nix-config}
hook global KakBegin .* %{
cursorline
}
'';
})