nix-config/modules/home-manager/cli/zsh/default.nix

94 lines
2.1 KiB
Nix
Raw Normal View History

2025-03-17 20:05:16 +00:00
{ config, pkgs, ... }:
2024-04-16 13:00:00 +01:00
2023-11-06 23:48:09 +00:00
{
programs.zsh = {
enable = true;
enableCompletion = true;
2024-12-28 23:24:05 +00:00
syntaxHighlighting.enable = true;
2023-11-06 23:48:09 +00:00
zsh-abbr = {
enable = true;
2025-03-31 09:20:22 +01:00
abbreviations = import ./abbreviations.nix;
2025-03-31 09:47:38 +01:00
globalAbbreviations = import ./global-abbreviations.nix;
};
2025-03-18 10:27:47 +00:00
dotDir = ".config/zsh";
2024-08-28 13:00:09 +01:00
2025-03-31 09:20:22 +01:00
shellAliases = (import ./aliases.nix { inherit config; });
2024-04-16 13:00:00 +01:00
localVariables = {
ABBR_SET_EXPANSION_CURSOR = 1;
};
initExtra = ''
2025-02-18 12:24:39 +00:00
if [[ -z "$DISPLAY" ]] && [[ "$(tty)" == "/dev/tty1" ]]; then
exec startx &>/dev/null
fi
# suffix
alias -s gz="tar -tf"
alias -s {html,HTML}="background firefox"
alias -s {jpg,JPG,png,PNG}="background okular"
alias -s {pdf,PDF}="background okular"
alias -s {zip,ZIP}="unzip -l"
git() {
case "$1" in
clone)
shift
local repo_url="$1"
local repo_path="''${2:-}"
if [ -n "$TARGET_DIR" ]; then
command git clone "$repo_url" "$repo_path"
else
command git clone "$repo_url"
repo_path=$(basename "$repo_url" .git)
fi
${pkgs.tmux-sessionizer}/bin/tmux-sessionizer "$repo_path"
;;
root)
shift
local ROOT="$(${pkgs.git}/bin/git rev-parse --show-toplevel 2> /dev/null || echo -n .)"
if [[ $# == 0 ]]; then
cd "''${ROOT}"
else
(cd "''${ROOT}" && eval "''${@}")
fi
;;
*)
${pkgs.git}/bin/git "''${@}"
;;
esac
}
mbsync() {
${pkgs.isync}/bin/mbsync --config "${config.xdg.configHome}/isync/mbsyncrc" "''${@}"
}
ttyper() {
command ${pkgs.ttyper}/bin/ttyper --language english1000 --words 50 "''${@}"
}
yt-dlp() {
command yt-dlp --paths ~/Videos "$@"
}
2024-12-15 10:16:25 +00:00
bindkey -s ^f "tmux-sessionizer\n"
2024-07-23 20:46:25 +01:00
bindkey -s ^v "nvim\n"
2023-11-06 23:48:09 +00:00
setopt auto_cd
setopt auto_pushd
setopt pushd_ignore_dups
setopt pushdminus
'';
};
}