jj, fish, better kanata, etc

This commit is contained in:
Jonathan Dönszelmann 2024-12-30 09:33:16 +01:00
parent 52b1728e2e
commit d030ebe744
No known key found for this signature in database
17 changed files with 1642 additions and 938 deletions

324
flake.lock generated
View file

@ -21,7 +21,42 @@
"type": "github"
}
},
"dumpasm": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1732916787,
"narHash": "sha256-CIidjQcQNvwuxMOGc6WKVTXO4MWTOp+Rr5HN2ZCRR58=",
"owner": "jdonszelmann",
"repo": "dumpasm",
"rev": "8f2bb630aa90bddf3ada83e5a57eba6aa42a06f5",
"type": "github"
},
"original": {
"owner": "jdonszelmann",
"repo": "dumpasm",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_2": {
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
@ -43,11 +78,11 @@
]
},
"locked": {
"lastModified": 1730504689,
"narHash": "sha256-hgmguH29K2fvs9szpq2r3pz2/8cJd2LPS+b4tfNFCwE=",
"lastModified": 1733312601,
"narHash": "sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "506278e768c2a08bec68eb62932193e341f55c90",
"rev": "205b12d8b7cd4802fbcb8e8ef6a0f1408781a4f9",
"type": "github"
},
"original": {
@ -61,11 +96,11 @@
"systems": "systems"
},
"locked": {
"lastModified": 1726560853,
"narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=",
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
@ -79,11 +114,11 @@
"systems": "systems_2"
},
"locked": {
"lastModified": 1726560853,
"narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=",
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
@ -96,6 +131,60 @@
"inputs": {
"systems": "systems_3"
},
"locked": {
"lastModified": 1705309234,
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_4": {
"inputs": {
"systems": "systems_4"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_5": {
"inputs": {
"systems": "systems_5"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_6": {
"inputs": {
"systems": "systems_6"
},
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
@ -110,6 +199,31 @@
"type": "github"
}
},
"ghostty": {
"inputs": {
"flake-compat": "flake-compat",
"nixpkgs-stable": [
"nixpkgs"
],
"nixpkgs-unstable": [
"nixpkgs"
],
"zig": "zig"
},
"locked": {
"lastModified": 1735271978,
"narHash": "sha256-y6Ony5eq4F4E76Y2ZhALSEzBZ4GbGRVQIEScPieCDGI=",
"owner": "ghostty-org",
"repo": "ghostty",
"rev": "a8e5eef11cc67f87f445626f9ca2993373774bf8",
"type": "github"
},
"original": {
"owner": "ghostty-org",
"repo": "ghostty",
"type": "github"
}
},
"git-hooks": {
"inputs": {
"flake-compat": [
@ -127,11 +241,11 @@
]
},
"locked": {
"lastModified": 1730814269,
"narHash": "sha256-fWPHyhYE6xvMI1eGY3pwBTq85wcy1YXqdzTZF+06nOg=",
"lastModified": 1733318908,
"narHash": "sha256-SVQVsbafSM1dJ4fpgyBqLZ+Lft+jcQuMtEL3lQWx2Sk=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "d70155fdc00df4628446352fc58adc640cd705c2",
"rev": "6f4e2a2112050951a314d2733a994fbab94864c6",
"type": "github"
},
"original": {
@ -169,11 +283,11 @@
]
},
"locked": {
"lastModified": 1730837930,
"narHash": "sha256-0kZL4m+bKBJUBQse0HanewWO0g8hDdCvBhudzxgehqc=",
"lastModified": 1733873195,
"narHash": "sha256-dTosiZ3sZ/NKoLKQ++v8nZdEHya0eTNEsaizNp+MUPM=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "2f607e07f3ac7e53541120536708e824acccfaa8",
"rev": "f26aa4b76fb7606127032d33ac73d7d507d82758",
"type": "github"
},
"original": {
@ -190,11 +304,11 @@
]
},
"locked": {
"lastModified": 1730837930,
"narHash": "sha256-0kZL4m+bKBJUBQse0HanewWO0g8hDdCvBhudzxgehqc=",
"lastModified": 1733484277,
"narHash": "sha256-i5ay20XsvpW91N4URET/nOc0VQWOAd4c4vbqYtcH8Rc=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "2f607e07f3ac7e53541120536708e824acccfaa8",
"rev": "d00c6f6d0ad16d598bf7e2956f52c1d9d5de3c3a",
"type": "github"
},
"original": {
@ -231,6 +345,28 @@
"type": "github"
}
},
"jujutsu": {
"inputs": {
"flake-utils": "flake-utils_4",
"nixpkgs": [
"nixpkgs"
],
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1733881065,
"narHash": "sha256-RBr3jfh8dtDKeYLmJYZvNj2U2jiA1AY1jx4GbQDNOU0=",
"owner": "martinvonz",
"repo": "jj",
"rev": "e1936a2e8bc22218e3a5729fed89b8cc5c5cbb83",
"type": "github"
},
"original": {
"owner": "martinvonz",
"repo": "jj",
"type": "github"
}
},
"kitty-search": {
"flake": false,
"locked": {
@ -255,11 +391,11 @@
]
},
"locked": {
"lastModified": 1730779758,
"narHash": "sha256-5WI9AnsBwhLzVRnQm3Qn9oAbROnuLDQTpaXeyZCK8qw=",
"lastModified": 1733570843,
"narHash": "sha256-sQJAxY1TYWD1UyibN/FnN97paTFuwBw3Vp3DNCyKsMk=",
"owner": "lnl7",
"repo": "nix-darwin",
"rev": "0e3f3f017c14467085f15d42343a3aaaacd89bcb",
"rev": "a35b08d09efda83625bef267eb24347b446c80b8",
"type": "github"
},
"original": {
@ -270,11 +406,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1730785428,
"narHash": "sha256-Zwl8YgTVJTEum+L+0zVAWvXAGbWAuXHax3KzuejaDyo=",
"lastModified": 1732521221,
"narHash": "sha256-2ThgXBUXAE1oFsVATK1ZX9IjPcS4nKFOAjhPNKuiMn0=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "4aa36568d413aca0ea84a1684d2d46f55dbabad7",
"rev": "4633a7c72337ea8fd23a4f2ba3972865e3ec685d",
"type": "github"
},
"original": {
@ -285,6 +421,22 @@
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1733759999,
"narHash": "sha256-463SNPWmz46iLzJKRzO3Q2b0Aurff3U1n0nYItxq7jU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "a73246e2eef4c6ed172979932bc80e1404ba2d56",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1710377395,
"narHash": "sha256-KMubsUWtVr7L55pXMBibBDBdmk3xrjbBPduc0E8z28c=",
@ -301,7 +453,7 @@
"nixvim": {
"inputs": {
"devshell": "devshell",
"flake-compat": "flake-compat",
"flake-compat": "flake-compat_2",
"flake-parts": "flake-parts",
"git-hooks": "git-hooks",
"home-manager": "home-manager_2",
@ -313,11 +465,11 @@
"treefmt-nix": "treefmt-nix"
},
"locked": {
"lastModified": 1731009822,
"narHash": "sha256-VwGfFYHjizs7yQwh8JRlDUVkHLPc34jdqkQ2vyv6ddY=",
"lastModified": 1733847310,
"narHash": "sha256-VHzWuZYK/m5OFXzAczrjnI7vH6knj0sfLnziRVDqgFE=",
"owner": "nix-community",
"repo": "nixvim",
"rev": "aabbd60633947baba11db44df84f402edc241440",
"rev": "b752606681ded3f69e99ed568c7075b3578dce48",
"type": "github"
},
"original": {
@ -328,7 +480,7 @@
},
"nuschtosSearch": {
"inputs": {
"flake-utils": "flake-utils_2",
"flake-utils": "flake-utils_5",
"ixx": "ixx",
"nixpkgs": [
"nixvim",
@ -336,11 +488,11 @@
]
},
"locked": {
"lastModified": 1730760712,
"narHash": "sha256-F4H98tjNgySlSLItuOqHYo9LF85rFoS/Vr0uOrq7BM4=",
"lastModified": 1733411491,
"narHash": "sha256-315rJ7O9cOllPDaFscnJhcMleORHbxon0Kq9LAKJ5p4=",
"owner": "NuschtOS",
"repo": "search",
"rev": "aa5214c81b904a19f7a54f7a8f288f7902586eee",
"rev": "68e9fad70d95d08156cf10a030bd39487bed8ffe",
"type": "github"
},
"original": {
@ -351,14 +503,38 @@
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"dumpasm": "dumpasm",
"flake-utils": "flake-utils_2",
"ghostty": "ghostty",
"home-manager": "home-manager",
"jujutsu": "jujutsu",
"kitty-search": "kitty-search",
"nixpkgs": "nixpkgs",
"nixpkgs": "nixpkgs_2",
"nixvim": "nixvim",
"t": "t"
}
},
"rust-overlay": {
"inputs": {
"nixpkgs": [
"jujutsu",
"nixpkgs"
]
},
"locked": {
"lastModified": 1732242723,
"narHash": "sha256-NWI8csIK0ujFlFuEXKnoc+7hWoCiEtINK9r48LUUMeU=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "a229311fcb45b88a95fdfa5cecd8349c809a272a",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
@ -404,10 +580,55 @@
"type": "github"
}
},
"systems_4": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_5": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_6": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"t": {
"inputs": {
"flake-utils": "flake-utils_3",
"nixpkgs": "nixpkgs_2"
"flake-utils": "flake-utils_6",
"nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1710410762,
@ -431,11 +652,11 @@
]
},
"locked": {
"lastModified": 1730321837,
"narHash": "sha256-vK+a09qq19QNu2MlLcvN4qcRctJbqWkX7ahgPZ/+maI=",
"lastModified": 1733440889,
"narHash": "sha256-qKL3vjO+IXFQ0nTinFDqNq/sbbnnS5bMI1y0xX215fU=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "746901bb8dba96d154b66492a29f5db0693dbfcc",
"rev": "50862ba6a8a0255b87377b9d2d4565e96f29b410",
"type": "github"
},
"original": {
@ -443,6 +664,31 @@
"repo": "treefmt-nix",
"type": "github"
}
},
"zig": {
"inputs": {
"flake-compat": [
"ghostty"
],
"flake-utils": "flake-utils_3",
"nixpkgs": [
"ghostty",
"nixpkgs-stable"
]
},
"locked": {
"lastModified": 1717848532,
"narHash": "sha256-d+xIUvSTreHl8pAmU1fnmkfDTGQYCn2Rb/zOwByxS2M=",
"owner": "mitchellh",
"repo": "zig-overlay",
"rev": "02fc5cc555fc14fda40c42d7c3250efa43812b43",
"type": "github"
},
"original": {
"owner": "mitchellh",
"repo": "zig-overlay",
"type": "github"
}
}
},
"root": "root",

