2021-11-09 21:15:22 +00:00
|
|
|
{ config, pkgs, lib, ... }:
|
2021-09-29 21:11:33 +00:00
|
|
|
|
|
|
|
let
|
2021-11-09 21:15:22 +00:00
|
|
|
kakounePkg =
|
|
|
|
pkgs.kakoune.override {
|
|
|
|
kakoune = pkgs.kakoune-unwrapped.overrideAttrs (oldAttrs: {
|
2022-07-06 20:26:50 +00:00
|
|
|
version = "r${builtins.substring 0 6 pkgs.sources.kakoune.rev}";
|
|
|
|
src = pkgs.sources.kakoune;
|
2021-11-09 21:15:22 +00:00
|
|
|
});
|
|
|
|
};
|
2022-01-30 18:49:25 +00:00
|
|
|
|
2022-09-02 21:07:53 +00:00
|
|
|
kak-lsp = pkgs.libs.crane.buildPackage {
|
|
|
|
src = pkgs.sources.kak-lsp;
|
|
|
|
buildInputs = (with pkgs;
|
|
|
|
lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ Security SystemConfiguration ])
|
|
|
|
) ++ (with pkgs; [ libiconv ]
|
|
|
|
);
|
|
|
|
};
|
2022-07-06 16:42:03 +00:00
|
|
|
|
2021-09-29 21:11:33 +00:00
|
|
|
in
|
|
|
|
{
|
2022-01-12 22:21:36 +00:00
|
|
|
imports = [ ../modules/programs/my-kakoune ./kaktex.nix ];
|
|
|
|
|
2022-07-06 16:42:03 +00:00
|
|
|
# ctags for peneira
|
|
|
|
home.packages = [ pkgs.universal-ctags ];
|
|
|
|
|
2021-11-09 21:15:22 +00:00
|
|
|
# Enable the kakoune package.
|
2022-01-12 20:55:53 +00:00
|
|
|
programs.my-kakoune.enable = true;
|
2022-01-12 22:21:36 +00:00
|
|
|
programs.my-kakoune.enable-fish-session = true;
|
2021-11-09 21:15:22 +00:00
|
|
|
programs.kak-lsp.enable = true;
|
2022-01-30 18:49:25 +00:00
|
|
|
programs.kak-lsp.package = kak-lsp;
|
2022-02-09 20:21:25 +00:00
|
|
|
programs.kak-lsp.languages.typescript = {
|
|
|
|
args = [ "--stdio" ];
|
|
|
|
command = "typescript-language-server";
|
|
|
|
filetypes = [ "typescript" ];
|
|
|
|
roots = [ "package.json" ];
|
|
|
|
};
|
2022-09-13 18:17:39 +00:00
|
|
|
programs.kak-lsp.languages.scala = {
|
|
|
|
command = "metals";
|
|
|
|
filetypes = [ "scala" ];
|
|
|
|
roots = [ "build.sbt" ];
|
|
|
|
};
|
2022-02-25 19:45:06 +00:00
|
|
|
programs.kak-lsp.languages.latex = {
|
|
|
|
command = "texlab";
|
|
|
|
filetypes = [ "latex" ];
|
|
|
|
roots = [ ".git" "main.tex" "all.tex" ];
|
|
|
|
settings_section = "texlab";
|
|
|
|
settings.texlab = {
|
|
|
|
build.executable = "latexmk";
|
|
|
|
build.args = [ "-pdf" "-shell-escape" "-interaction=nonstopmode" "-synctex=1" "%f" ];
|
|
|
|
|
|
|
|
build.forwardSearchAfter = true;
|
|
|
|
build.onSave = true;
|
|
|
|
|
|
|
|
forwardSearch =
|
|
|
|
(if pkgs.stdenv.isDarwin then {
|
|
|
|
executable = "/Applications/Skim.app/Contents/SharedSupport/displayline";
|
|
|
|
args = [ "-r" "-g" "%l" "%p" "%f" ];
|
2022-03-14 17:35:03 +00:00
|
|
|
} else
|
|
|
|
{
|
2022-09-29 07:54:53 +00:00
|
|
|
executable = "${pkgs.zathura}/bin/zathura";
|
|
|
|
args = [ "--synctex-forward" "%l:1:%f" "%p" "-x" "/home/nki/.bin/kaktex jump %{input} %{line}" ];
|
2022-03-14 17:35:03 +00:00
|
|
|
});
|
2022-02-25 19:45:06 +00:00
|
|
|
};
|
|
|
|
};
|
2021-11-09 20:59:22 +00:00
|
|
|
|
2022-01-12 20:55:53 +00:00
|
|
|
programs.my-kakoune.package = kakounePkg;
|
|
|
|
programs.my-kakoune.rc =
|
|
|
|
builtins.readFile ./kakrc + ''
|
2021-09-29 21:11:33 +00:00
|
|
|
|
2022-01-12 20:55:53 +00:00
|
|
|
# Source any settings in the current working directory,
|
|
|
|
# recursive upwards
|
|
|
|
evaluate-commands %sh{
|
|
|
|
${pkgs.writeScript "source-pwd" (builtins.readFile ./source-pwd)}
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
programs.my-kakoune.autoload = [
|
|
|
|
# My own scripts
|
|
|
|
{
|
|
|
|
name = "latex.kak";
|
|
|
|
src = ./autoload/latex.kak;
|
|
|
|
}
|
2021-11-09 21:15:22 +00:00
|
|
|
{
|
2022-01-12 20:55:53 +00:00
|
|
|
name = "markdown.kak";
|
|
|
|
src = ./autoload/markdown.kak;
|
2021-11-09 21:15:22 +00:00
|
|
|
}
|
2022-01-12 20:55:53 +00:00
|
|
|
|
2021-11-09 21:15:22 +00:00
|
|
|
# Plugins
|
|
|
|
{
|
2022-10-03 08:00:33 +00:00
|
|
|
name = "luar";
|
2022-07-06 16:42:03 +00:00
|
|
|
src = pkgs.fetchFromGitHub {
|
|
|
|
owner = "gustavo-hms";
|
|
|
|
repo = "luar";
|
|
|
|
rev = "2f430316f8fc4d35db6c93165e2e77dc9f3d0450";
|
|
|
|
sha256 = "sha256-vHn/V3sfzaxaxF8OpA5jPEuPstOVwOiQrogdSGtT6X4=";
|
|
|
|
};
|
2022-10-03 08:00:33 +00:00
|
|
|
activationScript = ''
|
2022-07-06 16:42:03 +00:00
|
|
|
# Enable luar
|
|
|
|
require-module luar
|
|
|
|
# Use luajit
|
|
|
|
set-option global luar_interpreter ${pkgs.luajit}/bin/luajit
|
|
|
|
'';
|
|
|
|
}
|
|
|
|
{
|
2022-10-03 08:00:33 +00:00
|
|
|
name = "peneira";
|
2021-11-09 21:15:22 +00:00
|
|
|
src = pkgs.fetchFromGitHub {
|
2022-07-06 16:42:03 +00:00
|
|
|
owner = "natsukagami";
|
|
|
|
repo = "peneira";
|
|
|
|
rev = "743b9971472853a752475e7c070ce99089c6840c";
|
|
|
|
sha256 = "sha256-E4ndbF9YC1p0KrvSuGgwmG1Y2IGTuGKJo/AuMixhzlM=";
|
2021-11-09 21:15:22 +00:00
|
|
|
};
|
2022-10-03 08:00:33 +00:00
|
|
|
activationScript = ''
|
2022-07-06 16:42:03 +00:00
|
|
|
require-module peneira
|
|
|
|
|
|
|
|
# Change selection color
|
|
|
|
set-face global PeneiraSelected @PrimarySelection
|
|
|
|
|
|
|
|
# Buffers list
|
|
|
|
define-command -hidden peneira-buffers %{
|
|
|
|
peneira 'buffers: ' %{ printf '%s\n' $kak_quoted_buflist } %{
|
|
|
|
buffer %arg{1}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-06 19:56:28 +00:00
|
|
|
# Grep in the current location
|
|
|
|
define-command peneira-grep %{
|
|
|
|
peneira 'line: ' "rg -n ." %{
|
|
|
|
lua %arg{1} %{
|
2022-07-07 19:17:14 +00:00
|
|
|
local file, line = arg[1]:match("([^:]+):(%d+):")
|
|
|
|
kak.edit(file, line)
|
2022-07-06 19:56:28 +00:00
|
|
|
}
|
2022-07-07 19:17:14 +00:00
|
|
|
}
|
|
|
|
}
|
2022-07-06 19:56:28 +00:00
|
|
|
|
2022-07-06 16:42:03 +00:00
|
|
|
# A peneira menu
|
|
|
|
declare-user-mode fuzzy-match-menu
|
|
|
|
|
|
|
|
map -docstring "Switch to buffer" global fuzzy-match-menu b ": peneira-buffers<ret>"
|
|
|
|
map -docstring "Symbols" global fuzzy-match-menu s ": peneira-symbols<ret>"
|
|
|
|
map -docstring "Lines" global fuzzy-match-menu l ": peneira-lines<ret>"
|
2022-07-06 19:56:28 +00:00
|
|
|
map -docstring "Lines in the current directory" global fuzzy-match-menu g ": peneira-grep<ret>"
|
2022-07-06 16:42:03 +00:00
|
|
|
map -docstring "Files in project" global fuzzy-match-menu f ": peneira-files<ret>"
|
|
|
|
map -docstring "Files in currently opening file's directory" global fuzzy-match-menu F ": peneira-local-files<ret>"
|
|
|
|
|
|
|
|
# Bind menu to user mode
|
|
|
|
map -docstring "Fuzzy matching" global user f ": enter-user-mode fuzzy-match-menu<ret>"
|
|
|
|
'';
|
|
|
|
}
|
2022-07-07 19:17:14 +00:00
|
|
|
{
|
2022-10-03 08:00:33 +00:00
|
|
|
name = "kakoune-focus";
|
2022-07-07 19:17:14 +00:00
|
|
|
src = pkgs.fetchFromGitHub {
|
|
|
|
owner = "caksoylar";
|
|
|
|
repo = "kakoune-focus";
|
|
|
|
rev = "949c0557cd4c476822acfa026ca3c50f3d38a3c0";
|
|
|
|
sha256 = "sha256-ZV7jlLJQyL420YG++iC9rq1SMjo3WO5hR9KVvJNUiCs=";
|
|
|
|
};
|
2022-10-03 08:00:33 +00:00
|
|
|
activationScript = ''
|
2022-07-07 19:17:14 +00:00
|
|
|
map global user <space> ': focus-toggle<ret>' -docstring "toggle selections focus"
|
|
|
|
'';
|
|
|
|
}
|
2021-11-09 21:15:22 +00:00
|
|
|
{
|
|
|
|
name = "kakoune-inc-dec";
|
|
|
|
src = pkgs.fetchFromGitLab {
|
|
|
|
owner = "Screwtapello";
|
|
|
|
repo = "kakoune-inc-dec";
|
|
|
|
rev = "7bfe9c51";
|
|
|
|
sha256 = "0f33wqxqbfygxypf348jf1fiscac161wf2xvnh8zwdd3rq5yybl0";
|
|
|
|
};
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "racket.kak";
|
|
|
|
src = (builtins.fetchTree {
|
|
|
|
type = "git";
|
|
|
|
url = "https://bitbucket.org/KJ_Duncan/kakoune-racket.kak.git";
|
|
|
|
rev = "e397042009b46916ff089d79166ec0e8ca813a18";
|
|
|
|
narHash = "sha256-IcxFmvG0jqpMCG/dT9crVRgPgMGKkic6xwrnW5z4+bc=";
|
|
|
|
}) + "/rc";
|
|
|
|
}
|
2022-06-02 20:11:48 +00:00
|
|
|
{
|
|
|
|
name = "kakoune-discord";
|
|
|
|
src = (builtins.getFlake "github:natsukagami/kakoune-discord/03f95e40d6efd8fd3de7bca31653d43de2dcfc5f").packages.${pkgs.system}.kakoune-discord-rc + "/rc";
|
|
|
|
}
|
2022-10-03 08:00:33 +00:00
|
|
|
rec {
|
|
|
|
name = "kakoune-mirror";
|
|
|
|
src = pkgs.fetchFromGitHub
|
|
|
|
{
|
|
|
|
owner = "Delapouite";
|
|
|
|
repo = "kakoune-mirror";
|
|
|
|
rev = "5710635f440bcca914d55ff2ec1bfcba9efe0f15";
|
|
|
|
sha256 = "sha256-uslx4zZhvjUylrPWvTOugsKYKKpF0EEz1drc1Ckrpjk=";
|
|
|
|
} + "/mirror.kak";
|
|
|
|
wrapAsModule = true;
|
|
|
|
activationScript = ''
|
|
|
|
require-module ${name}
|
|
|
|
|
|
|
|
# Bind <a-w> to ${name}
|
|
|
|
map global normal <a-w> ': enter-user-mode -lock mirror<ret>'
|
|
|
|
'';
|
|
|
|
}
|
2022-10-09 15:12:29 +00:00
|
|
|
{
|
|
|
|
name = "unicode-math";
|
|
|
|
src = pkgs.fetchFromGitHub {
|
|
|
|
owner = "natsukagami";
|
|
|
|
repo = "kakoune-unicode-math";
|
|
|
|
rev = "75b25c507234addd6e56f7cbd9b913357c322004";
|
|
|
|
# sha256 = lib.fakeSha256;
|
|
|
|
sha256 = "sha256-MG0jzFBVudEjQ2OIBr+MipYjXCvWFSk1q+q8YsO4jLo=";
|
|
|
|
fetchSubmodules = true;
|
|
|
|
};
|
|
|
|
activationScript = ''
|
|
|
|
require-module unicode-math
|
|
|
|
|
|
|
|
# Bind <c-s> to the menu
|
|
|
|
map global insert <c-s> '<a-;>: insert-unicode '
|
|
|
|
'';
|
|
|
|
}
|
2022-01-12 20:55:53 +00:00
|
|
|
];
|
2021-09-29 21:11:33 +00:00
|
|
|
}
|
2022-04-11 18:09:07 +00:00
|
|
|
|