nichts/modules/editors/kakoune.nix

127 lines
3.8 KiB
Nix
Raw Normal View History

2024-05-22 14:29:45 +02:00
{
config,
lib,
pkgs,
...
}:
with lib; let
2024-05-21 20:51:26 +02:00
cfg = config.modules.editors.kakoune;
2024-05-18 17:49:42 +02:00
username = config.modules.other.system.username;
# inherit (inputs.kakoune.packages.${pkgs.system}) kakoun;
in {
2024-05-21 20:51:26 +02:00
options.modules.editors.kakoune.enable = mkEnableOption "kakoune";
2024-05-18 17:49:42 +02:00
config = mkIf cfg.enable {
home-manager.users.${username} = {
programs.kakoune = {
enable = true;
# extraConfig = builtins.readFile
# package = kakoun;
plugins = with pkgs.kakounePlugins; [
auto-pairs-kak
fzf-kak
powerline-kak
byline-kak
kakoune-lsp
# luar-kak
];
config = {
ui = {
statusLine = "top";
enableMouse = true;
assistant = "none";
};
2024-05-19 16:01:09 +02:00
# numberLines.enable = true;
# numberLines.relative = true;
# numberLines.highlightCursor = true;
2024-05-18 17:49:42 +02:00
# numberLines.separator = " ";
2024-05-19 16:01:09 +02:00
# showMatching = true;
# indentWidth = 2;
# tabStop = 2;
2024-05-18 17:49:42 +02:00
scrollOff.lines = 1;
scrollOff.columns = 3;
keyMappings = [
{
mode = "normal";
key = "<esc>";
effect = ";,";
2024-05-22 14:29:45 +02:00
docstring = "Press escape to clear highlighted text and collapse cursors";
2024-05-18 17:49:42 +02:00
}
{
mode = "normal";
key = "<c-v>";
effect = ":comment-line<ret>";
docstring = "Comment a line with <c-v>!";
}
{
mode = "normal";
key = "b";
effect = ":db<ret>";
docstring = "close current buffer";
}
{
mode = "normal";
key = "n";
effect = ":bp<ret>";
docstring = "go to next buffer";
}
{
mode = "normal";
key = "m";
effect = ":bn<ret>";
docstring = "go to next buffer";
}
2024-05-19 16:01:09 +02:00
{
mode = "normal";
key = " f";
effect = ":fzf-mode<ret>";
docstring = "open fzf";
}
2024-05-18 17:49:42 +02:00
];
};
2024-05-19 16:01:09 +02:00
extraConfig = ''
# display line numbers
add-highlighter global/ number-lines -hlcursor -relative -separator " " -cursor-separator " |"
# show matching symbols
add-highlighter global/ show-matching
# Intenting
set-option global tabstop 4
set-option global indentwidth 4
# Scrolloff
set-option global scrolloff 8,3
# spellcheck (requires aspell)
map -docstring "check document for spelling" global user w ": spell<ret>"
map -docstring "clear document spelling" global user q ": spell-clear<ret>"
plug "alexherbo2/auto-pairs.kak" config %{
enable-auto-pairs
}
plug "andreyorst/fzf.kak" config %{
require-module fzf
require-module fzf-grep
require-module fzf-file
} defer fzf %{
set-option global fzf_highlight_command "lat -r {}"
} defer fzf-file %{
set-option global fzf_file_command "fd . --no-ignore-vcs"
} defer fzf-grep %{
set-option global fzf_grep_command "fd"
}
plug "andreyorst/powerline.kak" defer kakoune-themes %{
powerline-theme pastel
} defer powerline %{
powerline-format global "git lsp bufname filetype mode_info lsp line_column position"
set-option global powerline_separator_thin ""
set-option global powerline_separator ""
} config %{
powerline-start
}
plug "evanrelf/byline.kak" config %{
require-module "byline"
}
'';
2024-05-18 17:49:42 +02:00
};
};
};
}