View file

@ -13,55 +13,92 @@
};
t.url = "github:jdonszelmann/t-rs";
dumpasm.url = "github:jdonszelmann/dumpasm";
kitty-search = {
url = "github:trygveaa/kitty-kitten-search";
flake = false;
};
jujutsu = {
url = "github:martinvonz/jj";
inputs.nixpkgs.follows = "nixpkgs";
};
ghostty = {
url = "github:ghostty-org/ghostty";
inputs.nixpkgs-stable.follows = "nixpkgs";
inputs.nixpkgs-unstable.follows = "nixpkgs";
};
};
outputs = { home-manager, nixpkgs, flake-utils, nixvim, t, ... }@inputs:
outputs =
{
home-manager,
nixpkgs,
flake-utils,
nixvim,
t,
dumpasm,
jujutsu,
ghostty,
...
}@inputs:
let
homeManagerModules = [ nixvim.homeManagerModules.nixvim ];
pkgsForSystem = system:
pkgsForSystem =
system:
import nixpkgs {
inherit system;
config.allowUnfree = true;
overlays = [
(_: _: { custom = { t = t.packages.${system}.default; }; })
(_: _: {
custom = {
t = t.packages.${system}.default;
inherit (dumpasm.packages.${system}) dumpasm;
inherit (jujutsu.packages.${system}) jujutsu;
inherit (ghostty.packages.${system}) ghostty;
};
})
];
};
mkHomeConfiguration = root: args:
home-manager.lib.homeManagerConfiguration ({
modules = [ root ] ++ homeManagerModules ++ (args.modules or [ ]);
pkgs = pkgsForSystem (args.system or "x86_64-linux");
} // {
inherit (args) extraSpecialArgs;
});
mkHomeConfiguration =
root: args:
home-manager.lib.homeManagerConfiguration (
{
modules = [ root ] ++ homeManagerModules ++ (args.modules or [ ]);
pkgs = pkgsForSystem (args.system or "x86_64-linux");
}
// {
inherit (args) extraSpecialArgs;
}
);
in
flake-utils.lib.eachDefaultSystem
(system: rec {
formatter = legacyPackages.nixfmt-classic;
legacyPackages = pkgsForSystem system;
pkgs = legacyPackages;
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
(pkgs.writeShellScriptBin "fast-repl" ''
source /etc/set-environment
nix repl --file "${./.}/repl.nix" $@
'')
flake-utils.lib.eachDefaultSystem (system: rec {
formatter = legacyPackages.nixfmt-classic;
legacyPackages = pkgsForSystem system;
pkgs = legacyPackages;
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
(pkgs.writeShellScriptBin "fast-repl" ''
source /etc/set-environment
nix repl --file "${./.}/repl.nix" $@
'')
(pkgs.writeShellScriptBin "apply-home" ''
nix run .#home-manager -- switch --flake .#$@
'')
(pkgs.writeShellScriptBin "apply-home" ''
nix run .#home-manager -- switch --flake .#$@
'')
(pkgs.writeShellScriptBin "apply" ''
apply-home $(hostname -f)
'')
];
};
}) // {
(pkgs.writeShellScriptBin "apply" ''
apply-home $(hostname -f)
'')
];
};
})
// {
homeConfigurations = {
kili = mkHomeConfiguration (import ./hosts/kili/home.nix) {

View file

@ -1,18 +1,18 @@
{ pkgs, ... }: {
home.stateVersion = "24.05";
home.username = "jonathan";
home.homeDirectory = "/home/jonathan";
home = {
stateVersion = "24.05";
username = "jonathan";
homeDirectory = "/home/jonathan";
sessionVariables.PATH = "$HOME/.nix-profile/bin:$PATH";
};
imports = [
../../programs/nvim
../../programs/zsh
../../programs/fish
../../programs/tmux
../../programs/git
];
home.sessionVariables.PATH = "$HOME/.nix-profile/bin:$PATH";
home.packages = with pkgs; [
atuin
../../programs/jj
];
}

View file

@ -1,15 +1,19 @@
{ pkgs, ... }: {
home.stateVersion = "24.05";
home.username = "jonathan";
home.homeDirectory = "/home/jonathan";
{ config, pkgs, ... }: {
home = {
stateVersion = "24.05";
username = "jonathan";
homeDirectory = "/home/jonathan";
packages = with pkgs; [config.programs.neovim.package];
};
imports = [
../../programs/nvim
../../programs/zsh
../../programs/fish
../../programs/kanata
../../programs/kitty
../../programs/tmux
../../programs/git
../../programs/jj
];
# use the system-installed version of kitty on arch

View file

@ -1,45 +1,47 @@
{ pkgs, ... }: {
home.stateVersion = "24.05";
home.username = "jonathan";
home.homeDirectory = "/home/jonathan";
home = {
stateVersion = "24.05";
username = "jonathan";
homeDirectory = "/home/jonathan";
packages = with pkgs; [
element-desktop
discord-canary
comma
(python3.withPackages (pip: with pip; [ numpy matplotlib ]))
spotify
firefox
chromium
syncthing
nixfmt
xdg-utils
# to copy from the command line (my fish config has an alias `cb` to pipe things to the clipboard)
wl-clipboard-rs
prismlauncher
graphviz-nox
inkscape
gimp
xournalpp
libreoffice
dogdns
jetbrains.rust-rover
vlc
audacity
];
};
imports = [
../../programs/gnome
../../programs/nvim
../../programs/zsh
../../programs/fish
../../programs/git
];
home.packages = with pkgs; [
element-desktop
atuin
discord-canary
comma
(python3.withPackages (pip: with pip; [ numpy matplotlib ]))
spotify
firefox
chromium
syncthing
nixfmt
xdg-utils
# to copy from the command line (my zsh config has an alias `clip` to pipe things to the clipboard)
wl-clipboard-rs
prismlauncher
graphviz-nox
inkscape
gimp
xournalpp
libreoffice
dogdns
jetbrains.rust-rover
vlc
audacity
../../programs/jj
];
programs.firefox = { enable = true; };
services.syncthing = { enable = true; };
}

211
programs/fish/default.nix Normal file
View file

@ -0,0 +1,211 @@
{
config,
pkgs,
lib,
...
}:
with builtins;
with lib.attrsets;
let
scripts = (import ./scripts.nix) pkgs;
aliases = with scripts; {
"cp-mov" = cp-media "mov" "movies";
"cp-ser" = cp-media "ser" "shows";
"cp-ani" = cp-media "ani" "anime";
"dumpasm" = "${pkgs.custom.dumpasm}/bin/dumpasm";
"p" = calc;
"s" = "systemctl";
"j" = "journalctl";
"ju" = "journalctl -u";
"jfu" = "journalctl -fu";
"ls" = "${pkgs.eza}/bin/eza --git";
"ll" = "${pkgs.eza}/bin/eza --git";
"lt" = "${pkgs.eza}/bin/eza --long --tree -L 3";
"open" = "${pkgs.xdg-utils}/bin/xdg-open";
"cb" = "${pkgs.wl-clipboard-rs}/bin/wl-copy";
"cat" = "${pkgs.bat}/bin/bat";
"pull" = "${pkgs.git}/bin/git pull";
"push" = "${pkgs.git}/bin/git push";
"commit" = "${pkgs.git}/bin/git commit";
"add" = "${pkgs.git}/bin/git add";
"patch" = "${pkgs.git}/bin/git add -p";
"amend" = "${pkgs.git}/bin/git commit --amend";
"log" = "${pkgs.git}/bin/git log --all --graph --decorate";
"st" = "${pkgs.git}/bin/git status";
"checkout" = "${pkgs.git}/bin/git checkout";
"rebase" = "${pkgs.git}/bin/git rebase";
"stash" = "${pkgs.git}/bin/git stash";
"f" = "nautilus --no-desktop . &";
};
# extracting any compressed format
extract = ''
function extract -a file -d "decompress a file"
if not test -f $file
echo "'$file' is not a valid file"
return 1
end
switch $file
# tar can automatically figure out how to decompress
case '*.{tar,tar.{bz2,zst,gz,xz},tbz2,tgz'; ${pkgs.gnutar}/bin/tar xf $file; end
case '*.bz2'; bunzip2 $file; end
case '*.rar'; unrar e $file; end
case '*.gz'; gunzip $file; end
case '*.zip'; ${pkgs.unzip}/bin/unzip $file; end
case '*.Z'; uncompress $file; end
case '*.7z'; 7z x $file; end
case '*';
echo "'$file' cannot be extracted"
return 1
end
end
'';
in
{
programs = {
atuin = {
enable = true;
enableFishIntegration = true;
settings = {
filter_mode_shell_up_key_binding = "directory";
exit_mode = "return-original";
workspaces = true;
};
};
zoxide = {
enable = true;
enableFishIntegration = true;
};
direnv = {
enable = true;
# enableFishIntegration = lib.mkDefault true;
};
fzf = {
enable = true;
enableFishIntegration = true;
};
fish = {
enable = true;
shellAliases = aliases;
plugins = with pkgs.fishPlugins; [
{
name = "tide";
inherit (tide) src;
}
{
name = "sponge";
inherit (sponge) src;
}
{
name = "autopair";
inherit (autopair) src;
}
];
functions = {
fish_jj_prompt = {
body = ''
if not ${config.programs.jujutsu.package}/bin/jj root --quiet &>/dev/null
return 1
end
${config.programs.jujutsu.package}/bin/jj log --ignore-working-copy --no-graph --color always -r @ -T '
separate(
" ",
bookmarks.join(", "),
change_id.shortest(),
commit_id.shortest(),
if(conflict, "conflict"),
if(empty, "empty"),
if(divergent, "divergent"),
if(hidden, "hidden"),
)
'
'';
};
_tide_item_jj = {
body = ''
set -l _tide_item_jj_color $_tide_location_color
echo -ns $_tide_item_jj_color" ("(fish_jj_prompt)$_tide_item_jj_color")"
'';
};
_tide_item_git = {
body = ''
if not test -d .jj
fish_git_prompt '%s'
end
'';
};
};
interactiveShellInit = ''
fish_vi_key_bindings
set -g sponge_successful_exit_codes 0
set -g sponge_allow_previously_successful false
set -g sponge_delay 10
${config.programs.jujutsu.package}/bin/jj util completion fish | source
if set -q tide_left_prompt_items; and not contains "jj" $tide_left_prompt_items
set -l tide_item_jj_idx (contains -i "pwd" $tide_left_prompt_items)
if test $tide_item_jj_idx
set tide_left_prompt_items \
$tide_left_prompt_items[1..$tide_item_jj_idx] \
jj \
$tide_left_prompt_items[(math $tide_item_jj_idx + 1)..-1]
end
end
function t
cd "$(${pkgs.custom.t}/bin/t-rs $argv | tail -n 1)"
end
function temp
t $argv
end
function rs
cd "$(${pkgs.custom.t}/bin/t-rs $argv | tail -n 1)"
cargo init . --bin --name $(basename "$PWD")
vim src/main.rs
end
fish_add_path "$HOME/.cargo/bin"
fish_add_path "$HOME/.local/bin"
fish_add_path "$HOME/Documents/scripts"
fish_add_path "$HOME/.nix-profile/bin"
'';
};
};
home.activation = {
setupTide = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
setupTide() {
${pkgs.fish}/bin/fish -c ${lib.escapeShellArg "tide configure ${
lib.cli.toGNUCommandLineShell { } {
auto = true;
style = "Lean";
prompt_colors = "True color";
show_time = "No";
lean_prompt_height = "Two lines";
prompt_connection = "Disconnected";
prompt_spacing = "Compact";
icons = "Few icons";
transient = "Yes";
}
}"} >/dev/null 2>&1
}
setupTide
'';
};
}

View file

@ -1,12 +1,25 @@
{ pkgs, ... }:
{
calc = "${pkgs.python313}/bin/python -i ${
pkgs.writeText "init.py" ''
from math import *;
# import numpy as np
''
} ";
cp-media = name: media:
calc = "${pkgs.python313}/bin/python -i ${pkgs.writeText "init.py" ''
from math import *;
# import numpy as np
kilo = 1000
mega = 1000 * kilo
giga = 1000 * mega
tera = 1000 * giga
peta = 1000 * tera
b = 1
kib = 1024
mib = 1024 * kib
gib = 1024 * mib
tib = 1024 * gib
pib = 1024 * tib
''} ";
cp-media =
name: media:
let
s = pkgs.writeScriptBin "cp-${name}" ''
echo "copying to library ${media}"

View file

@ -14,229 +14,242 @@ let
}
{
binding = "<Super>Return";
command = "${pkgs.kitty}/bin/kitty";
command = "${pkgs.custom.ghostty}/bin/ghostty";
name = "focus-terminal";
}
{
binding = "F12";
command = "${pkgs.kitty}/bin/kitty -- ${((import ../zsh/scripts.nix) pkgs).calc}";
command = "${pkgs.custom.ghostty}/bin/ghostty -- ${((import ../fish/scripts.nix) pkgs).calc}";
name = "calculator";
}
];
in {
in
{
dconf = {
enable = true;
settings = {
"org/gnome/shell" = {
# pinned app bar
favorite-apps = [
"firefox.desktop"
"org.gnome.Nautilus.desktop"
"org.gnome.Settings.desktop"
"org.gnome.Terminal.desktop"
"jetbrains-clion-ec2b1366-55e3-4ecc-8780-ab6c7542eb56.desktop"
"discord-canary.desktop"
"io.element.Element.desktop"
"mattermost-desktop.desktop"
"org.mozilla.Thunderbird.desktop"
"spotify.desktop"
];
disable-user-extensions = false;
enabled-extensions = [
"horizontal-workspaces@gnome-shell-extensions.gcampax.github.com"
"org.gnome-shell.desktop-icons"
"auto-move-windows@gnome-shell-extensions.gcampax.github.com"
];
};
settings =
{
"org/gnome/shell" = {
# pinned app bar
favorite-apps = [
"firefox.desktop"
"org.gnome.Nautilus.desktop"
"org.gnome.Settings.desktop"
"org.gnome.Terminal.desktop"
"jetbrains-clion-ec2b1366-55e3-4ecc-8780-ab6c7542eb56.desktop"
"discord-canary.desktop"
"io.element.Element.desktop"
"mattermost-desktop.desktop"
"org.mozilla.Thunderbird.desktop"
"spotify.desktop"
];
disable-user-extensions = false;
enabled-extensions = [
"horizontal-workspaces@gnome-shell-extensions.gcampax.github.com"
"org.gnome-shell.desktop-icons"
"auto-move-windows@gnome-shell-extensions.gcampax.github.com"
];
};
"org/gnome/desktop/background" = rec {
# picture-uri ="file:///${home.homeDirectory}/Pictures/backgrounds/2023-09-01-14-56-45-Road-saturated.png";
# picture-uri-dark = picture-uri;
};
"org/gnome/desktop/background" = rec {
# picture-uri ="file:///${home.homeDirectory}/Pictures/backgrounds/2023-09-01-14-56-45-Road-saturated.png";
# picture-uri-dark = picture-uri;
};
"org/gnome/desktop/input-sources" = {
per-window = false;
show-all-sources = false;
sources = [ "('xkb', 'us')" ];
xkb-options =
[ "lv3:switch" "caps:escape" "eurosign:4" "compose:ralt" ];
};
"org/gnome/desktop/input-sources" = {
per-window = false;
show-all-sources = false;
sources = [ "('xkb', 'us')" ];
xkb-options = [
"lv3:switch"
"caps:escape"
"eurosign:4"
"compose:ralt"
];
};
"org/gnome/desktop/interface" = {
clock-show-seconds = true;
clock-show-weekday = true;
color-scheme = "prefer-dark";
cursor-theme = "Adwaita";
enable-animations = true;
enable-hot-corners = true;
font-name = "Noto Sans, 10";
};
"org/gnome/desktop/interface" = {
clock-show-seconds = true;
clock-show-weekday = true;
color-scheme = "prefer-dark";
cursor-theme = "Adwaita";
enable-animations = true;
enable-hot-corners = true;
font-name = "Noto Sans, 10";
};
"org/gnome/desktop/peripherals/mouse" = {
accel-profile = "adaptive";
natural-scroll = false;
};
"org/gnome/desktop/peripherals/mouse" = {
accel-profile = "adaptive";
natural-scroll = false;
};
"org/gnome/desktop/peripherals/touchpad" = {
click-method = "fingers";
disable-while-typing = false;
edge-scrolling-enabled = false;
natural-scroll = false;
send-events = "enabled";
speed = 0.5;
tap-to-click = true;
two-finger-scrolling-enabled = true;
};
"org/gnome/desktop/sound" = {
allow-volume-above-100-percent = true;
event-sounds = true;
};
"org/gnome/desktop/peripherals/touchpad" = {
click-method = "fingers";
disable-while-typing = false;
edge-scrolling-enabled = false;
natural-scroll = false;
send-events = "enabled";
speed = 0.5;
tap-to-click = true;
two-finger-scrolling-enabled = true;
};
"org/gnome/desktop/sound" = {
allow-volume-above-100-percent = true;
event-sounds = true;
};
"org/gnome/desktop/wm/keybindings" = {
begin-move = unbound;
begin-resize = unbound;
close = [ "<Super>q" ];
lower = unbound;
maximize = unbound;
minimize = [ "<Super>w" ];
move-to-monitor-down = [ "<Super>Down" ];
move-to-monitor-left = [ "<Super>Left" ];
move-to-monitor-right = [ "<Super>Right" ];
move-to-monitor-up = [ "<Super>Up" ];
move-to-workspace-1 = [ "<Shift><Super>exclam" ];
move-to-workspace-2 = [ "<Shift><Super>at" ];
move-to-workspace-3 = [ "<Shift><Super>numbersign" ];
move-to-workspace-4 = [ "<Shift><Super>dollar" ];
move-to-workspace-5 = [ "<Shift><Super>percent" ];
move-to-workspace-6 = [ "<Shift><Super>asciicircum" ];
panel-main-menu = [ "" ];
raise-or-lower = [ "<Super>s" ];
switch-applications = [ "<Super>Tab" ];
switch-applications-backward = [ "<Shift><Super>Tab" ];
switch-input-source = unbound;
switch-input-source-backward = unbound;
switch-to-workspace-1 = [ "<Super>1" ];
switch-to-workspace-2 = [ "<Super>2" ];
switch-to-workspace-3 = [ "<Super>3" ];
switch-to-workspace-4 = [ "<Super>4" ];
switch-to-workspace-5 = [ "<Super>5" ];
switch-to-workspace-6 = [ "<Super>6" ];
switch-to-workspace-down = [ "<Super>j" ];
switch-to-workspace-last = [ "<Super>0" ];
switch-to-workspace-up = [ "<Super>k" ];
switch-windows = unbound;
switch-windows-backward = unbound;
toggle-fullscreen = [ "<Super>f" ];
toggle-maximized = [ "<Super>d" ];
unmaximize = unbound;
};
"org/gnome/desktop/wm/keybindings" = {
always-on-top = [ "<Super>t" ];
begin-move = unbound;
begin-resize = unbound;
close = [ "<Super>q" ];
lower = unbound;
maximize = unbound;
minimize = [ "<Super>w" ];
move-to-monitor-down = [ "<Super>Down" ];
move-to-monitor-left = [ "<Super>Left" ];
move-to-monitor-right = [ "<Super>Right" ];
move-to-monitor-up = [ "<Super>Up" ];
move-to-workspace-1 = [ "<Shift><Super>exclam" ];
move-to-workspace-2 = [ "<Shift><Super>at" ];
move-to-workspace-3 = [ "<Shift><Super>numbersign" ];
move-to-workspace-4 = [ "<Shift><Super>dollar" ];
move-to-workspace-5 = [ "<Shift><Super>percent" ];
move-to-workspace-6 = [ "<Shift><Super>asciicircum" ];
panel-main-menu = [ "" ];
raise-or-lower = [ "<Super>s" ];
switch-applications = [ "<Super>Tab" ];
switch-applications-backward = [ "<Shift><Super>Tab" ];
switch-input-source = unbound;
switch-input-source-backward = unbound;
switch-to-workspace-1 = [ "<Super>1" ];
switch-to-workspace-2 = [ "<Super>2" ];
switch-to-workspace-3 = [ "<Super>3" ];
switch-to-workspace-4 = [ "<Super>4" ];
switch-to-workspace-5 = [ "<Super>5" ];
switch-to-workspace-6 = [ "<Super>6" ];
switch-to-workspace-down = [ "<Super>j" ];
switch-to-workspace-last = [ "<Super>0" ];
switch-to-workspace-up = [ "<Super>k" ];
switch-windows = unbound;
switch-windows-backward = unbound;
toggle-fullscreen = [ "<Super>f" ];
toggle-maximized = [ "<Super>d" ];
unmaximize = unbound;
};
"org/gnome/desktop/wm/preferences" = {
auto-raise = false;
button-layout = ":,maximize,minimize,close";
focus-mode = "click";
mouse-button-modifier = "<Super>";
num-workspaces = 6;
resize-with-right-button = false;
visual-bell = false;
};
"org/gnome/desktop/wm/preferences" = {
auto-raise = false;
button-layout = ":,maximize,minimize,close";
focus-mode = "click";
mouse-button-modifier = "<Super>";
num-workspaces = 6;
resize-with-right-button = false;
visual-bell = false;
};
"org/gnome/mutter" = {
center-new-windows = true;
dynamic-workspaces = false;
edge-tiling = true;
experimental-features = [ "scale-monitor-framebuffer" ];
overlay-key = "Super_L";
workspaces-only-on-primary = true;
};
"org/gnome/mutter" = {
center-new-windows = true;
dynamic-workspaces = false;
edge-tiling = true;
experimental-features = [ "scale-monitor-framebuffer" ];
overlay-key = "Super_L";
workspaces-only-on-primary = true;
};
"org/gnome/mutter/keybindings" = {
switch-monitor = [ "<Super>o" ];
toggle-tiled-left = [ "<Super>bracketleft" ];
toggle-tiled-right = [ "<Super>bracketright" ];
};
"org/gnome/mutter/keybindings" = {
switch-monitor = [ "<Super>o" ];
toggle-tiled-left = [ "<Super>bracketleft" ];
toggle-tiled-right = [ "<Super>bracketright" ];
};
"org/gnome/settings-daemon/plugins/media-keys" = {
area-screenshot = unbound;
area-screenshot-clip = [ "<Shift><Super>s" ];
custom-keybindings = with builtins;
(map (i:
"/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom${
toString (i - 1)
}/") (genList (x: x + 1) (length custom-keys)));
email = [ "Display" ];
home = [ "<Super>e" ];
mic-mute = [ "AudioMicMute" ];
next = [ "<Super>period" ];
on-screen-keyboard = unbound;
pause = unbound;
play = [ "<Super>slash" ];
previous = [ "<Super>comma" ];
screensaver = [ "<Super>l" ];
screenshot = unbound;
screenshot-clip = unbound;
stop = unbound;
volume-down = [ "AudioLowerVolume" ];
volume-mute = [ "AudioMute" ];
volume-up = [ "AudioRaiseVolume" ];
window-screenshot = unbound;
window-screenshot-clip = unbound;
};
"org/gnome/settings-daemon/plugins/media-keys" = {
area-screenshot = unbound;
area-screenshot-clip = [ "<Shift><Super>s" ];
custom-keybindings =
with builtins;
(map (
i: "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom${toString (i - 1)}/"
) (genList (x: x + 1) (length custom-keys)));
email = [ "Display" ];
home = [ "<Super>e" ];
mic-mute = [ "AudioMicMute" ];
next = [ "<Super>period" ];
on-screen-keyboard = unbound;
pause = unbound;
play = [ "<Super>slash" ];
previous = [ "<Super>comma" ];
screensaver = [ "<Super>l" ];
screenshot = unbound;
screenshot-clip = unbound;
stop = unbound;
volume-down = [ "AudioLowerVolume" ];
volume-mute = [ "AudioMute" ];
volume-up = [ "AudioRaiseVolume" ];
window-screenshot = unbound;
window-screenshot-clip = unbound;
};
"org/gnome/settings-daemon/plugins/power" = {
ambient-enabled = false;
idle-dim = false;
power-button-action = "nothing";
power-saver-profile-on-low-battery = true;
sleep-inactive-ac-timeout = 7200;
sleep-inactive-ac-type = "nothing";
sleep-inactive-battery-timeout = 7200;
sleep-inactive-battery-type = "suspend";
};
"org/gnome/shell/extensions/auto-move-windows" = {
application-list = [
"firefox.desktop:1"
"discord.desktop:3"
"jetbrains-clion.desktop:2"
"jetbrains-goland.desktop:2"
"jetbrains-pycharm.desktop:2"
"jetbrains-idea.desktop:2"
"spotify.desktop:5"
];
};
"org/gnome/settings-daemon/plugins/power" = {
ambient-enabled = false;
idle-dim = false;
power-button-action = "nothing";
power-saver-profile-on-low-battery = true;
sleep-inactive-ac-timeout = 7200;
sleep-inactive-ac-type = "nothing";
sleep-inactive-battery-timeout = 7200;
sleep-inactive-battery-type = "suspend";
};
"org/gnome/shell/extensions/auto-move-windows" = {
application-list = [
"firefox.desktop:1"
"discord.desktop:3"
"jetbrains-clion.desktop:2"
"jetbrains-goland.desktop:2"
"jetbrains-pycharm.desktop:2"
"jetbrains-idea.desktop:2"
"spotify.desktop:5"
];
};
"org/gnome/shell/keybindings" = {
open-application-menu = [ "Menu" ];
show-screenshot-ui = [ "<Shift><Super>s" ];
switch-to-application-1 = unbound;
switch-to-application-2 = unbound;
switch-to-application-3 = unbound;
switch-to-application-4 = unbound;
switch-to-application-5 = unbound;
switch-to-application-6 = unbound;
switch-to-application-7 = unbound;
switch-to-application-8 = unbound;
switch-to-application-9 = unbound;
toggle-message-tray = unbound;
toggle-overview = [ "<Super>p" ];
};
"org/gnome/shell/keybindings" = {
open-application-menu = [ "Menu" ];
show-screenshot-ui = [ "<Shift><Super>s" ];
switch-to-application-1 = unbound;
switch-to-application-2 = unbound;
switch-to-application-3 = unbound;
switch-to-application-4 = unbound;
switch-to-application-5 = unbound;
switch-to-application-6 = unbound;
switch-to-application-7 = unbound;
switch-to-application-8 = unbound;
switch-to-application-9 = unbound;
toggle-message-tray = unbound;
toggle-overview = [ "<Super>p" ];
};
"org/gnome/terminal/legacy" = {
menu-accelerator-enabled = false;
mnemonics-enabled = true;
new-terminal-mode = "window";
shortcuts-enabled = true;
theme-variant = "dark";
};
"org/gnome/terminal/legacy" = {
menu-accelerator-enabled = false;
mnemonics-enabled = true;
new-terminal-mode = "window";
shortcuts-enabled = true;
theme-variant = "dark";
};
"org/gnome/terminal/legacy/keybindings" = { zoom-in = "<Primary>equal"; };
} // (with builtins;
foldl' (a: b: a // b) { } (map (i: {
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom${
toString (i - 1)
}" = elemAt custom-keys (i - 1);
}) (genList (x: x + 1) (length custom-keys))));
"org/gnome/terminal/legacy/keybindings" = {
zoom-in = "<Primary>equal";
};
}
// (
with builtins;
foldl' (a: b: a // b) { } (
map (i: {
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom${toString (i - 1)}" =
elemAt custom-keys
(i - 1);
}) (genList (x: x + 1) (length custom-keys))
)
);
};
}

