aboutsummaryrefslogtreecommitdiff
path: root/modules/home-manager/zsh.nix
diff options
context:
space:
mode:
authorschererleander <leander@schererleander.de>2025-07-29 02:03:38 +0200
committerschererleander <leander@schererleander.de>2025-07-29 02:03:38 +0200
commitc2f0d9bebe68c11f4d018a18bd5d3880712c6873 (patch)
treed40b3e3faf65fdc618c2dd62cd548aac6e545ac4 /modules/home-manager/zsh.nix
parent97cf1a9390cbb56bb904c777ebe8f6f559a7d8a4 (diff)
chore: move home-manager modules in seperate folder
Diffstat (limited to 'modules/home-manager/zsh.nix')
-rw-r--r--modules/home-manager/zsh.nix70
1 files changed, 70 insertions, 0 deletions
diff --git a/modules/home-manager/zsh.nix b/modules/home-manager/zsh.nix
new file mode 100644
index 0000000..e229c40
--- /dev/null
+++ b/modules/home-manager/zsh.nix
@@ -0,0 +1,70 @@
+{ config, lib, pkgs, ... }:
+
+{
+ options.zsh.enable = lib.mkEnableOption "Configure zsh";
+ config = lib.mkIf config.zsh.enable {
+ home.packages = with pkgs; [
+ zoxide
+ ];
+
+ programs.zsh = {
+ enable = true;
+ enableCompletion = true;
+ autosuggestion.enable = true;
+ syntaxHighlighting.enable = true;
+
+ initContent = ''
+ # view man pages with nvim
+ export MANPAGER="nvim +Man!"
+
+ # Directory completion with trailing slash
+ zstyle ':completion:*' list-dirs-first true
+ zstyle ':completion:*' special-dirs true
+ zstyle ':completion:*' squeeze-slashes true
+ zstyle ':completion:*' add-space false
+
+ # Case-insensitive completion
+ zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
+
+ # vim keybindings
+ bindkey -v
+
+ # imagemagick wrapper function to remove background
+ remove_bg() {
+ if [[ $# -lt 2 ]]; then
+ echo 'Usage: remove_bg <input_file> <fuzz_percentage> [transparent_color] [output_file]'
+ return 1
+ fi
+
+ local input_file=$1
+ local fuzz=$2
+ local transparent_color=$3
+ local output_file=$4
+
+ magick "$input_file" \
+ -fuzz "$fuzz" -transparent "$transparent_color" \
+ -blur 0x1 \
+ "$output_file"
+
+ echo "Saved transparent image to: $output_file"
+ }
+
+ eval "$(zoxide init zsh)"
+ '';
+
+ shellAliases = {
+ ls = "ls --color=auto";
+ };
+
+ zplug = {
+ enable = true;
+ plugins = [
+ { name = "mafredri/zsh-async"; }
+ { name = "sindresorhus/pure"; tags = [ "as:theme" "use:pure.zsh" ]; }
+ { name = "zdharma-continuum/fast-syntax-highlighting"; }
+ { name = "zsh-users/zsh-autosuggestions"; }
+ ];
+ };
+ };
+ };
+}