222 lines
6.2 KiB
Nix
222 lines
6.2 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}: let
|
|
yazi =
|
|
pkgs.writeText "open_in_helix_from_yazi.zsh"
|
|
''
|
|
#! ~/.nix-profile/bin/zsh
|
|
files=(''${(fqq)"$( yazi --chooser-file=/dev/stdout | cat )"})
|
|
zellij action toggle-floating-panes
|
|
zellij action write 27 # send escape-key
|
|
zellij action write-chars ":open $files"
|
|
zellij action write 13 # send enter-key
|
|
zellij action toggle-floating-panes
|
|
zellij action close-pane
|
|
'';
|
|
jupyter =
|
|
pkgs.writeText "run_jupyter_from_helix.zsh"
|
|
''
|
|
#! ~/.nix-profile/bin/zsh
|
|
function is_new() {
|
|
new=true;
|
|
touch /tmp/rjh;
|
|
cat /tmp/rjh | while read line
|
|
do
|
|
if $(pwd) = line; then
|
|
new=false;
|
|
fi
|
|
done
|
|
echo new;
|
|
}
|
|
|
|
function send_to_jupyter() {
|
|
if $(is_new); then
|
|
zellij run -f -n "jupyter console" -- direnv exec . jupyter console --kernel="$1" -f="/tmp/rjh-$(pwd | tr \"/\" -).json" --ZMQTerminalInteractiveShell.include_other_output=True --ZMQTerminalInteractiveShell.other_output_prefix=\'\'
|
|
pwd >> /tmp/rjh
|
|
fi
|
|
zellij write 29 25 # send ctr + w
|
|
cat | just send
|
|
}
|
|
send_to_jupyter
|
|
'';
|
|
in {
|
|
programs.helix = {
|
|
enable = true;
|
|
defaultEditor = true;
|
|
|
|
settings = {
|
|
# theme = "catppuccin_macchiato"; # Don't need this because the module themes it for us
|
|
keys.normal.backspace = {
|
|
b = ":sh zellij run -f -n 'build code' -- direnv exec . just build";
|
|
r = ":sh zellij run -f -n 'run code' -- direnv exec . just run";
|
|
t = ":sh zellij run -f -n 'test code' -- direnv exec . just test";
|
|
g = ":sh zellij run -fc -n 'lazygit' -- lazygit";
|
|
f = ":sh zellij run --floating -n 'yazi picker' -- zsh ~/.config/helix/open_in_helix_from_yazi.zsh ";
|
|
j = ":pipe-to just jupyter";
|
|
};
|
|
editor = {
|
|
line-number = "relative";
|
|
lsp.display-messages = true;
|
|
lsp.display-inlay-hints = true;
|
|
cursor-shape = {
|
|
insert = "bar";
|
|
normal = "block";
|
|
select = "underline";
|
|
};
|
|
cursorline = true;
|
|
bufferline = "always";
|
|
color-modes = true;
|
|
soft-wrap = {
|
|
enable = true;
|
|
max-wrap = 25;
|
|
wrap-indicator = "";
|
|
};
|
|
};
|
|
};
|
|
languages = {
|
|
language = [
|
|
{
|
|
name = "python";
|
|
language-id = "python";
|
|
auto-format = true;
|
|
file-types = ["py"];
|
|
language-servers = ["ruff" "scls" "pylsp"];
|
|
}
|
|
{
|
|
name = "typst";
|
|
language-id = "typst";
|
|
auto-format = false;
|
|
file-types = ["typ"];
|
|
language-servers = ["typst-lsp" "scls"];
|
|
}
|
|
{
|
|
name = "rust";
|
|
language-id = "rust";
|
|
auto-format = true;
|
|
file-types = ["rs"];
|
|
roots = ["Cargo.lock"];
|
|
language-servers = ["rust-analyzer" "scls"];
|
|
}
|
|
{
|
|
name = "stub";
|
|
scope = "text.stub";
|
|
file-types = [];
|
|
shebangs = [];
|
|
roots = [];
|
|
auto-format = false;
|
|
language-servers = ["scls"];
|
|
}
|
|
{
|
|
name = "nix";
|
|
language-id = "nix";
|
|
auto-format = true;
|
|
file-types = ["nix"];
|
|
roots = ["flake.lock" "flake.nix"];
|
|
language-servers = ["nil" "scls"];
|
|
formatter = {
|
|
command = "alejandra";
|
|
args = ["-q"];
|
|
};
|
|
}
|
|
{
|
|
name = "html";
|
|
language-id = "html";
|
|
auto-format = true;
|
|
file-types = ["htm" "html"];
|
|
language-servers = ["vscode-html-language-server" "vscode-eslint-language-server"];
|
|
}
|
|
{
|
|
name = "css";
|
|
language-id = "css";
|
|
auto-format = true;
|
|
file-types = ["css"];
|
|
language-servers = ["vscode-css-language-server" "vscode-eslint-language-server"];
|
|
}
|
|
{
|
|
name = "json";
|
|
language-id = "json";
|
|
auto-format = true;
|
|
file-types = ["json"];
|
|
language-servers = ["vscode-json-language-server" "vscode-eslint-language-server"];
|
|
}
|
|
];
|
|
language-server = {
|
|
vscode-html-language-server = {
|
|
command = "vscode-html-language-server";
|
|
};
|
|
vscode-css-language-server = {
|
|
command = "vscode-css-language-server";
|
|
};
|
|
vscode-eslint-language-server = {
|
|
command = "vscode-eslint-language-server";
|
|
};
|
|
vscode-json-language-server = {
|
|
command = "vscode-json-language-server";
|
|
};
|
|
pylsp = {
|
|
config.pylsp.plugins = {
|
|
flake8 = {enabled = false;};
|
|
autopep8 = {enabled = false;};
|
|
mccabe = {enabled = false;};
|
|
pycodestyle = {enabled = false;};
|
|
pyflakes = {enabled = false;};
|
|
pylint = {enabled = false;};
|
|
yapf = {enabled = false;};
|
|
ruff = {
|
|
enabled = true;
|
|
select = ["E" "F" "UP" "B" "SIM" "I" "PD" "NPY" "PERF" "FURB" "DOC" "TRY" "W" "R" "PL" "TCH" "Q" "PT" "ICN" "C4" "COM" "FBT" "S" "N"];
|
|
ignore = ["F401"];
|
|
lineLength = 120;
|
|
};
|
|
};
|
|
};
|
|
ruff = {
|
|
command = "ruff-lsp";
|
|
};
|
|
typst-lsp = {
|
|
command = "typst-lsp";
|
|
};
|
|
rust-analyzer = {
|
|
command = "rust-analyzer";
|
|
};
|
|
nil = {
|
|
command = "nil";
|
|
};
|
|
scls = {
|
|
command = "simple-completion-language-server";
|
|
config = {
|
|
max_completion_items = 20;
|
|
snippets_first = true;
|
|
feature_words = true;
|
|
feature_snippets = true;
|
|
feature_unicode_input = true;
|
|
feature_paths = true;
|
|
};
|
|
};
|
|
};
|
|
};
|
|
};
|
|
home.file = {
|
|
"helix" = {
|
|
source = ./snippets.toml;
|
|
target = ".config/helix/external-snippets.toml";
|
|
};
|
|
};
|
|
|
|
home.file = {
|
|
"yazi" = {
|
|
source = "${yazi}";
|
|
target = ".config/helix/open_in_helix_from_yazi.zsh";
|
|
};
|
|
};
|
|
home.file = {
|
|
"jupyter" = {
|
|
source = "${jupyter}";
|
|
target = ".config/helix/run_jupyter_from_helix.zsh";
|
|
};
|
|
};
|
|
}
|