49
programs/jj/default.nix Normal file
View file

@ -0,0 +1,49 @@
{ pkgs, ... }:
{
programs.jujutsu = {
enable = true;
package = pkgs.custom.jujutsu;
settings = {
user = {
email = "jonathan@donsz.nl";
name = "Jonathan Dönszelmann";
};
ui = {
pager = "${pkgs.delta}/bin/delta";
# for delta
diff.format = "git";
default-command = [
"log"
"--reversed"
"--no-pager"
];
merge-editor = [
"${pkgs.meld}/bin/meld"
"$left"
"$base"
"$right"
"-o"
"$output"
"--auto-merge"
];
# diff-editor = "${pkgs.meld}/bin/meld";
};
revsets.log = "@ | ancestors(trunk()..(visible_heads() & mine()), 2) | trunk()";
signing = {
sign-all = true;
backend = "ssh";
key = "~/.ssh/id_ed25519.pub";
};
git = {
push-bookmark-prefix = "jdonszelmann/";
private-commits = "description(glob:'wip:*')";
};
};
};
}

View file

@ -20,11 +20,29 @@
lctl lmet lalt spc ralt rctl
)
(defalias
esc (tap-hold 800 800 esc caps)
cap (tap-dance 300 (esc C-k esc))
(deflayer control
@esc
grv 1 2 3 4 5 6 7 8 9 0 - = bspc
tab q w e @replay t y u i o p @wup @wdown \
@cap a s d f g left down up right ; ' bspc
@lst z x C-c v bspc n @macro , . C-f rsft
lctl lmet lalt spc ralt rctl
)
(defalias
esc (tap-hold 800 800 esc caps)
cap (tap-hold-release 200 200
(multi dynamic-macro-record-stop esc)
(layer-while-held control)
)
macro (dynamic-macro-record 0)
replay (dynamic-macro-play 0)
wup (mwheel-up 50 120)
wdown (mwheel-down 50 120)
qwr (layer-switch qwerty)
lst (tap-hold-release 200 200 C-k lsft)
)

View file

@ -1,42 +1,51 @@
{ pkgs, inputs, ... }: {
programs.kitty = {
enable = true;
font.name = "Jetbrains Mono";
font.size = 13.0;
font.package = pkgs.jetbrains-mono;
{ pkgs, inputs, ... }:
{
programs.kitty = {
enable = true;
font = {
name = "Jetbrains Mono";
size = 13.0;
package = pkgs.jetbrains-mono;
};
settings = {
scrollback_lines = 20000;
settings = {
scrollback_lines = 20000;
allow_hyperlinks = true;
repaint_delay = 10;
input_delay = 3;
repaint_delay = 10;
input_delay = 3;
enable_audio_bell = false;
update_check_interval = 0;
enable_audio_bell = false;
update_check_interval = 0;
initial_window_width = "95c";
initial_window_height = "30c";
remember_window_size = "no";
initial_window_width = "95c";
initial_window_height = "30c";
remember_window_size = "no";
draw_minimal_borders = false;
hide_window_decorations = true;
draw_minimal_borders = false;
hide_window_decorations = true;
shell = "${pkgs.tmux}/bin/tmux";
clipboard_control = "write-clipboard write-primary read-clipboard read-primary";
shell = "${pkgs.tmux}/bin/tmux";
clipboard_control = "write-clipboard write-primary read-clipboard read-primary";
foreground = "#fcfcfc";
background = "#232627";
linux_display_server = "auto";
foreground = "#fcfcfc";
background = "#232627";
linux_display_server = "auto";
};
keybindings = {
"ctrl+f" = "launch --location=hsplit --allow-remote-control kitty +kitten ${inputs.kitty-search}/search.py @active-kitty-window-id";
"ctrl+alt+r" = "load_config_file";
"ctrl+shift+r" = "no_op";
"super+`" = "no_op";
"ctrl+EQUAL" = "change_font_size all +2.0";
"ctrl+minus" = "change_font_size all -2.0";
"ctrl+0" = "change_font_size all 0";
# "ctrl+/" = "send_text all ";
};
extraConfig = ''
mouse_map left click ungrabbed no-op
'';
};
keybindings = {
"ctrl+f" = "launch --location=hsplit --allow-remote-control kitty +kitten ${inputs.kitty-search}/search.py @active-kitty-window-id";
"ctrl+alt+r" = "load_config_file";
"ctrl+shift+r" = "no_op";
"ctrl+EQUAL" = "change_font_size all +2.0";
"ctrl+minus" = "change_font_size all -2.0";
"ctrl+0" = "change_font_size all 0";
# "ctrl+/" = "send_text all ";
};
};
}

View file

@ -16,16 +16,6 @@ vim.filetype.add({
}
})
require("onedark").setup {
style = "deep",
highlights = {
["@lsp.type.comment"] = {fg = '#77B767'},
["@comment.documentation.rust"] = {fg = '#77B767'},
["@comment.documentation"] = {fg = '#77B767'},
["@comment"] = {fg = '#426639'}
}
}
require("onedark").load()
local cmp = require("cmp")
cmp.setup {
@ -90,18 +80,12 @@ local esc = vim.api.nvim_replace_termcodes(
local api = require('Comment.api')
vim.keymap.set("n", "<C-_>", ":lua require('Comment.api').toggle.linewise.current()<CR> j", { remap = true })
vim.keymap.set("i", "<C-_>", "<c-o>:lua require('Comment.api').toggle.linewise.current()<CR>", { remap = true })
vim.keymap.set("x", "<C-_>", function()
vim.api.nvim_feedkeys(esc, 'nx', false)
api.toggle.linewise(vim.fn.visualmode())
end, { remap = true })
-- indent and dedent using tab/shift-ta
vim.keymap.set("n", "<tab>", ">>_")
vim.keymap.set("n", "<s-tab>", "<<_")
vim.keymap.set("i", "<s-tab>", "<c-d>")
vim.keymap.set("v", "<Tab>", ">gv")
vim.keymap.set("v", "<S-Tab>", "<gv")
vim.keymap.set('n', 'gr', (function() builtin.lsp_references({jump_type="vsplit"}) end), {})
vim.keymap.set('n', 'gd', (function() builtin.lsp_definitions({jump_type="vsplit"}) end), {})
vim.keymap.set('n', 'gt', (function() builtin.lsp_type_definitions({jump_type="vsplit"}) end), {})
@ -139,9 +123,9 @@ vim.keymap.set('n', '<leader><leader>', builtin.find_files, {})
vim.keymap.set('n', '<leader>f', builtin.live_grep, {})
vim.keymap.set('n', '<leader>h', builtin.pickers, {})
-- vim.keymap.set('n', '<leader>h', builtin.search_history, {})
vim.keymap.set('n', '<leader>b', (function() builtin.buffers({sort_mru = true}) end), {})
vim.keymap.set('n', '<leader>d', "<cmd>Telescope diagnostics bufnr=0<cr>", {})
vim.keymap.set('n', '<leader>ad', builtin.diagnostics, {})
vim.keymap.set('n', '<leader>b', function() builtin.buffers({sort_mru = true}) end, {})
vim.keymap.set('n', '<leader>d', function() require('telescope.builtin').diagnostics({ severity_bound = 0, bufnr = 0 }) end, {})
vim.keymap.set('n', '<leader>ad', function() require('telescope.builtin').diagnostics({ severity_bound = 0 }) end, {})
vim.keymap.set('n', '<leader>em', "<cmd>RustLsp expandMacro<cr>")
vim.keymap.set("n", "]d", vim.diagnostic.goto_next)
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev)
@ -162,76 +146,11 @@ vim.keymap.set("n", "<leader>x", require("telescope.builtin").resume, {
desc = "Resume",
})
local gitsigns = require('gitsigns')
vim.keymap.set('n', '<leader>gr', gitsigns.reset_hunk)
vim.keymap.set('n', '<leader>gd', gitsigns.diffthis)
-- local gitsigns = require('gitsigns')
-- vim.keymap.set('n', '<leader>gr', gitsigns.reset_hunk)
-- vim.keymap.set('n', '<leader>gd', gitsigns.diffthis)
-- vim.keymap.set({'o', 'x'}, 'ig', ':<C-U>Gitsigns select_hunk<CR>')
vim.keymap.set({'o', 'x'}, 'ig', ':<C-U>Gitsigns select_hunk<CR>')
vim.keymap.set('n', 't', ':Neotree toggle<CR>')
-- ============ files and directories ==============
-- don't change the directory when a file is opened
-- to work more like an IDE
vim.opt.autochdir = false
-- ============ tabs and indentation ==============
-- automatically indent the next line to the same depth as the current line
vim.opt.autoindent = true
vim.opt.smartindent = true
vim.opt.smarttab = true
-- backspace across lines
vim.opt.backspace = { "indent", "eol", "start" }
-- :set backspace=indent,eol,start
vim.opt.tabstop = 4
vim.opt.softtabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = true
-- ============ line numbers ==============
-- set number,relativenumber
vim.opt.number = true
vim.opt.relativenumber = true
-- ============ history ==============
vim.cmd([[
set undodir=~/.vimdid
set undofile
]])
vim.opt.undofile = true
-- ============ miscelaneous ==============
vim.opt.belloff = "all"
-- show (usually) hidden characters
vim.opt.list = true
vim.opt.listchars = {
nbsp = "¬",
extends = "»",
precedes = "«",
trail = "·",
tab = ">-",
}
-- paste and yank use global system clipboard
vim.opt.clipboard = "unnamedplus"
-- show partial commands entered in the status line
-- (like show "da" when typing "daw")
vim.opt.showcmd = true
vim.opt.mouse = "a"
vim.opt.modeline = true
-- highlight the line with the cursor on it
vim.opt.cursorline = true
-- enable spell checking (todo: plugin?)
vim.opt.spell = false
vim.opt.wrap = false
-- better search
vim.cmd([[
@ -264,11 +183,6 @@ vim.cmd([[
nnoremap <silent> * *zz
nnoremap <silent> # #zz
nnoremap <silent> g* g*zz
" very magic by default
nnoremap ? ?\v
nnoremap / /\v
cnoremap %s/ %sm/
]])
vim.cmd([[

View file

@ -1,28 +1,17 @@
{ pkgs, ... }:
let
render-markdown = pkgs.vimUtils.buildVimPlugin {
name = "render-markdown";
src = pkgs.fetchFromGitHub {
owner = "MeanderingProgrammer";
repo = "markdown.nvim";
rev = "78ef39530266b3a0736c48b46c3f5d1ab022c7db";
hash = "sha256-mddnBvIrekHh60Ix6qIYAnv10Mu40LamGI47EXk9wSo=";
};
};
# for lsp/cmp inside markdown code blocks
otter = pkgs.vimUtils.buildVimPlugin {
name = "otter";
src = pkgs.fetchFromGitHub {
owner = "jmbuhr";
repo = "otter.nvim";
rev = "cbb1be0586eae18cbea38ada46af428d2bebf81a";
hash = "sha256-eya/8rG3O8UFeeBRDa5U8v3qay+q3iFwPnYtdX7ptCA=";
};
map = mode: key: action: {
inherit mode key action;
};
in
{
home = { sessionVariables = { EDITOR = "nvim"; }; };
imports = [
./options.nix
./plugins.nix
];
programs.nixvim = {
enable = true;
globals.mapleader = " ";
@ -32,13 +21,50 @@ in
vimAlias = true;
# Highlight and remove extra white spaces
highlight.ExtraWhitespace.bg = "red";
# same color as cursorline as per
# https://github.com/joshdick/onedark.vim/blob/390b893d361c356ac1b00778d849815f2aa44ae4/autoload/onedark.vim
highlight.ExtraWhitespace.bg = "#2C323C";
match.ExtraWhitespace = "\\s\\+$";
package = pkgs.neovim-unwrapped;
clipboard.providers.wl-copy.enable = true;
performance = {
byteCompileLua.enable = true;
combinePlugins = {
enable = true;
standalonePlugins = [
# clashes with lualine
"onedark.nvim"
];
};
};
# package = pkgs.neovim-unwrapped;
package = (pkgs.neovim-unwrapped.override { lua = pkgs.luajit; }).overrideAttrs (_: {
version = "git";
src = pkgs.fetchFromGitHub {
owner = "neovim";
repo = "neovim";
rev = "76dcc7029b200e1d85024d7ba4a34c602e730dbe";
hash = "sha256-y3LmGebXuQhLz9w1IzkDU8b464WvMvPCbIImpVvxmcI=";
};
buildInputs = [
(pkgs.utf8proc.overrideAttrs (_: {
version = "git";
src = pkgs.fetchFromGitHub
{
owner = "JuliaStrings";
repo = "utf8proc";
rev = "3de4596fbe28956855df2ecb3c11c0bbc3535838";
hash = "sha256-DNnrKLwks3hP83K56Yjh9P3cVbivzssblKIx4M/RKqw=";
};
}))
] ++ pkgs.neovim-unwrapped.buildInputs ++ pkgs.neovim-unwrapped.nativeBuildInputs;
});
keymaps = [
{
key = "<f2>";
@ -53,339 +79,36 @@ in
action = "<cmd>Lspsaga code_action<cr>";
}
# {
# key = "/";
# action = "<cmd>lua require('spectre').open_file_search({select_word=true})<CR>";
# }
(map "n" "t" "<cmd>Neotree toggle<cr>")
# tab for indent/dedent
(map "n" "<tab>" ">>_")
(map "n" "<S-tab>" "<<_")
(map "i" "<S-tab>" "<c-d>")
(map "v" "<tab>" ">gv")
(map "v" "<S-tab>" "<gv")
];
plugins = {
treesitter = {
enable = true;
colorschemes.onedark = {
enable = true;
settings = {
style = "deep";
nixGrammars = true;
nixvimInjections = true;
settings = {
indent.enable = true;
ensure_installed = "all";
ignore_install = [
"wing"
];
highlight.enable = true;
};
};
rainbow-delimiters.enable = true;
vim-surround.enable = true;
cmp-nvim-lsp.enable = true;
lsp-format.enable = true;
fugitive.enable = true;
lspkind.enable = true;
crates-nvim.enable = true;
fidget.enable = true;
cmp.enable = true;
nvim-autopairs.enable = true;
auto-session = {
enable = true;
settings = {
auto_save_enabled = true;
auto_restore_enabled = true;
pre_save_cmds = [ "Neotree close" ];
post_restore_cmds = [ "Neotree filesystem show" ];
};
};
comment = {
enable = true;
settings = {
sticky = true;
};
};
neo-tree = {
enable = true;
closeIfLastWindow = true;
window = {
position = "right";
width = 30;
mappings = {
"<bs>" = "navigate_up";
"." = "set_root";
"/" = "fuzzy_finder";
"f" = "filter_on_submit";
"h" = "show_help";
};
};
filesystem = {
followCurrentFile.enabled = true;
filteredItems = {
hideHidden = false;
hideDotfiles = false;
forceVisibleInEmptyFolder = true;
hideGitignored = false;
};
};
};
nvim-lightbulb = {
enable = true;
settings = {
autocmd = {
enabled = true;
updatetime = 200;
};
line = {
enabled = true;
};
number = {
enabled = true;
hl = "LightBulbNumber";
};
float = {
enabled = false;
text = "💡";
};
sign = {
enabled = true;
text = "💡";
};
status_text = {
enabled = false;
text = "💡";
};
};
};
gitsigns = {
enable = true;
settings = {
current_line_blame = true;
current_line_blame_opts = {
virt_text = true;
virt_text_pos = "eol";
};
};
};
lspsaga = {
enable = true;
lightbulb.enable = false;
codeAction.keys = {
quit = "<Esc>";
};
};
typst-vim = {
enable = true;
settings = {
cmd = "${pkgs.typst}/bin/typst";
conceal_math = 1;
auto_close_toc = 1;
};
};
lualine = {
enable = true;
settings.options.theme = "onedark";
};
rustaceanvim = {
enable = true;
rustAnalyzerPackage = pkgs.rust-analyzer;
settings = {
auto_attach = true;
server = {
standalone = false;
default_settings = {
rust-analyzer = {
inlayHints = { lifetimeElisionHints = { enable = "always"; }; };
check = { command = "clippy"; };
cachePriming.enable = false;
};
# cargo = {
# buildScripts.enable = true;
# features = "all";
# runBuildScripts = true;
# loadOutDirsFromCheck = true;
# };
# checkOnSave = true;
# check = {
# allFeatures = true;
# command = "clippy";
# extraArgs = [ "--no-deps" ];
# };
# procMacro = { enable = true; };
# imports = {
# granularity = { group = "module"; };
# prefix = "self";
# };
# files = {
# excludeDirs =
# [ ".cargo" ".direnv" ".git" "node_modules" "target" ];
# };
#
# inlayHints = {
# bindingModeHints.enable = true;
# closureStyle = "rust_analyzer";
# closureReturnTypeHints.enable = "always";
# discriminantHints.enable = "always";
# expressionAdjustmentHints.enable = "always";
# implicitDrops.enable = true;
# lifetimeElisionHints.enable = "always";
# rangeExclusiveHints.enable = true;
# reborrowHints.enable = "mutable";
# };
#
# rustc.source = "discover";
#
# options.diagnostics = {
# enable = true;
# styleLints.enable = true;
# };
};
};
};
};
lsp = {
enable = true;
servers = {
astro.enable = true;
cssls.enable = true;
nil_ls = {
enable = true;
extraOptions = {
nix = {
maxMemoryMB = 0;
flake = {
autoArchive = true;
autoEvalInputs = true;
nixpkgsInputName = "nixpkgs";
};
};
};
};
clangd = {
enable = true;
filetypes = [ "c" "cpp" "objc" "objcpp" ];
};
eslint = {
enable = true;
filetypes =
[ "javascript" "javascriptreact" "typescript" "typescriptreact" ];
};
html = {
enable = true;
filetypes = [ "html" ];
};
jsonls = {
enable = true;
filetypes = [ "json" "jsonc" ];
};
pyright = {
enable = true;
filetypes = [ "python" ];
};
bashls = {
enable = true;
filetypes = [ "sh" "bash" ];
};
# ts_ls = {
# enable = true;
# filetypes =
# [ "javascript" "javascriptreact" "typescript" "typescriptreact" ];
# };
marksman.enable = true;
yamlls = {
enable = true;
filetypes = [ "yaml" ];
};
highlights = {
# bright green doccomments
"@lsp.type.comment".fg = "#77B767";
"@comment.documentation.rust".fg = "#77B767";
"@comment.documentation".fg = "#77B767";
"@comment".fg = "#426639";
};
inlayHints = true;
keymaps = {
lspBuf = {
"<leader>;" = "format";
"gh" = "hover";
};
};
};
floaterm = {
enable = true;
opener = "edit";
width = 0.8;
height = 0.8;
};
telescope = {
enable = true;
extensions.ui-select.enable = true;
extensions.fzf-native.enable = true;
settings = {
defaults = {
path_display = [ "smart" ];
layout_strategy = "horizontal";
layout_config = {
width = 0.99;
height = 0.99;
};
};
};
};
# tabs
barbar = {
enable = true;
settings = {
options.diagnostics = "nvim_lsp";
focus_on_close = "previous";
};
};
none-ls = {
enable = true;
sources = {
formatting.nixpkgs_fmt.enable = true;
code_actions.statix.enable = true;
diagnostics = {
statix.enable = true;
deadnix.enable = true;
};
};
};
nix.enable = true;
web-devicons.enable = true;
};
extraPlugins = with pkgs.vimPlugins; [
onedark-nvim
vim-vsnip
cmp-vsnip
cmp-path
cmp-spell
nvim-web-devicons
telescope-ui-select-nvim
telescope-fzf-native-nvim
vim-suda
render-markdown
otter
vim-astro
nvim-web-devicons
vim-visual-multi
vim-gh-line
# vim-bufkill
BufOnly-vim
neoconf-nvim
vim-autoswap
targets-vim
];
extraConfigLuaPre = ''
require("neoconf").setup({})
@ -396,10 +119,5 @@ in
}
'' + (builtins.readFile ./config.lua);
opts = {
lazyredraw = false;
startofline = true;
showmatch = true;
};
};
}

53
programs/nvim/options.nix Normal file
View file

@ -0,0 +1,53 @@
_: {
programs.nixvim.opts = {
lazyredraw = true;
startofline = true;
showmatch = true;
belloff = "all";
showcmd = true;
mouse = "a";
modeline = true;
wrap = false;
spell = false;
# don't change the directory when a file is opened
# to work more like an IDE
autochdir = false;
autoindent = true;
smartindent = true;
smarttab = true;
backspace = [ "indent" "eol" "start" ];
list = true;
undofile = true;
undodir = "/home/jonathan/.vimdid";
tabstop = 4;
softtabstop = 4;
shiftwidth = 4;
expandtab = true;
# relative line numbers except the current line
number = true;
relativenumber = true;
# show (usually) hidden characters
listchars = {
nbsp = "¬";
extends = "»";
precedes = "«";
trail = "·";
tab = ">-";
};
# highlight current line
cursorline = true;
# clipboard == system clipboard
clipboard = "unnamedplus";
};
}

527
programs/nvim/plugins.nix Normal file
View file

@ -0,0 +1,527 @@
{ pkgs, ... }:
let
render-markdown = pkgs.vimUtils.buildVimPlugin {
name = "render-markdown";
src = pkgs.fetchFromGitHub {
owner = "MeanderingProgrammer";
repo = "markdown.nvim";
rev = "78ef39530266b3a0736c48b46c3f5d1ab022c7db";
hash = "sha256-mddnBvIrekHh60Ix6qIYAnv10Mu40LamGI47EXk9wSo=";
};
};
# for lsp/cmp inside markdown code blocks
otter = pkgs.vimUtils.buildVimPlugin {
name = "otter";
src = pkgs.fetchFromGitHub {
owner = "jmbuhr";
repo = "otter.nvim";
rev = "cbb1be0586eae18cbea38ada46af428d2bebf81a";
hash = "sha256-eya/8rG3O8UFeeBRDa5U8v3qay+q3iFwPnYtdX7ptCA=";
};
};
in
{
programs.nixvim = {
plugins = {
treesitter-textobjects = {
enable = true;
lspInterop.enable = true;
select = {
enable = true;
keymaps = {
"ai" = {
query = "@impl.outer";
};
"ii" = {
query = "@impl.inner";
};
"af" = {
query = "@function.outer";
};
"if" = {
query = "@function.inner";
};
"ac" = {
query = "@conditional.outer";
};
"ic" = {
query = "@conditional.inner";
};
"al" = {
query = "@loop.outer";
};
"il" = {
query = "@loop.inner";
};
};
};
move = {
enable = true;
setJumps = true;
gotoNextStart = {
"]f" = {
query = "@function.outer";
};
"]c" = {
query = "@conditional.outer";
};
"]l" = {
query = "@loop.outer";
};
"]i" = {
query = "@impl.outer";
};
};
gotoNextEnd = {
"]F" = {
query = "@function.outer";
};
"]C" = {
query = "@conditional.outer";
};
"]L" = {
query = "@loop.outer";
};
"]I" = {
query = "@impl.outer";
};
};
gotoPreviousStart = {
"[f" = {
query = "@function.outer";
};
"[c" = {
query = "@conditional.outer";
};
"[l" = {
query = "@loop.outer";
};
"[i" = {
query = "@impl.outer";
};
};
gotoPreviousEnd = {
"[F" = {
query = "@function.outer";
};
"[C" = {
query = "@conditional.outer";
};
"[L" = {
query = "@loop.outer";
};
"[I" = {
query = "@impl.outer";
};
};
};
};
treesitter = {
enable = true;
nixGrammars = false;
nixvimInjections = false;
settings = {
indent.enable = true;
ensure_installed = "all";
ignore_install = [
"wing"
];
highlight.enable = true;
incremental_selection = {
enable = true;
keymaps = {
# init_selection = "<CR>";
scope_incremental = "ss";
node_incremental = "si";
node_decremental = "sd";
};
};
};
};
rainbow-delimiters.enable = true;
vim-surround.enable = true;
cmp-nvim-lsp.enable = true;
lsp-format.enable = true;
fugitive.enable = false;
lspkind.enable = true;
crates-nvim.enable = true;
fidget.enable = true;
cmp.enable = true;
nvim-autopairs.enable = true;
# dial.nvim
which-key = {
enable = true;
};
auto-session = {
enable = true;
settings = {
auto_save_enabled = true;
auto_restore_enabled = true;
pre_save_cmds = [ "Neotree close" ];
post_restore_cmds = [ "Neotree filesystem show" ];
};
};
comment = {
enable = true;
settings = {
sticky = true;
};
};
neo-tree = {
enable = true;
closeIfLastWindow = true;
enableGitStatus = false;
window = {
position = "right";
width = 30;
mappings = {
"<bs>" = "navigate_up";
"." = "set_root";
"/" = "fuzzy_finder";
"f" = "filter_on_submit";
"h" = "show_help";
};
};
filesystem = {
followCurrentFile.enabled = true;
filteredItems = {
hideHidden = false;
hideDotfiles = false;
forceVisibleInEmptyFolder = true;
hideGitignored = false;
};
};
};
nvim-lightbulb = {
enable = true;
settings = {
autocmd = {
enabled = true;
updatetime = 200;
};
line = {
enabled = true;
};
number = {
enabled = true;
hl = "LightBulbNumber";
};
float = {
enabled = false;
text = "💡";
};
sign = {
enabled = true;
text = "💡";
};
status_text = {
enabled = false;
text = "💡";
};
};
};
# git-conflict = {
# enable = true;
# settings = {
# default_mappings = {
# both = "<leader>cb";
# none = "<leader>c0";
# ours = "<leader>co";
# prev = "]x";
# next = "[x";
# theirs = "<leader>ct";
# };
# disable_diagnostics = false;
# highlights = {
# current = "DiffText";
# incoming = "DiffAdd";
# };
# list_opener = "conflicts";
# };
# };
# gitsigns = {
# enable = true;
#
# settings = {
# current_line_blame = true;
# current_line_blame_opts = {
# virt_text = true;
# virt_text_pos = "eol";
# };
# };
# };
lspsaga = {
enable = true;
lightbulb.enable = false;
codeAction.keys = {
quit = "<Esc>";
};
};
typst-vim = {
enable = true;
settings = {
cmd = "${pkgs.typst}/bin/typst";
conceal_math = 1;
auto_close_toc = 1;
};
};
lualine = {
enable = true;
settings.options.theme = "onedark";
};
rustaceanvim = {
enable = true;
rustAnalyzerPackage = pkgs.rust-analyzer;
settings = {
auto_attach = true;
server = {
standalone = false;
default_settings = {
rust-analyzer = {
inlayHints = {
lifetimeElisionHints.enable = "always";
expressionAdjustmentHints = {
enable = "always";
mode = "prefer_postfix";
};
discriminantHints.enable = "always";
};
# check = {
# command = "+nightly clippy";
# };
cachePriming.enable = false;
diagnostic = {
refreshSupport = true;
};
};
# cargo = {
# buildScripts.enable = true;
# features = "all";
# runBuildScripts = true;
# loadOutDirsFromCheck = true;
# };
# checkOnSave = true;
# check = {
# allFeatures = true;
# command = "clippy";
# extraArgs = [ "--no-deps" ];
# };
# procMacro = { enable = true; };
# imports = {
# granularity = { group = "module"; };
# prefix = "self";
# };
# files = {
# excludeDirs =
# [ ".cargo" ".direnv" ".git" "node_modules" "target" ];
# };
#
# inlayHints = {
# bindingModeHints.enable = true;
# closureStyle = "rust_analyzer";
# closureReturnTypeHints.enable = "always";
# discriminantHints.enable = "always";
# expressionAdjustmentHints.enable = "always";
# implicitDrops.enable = true;
# lifetimeElisionHints.enable = "always";
# rangeExclusiveHints.enable = true;
# reborrowHints.enable = "mutable";
# };
#
# rustc.source = "discover";
#
options.diagnostics = {
enable = true;
styleLints.enable = true;
};
};
};
};
};
lsp = {
enable = true;
servers = {
astro.enable = true;
cssls.enable = true;
nil_ls = {
enable = true;
settings = {
formatting.command = [ "${(pkgs.lib.getExe pkgs.nixfmt-rfc-style)}" ];
};
extraOptions = {
nix = {
maxMemoryMB = 0;
flake = {
autoArchive = true;
autoEvalInputs = true;
nixpkgsInputName = "nixpkgs";
};
};
};
};
clangd = {
enable = true;
filetypes = [
"c"
"cpp"
"objc"
"objcpp"
];
};
eslint = {
enable = true;
filetypes = [
"javascript"
"javascriptreact"
"typescript"
"typescriptreact"
];
};
html = {
enable = true;
filetypes = [ "html" ];
};
jsonls = {
enable = true;
filetypes = [
"json"
"jsonc"
];
};
pyright = {
enable = true;
filetypes = [ "python" ];
};
bashls = {
enable = true;
filetypes = [
"sh"
"bash"
];
};
# ts_ls = {
# enable = true;
# filetypes =
# [ "javascript" "javascriptreact" "typescript" "typescriptreact" ];
# };
marksman.enable = true;
yamlls = {
enable = true;
filetypes = [ "yaml" ];
};
};
inlayHints = true;
keymaps = {
lspBuf = {
"<leader>;" = "format";
"gh" = "hover";
};
};
};
floaterm = {
enable = true;
opener = "edit";
width = 0.8;
height = 0.8;
};
telescope = {
enable = true;
extensions.ui-select.enable = true;
extensions.fzf-native.enable = true;
settings = {
defaults = {
path_display = [ "smart" ];
layout_strategy = "horizontal";
layout_config = {
width = 0.99;
height = 0.99;
};
};
};
};
# tabs
barbar = {
enable = true;
settings = {
options.diagnostics = "nvim_lsp";
focus_on_close = "previous";
};
};
none-ls = {
enable = true;
sources = {
formatting.nixpkgs_fmt.enable = true;
code_actions.statix.enable = true;
diagnostics = {
statix.enable = true;
deadnix.enable = true;
};
};
};
nix.enable = true;
web-devicons.enable = true;
};
extraPlugins = with pkgs.vimPlugins; [
vim-vsnip
cmp-vsnip
cmp-path
cmp-spell
telescope-ui-select-nvim
telescope-fzf-native-nvim
vim-suda
render-markdown
otter
vim-astro
nvim-web-devicons
vim-visual-multi
vim-gh-line
BufOnly-vim
neoconf-nvim
vim-autoswap
targets-vim
# jj
vim-jjdescription
];
};
}

View file

@ -36,11 +36,13 @@
# for special characters to work right
# like <C-_>
# set-window-option -g xterm-keys on
set -g default-terminal "screen-256color"
set -g set-titles on
set -s escape-time 0
set-option -g default-shell /bin/zsh
set-option -g default-shell ${pkgs.fish}/bin/fish
set -ga terminal-features "\*:hyperlinks"
set-window-option -g mode-keys vi
@ -119,7 +121,22 @@
'if-shell -t= "#{?alternate_on,true,false} || echo \"#{tmux_commands_with_legacy_scroll}\" | grep -q \"#{pane_current_command}\"" \
"send -t= Down" "send -Mt="'
# bind -n DoubleClick1Pane run-shell "${pkgs.xdragon}/bin/dragon -x '#{pane_current_path}/#{mouse_word}'"
bind-key -T root DoubleClick1Pane run-shell "cd '#{pane_current_path}'; echo '#{mouse_line}' | ${pkgs.writeScriptBin "open-file" ''
open_file () {
input=`cat`
link=$(echo "$input" | grep -Po '[^ \\]*/[^ \\]*\.[^ \\]*\:[0-9]+' | sed 's/\:/|/g')
if [ ! -z "$link" ]; then
echo "LINK = $link"
vim_proc=$(pgrep vim | xargs pwdx | grep $(pwd -P) | awk '{print $1}' | sed 's/\:*$//g' | xargs -I{} find /run/user/1000 -depth -maxdepth 1 -name "nvim.{}.0")
nvim --server "$vim_proc" --remote-send "<C-\><C-N>:e $link<cr>"
fi
}
open_file 2>&1 >> ~/open-file.log
''}/bin/open-file"
'';
};
}

View file

@ -1,127 +0,0 @@
{ pkgs, lib, ... }:
with builtins;
with lib.attrsets;
let
scripts = (import ./scripts.nix) pkgs;
aliases = with scripts;
{
"cp-mov" = cp-media "mov" "movies";
"cp-ser" = cp-media "ser" "shows";
"cp-ani" = cp-media "ani" "anime";
"p" = calc;
"s" = "systemctl";
"j" = "journalctl";
"ju" = "journalctl -u";
"jfu" = "journalctl -fu";
"ls" = "${pkgs.eza}/bin/eza --git";
"ll" = "${pkgs.eza}/bin/eza --git";
"lt" = "${pkgs.eza}/bin/eza --long --tree -L 3";
"open" = "${pkgs.xdg-utils}/bin/xdg-open";
"cb" = "${pkgs.wl-clipboard-rs}/wl-copy";
"pull" = "${pkgs.git}/bin/git pull";
"push" = "${pkgs.git}/bin/git push";
"commit" = "${pkgs.git}/bin/git commit";
"add" = "${pkgs.git}/bin/git add";
"patch" = "${pkgs.git}/bin/git add -p";
"amend" = "${pkgs.git}/bin/git commit --amend";
"log" = "${pkgs.git}/bin/git log --all --graph --decorate";
"status" = "${pkgs.git}/bin/git status";
"checkout" = "${pkgs.git}/bin/git checkout";
"rebase" = "${pkgs.git}/bin/git rebase";
"stash" = "${pkgs.git}/bin/git stash";
};
# extracting any compressed format
extract = ''
extract () {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) ${pkgs.gnutar}/bin/tar xjf $1 ;;
*.tar.zst) ${pkgs.gnutar}/bin/tar --zstd xf $1 ;;
*.tar.gz) ${pkgs.gnutar}/bin/tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar e $1 ;;
*.gz) gunzip $1 ;;
*.tar) ${pkgs.gnutar}/bin/tar xf $1 ;;
*.tbz2) ${pkgs.gnutar}/bin/tar xjf $1 ;;
*.tgz) ${pkgs.gnutar}/bin/tar xzf $1 ;;
*.zip) ${pkgs.unzip}/bin/unzip $1 ;;
*.Z) uncompress $1 ;;
*.7z) 7z x $1 ;;
*.tar.xz) ${pkgs.gnutar}/bin/tar xJf $1 ;;
*) echo "'$1' cannot be extracted via extract()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
'';
in
{
programs.zsh = {
enable = true;
enableCompletion = true;
syntaxHighlighting.enable = true;
dotDir = ".config/zsh";
completionInit = ''
autoload -Uz compinit
if [[ -n ''${ZDOTDIR}/.zcompdump(#qN.mh+24) ]]; then
compinit;
else
compinit -C;
fi;
'';
initExtra = ''
source "${pkgs.grml-zsh-config}/etc/zsh/zshrc"
export FZF_DEFAULT_COMMAND="${pkgs.ripgrep}/bin/rg --files --follow"
source "${pkgs.fzf}/share/fzf/key-bindings.zsh"
source "${pkgs.fzf}/share/fzf/completion.zsh"
eval "$(${pkgs.zoxide}/bin/zoxide init zsh)"
eval "$(${pkgs.atuin}/bin/atuin init zsh)"
eval "$(${pkgs.direnv}/bin/direnv hook zsh)"
function zvm_config() {
ZVM_READKEY_ENGINE=$ZVM_READKEY_ENGINE_NEX
ZVM_LINE_INIT_MODE=$ZVM_MODE_INSERT
ZVM_ESCAPE_KEYTIMEOUT=0.03
}
source ${pkgs.zsh-vi-mode}/share/zsh-vi-mode/zsh-vi-mode.plugin.zsh
${extract}
${foldl' (a: b: a + "\n" + b) ""
(mapAttrsToList (name: value: ''alias ${name}="${value}"'') aliases)}
function t() {
cd "$(${pkgs.custom.t}/bin/t-rs $@ | tail -n 1)"
}
function temp() {
t $@
}
function rs() {
cd "$(${pkgs.custom.t}/bin/t-rs $@ | tail -n 1)"
cargo init . --bin --name $(basename "$PWD")
vim src/main.rs
}
# path
path() {
export PATH="$1:$PATH"
}
path "$HOME/.cargo/bin"
path "$HOME/.local/bin"
path "$HOME/Documents/scripts"
path "$HOME/.local/share/JetBrains/Toolbox/scripts"
# http://bewatermyfriend.org/p/2013/001/
# export NEWLINE=$'\n'
# zstyle ':prompt:grml:*:items:percent' pre "''${NEWLINE}"
'';
};
}