This commit is contained in:
parent
a0575bdb2a
commit
703bf836de
210 changed files with 1 additions and 1 deletions
80
modules/zsh/init.nix
Normal file
80
modules/zsh/init.nix
Normal file
|
@ -0,0 +1,80 @@
|
|||
{
|
||||
flake.modules.homeManager.base =
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
programs.zsh.initContent = ''
|
||||
background() {
|
||||
for ((i=2;i<=$#;i++)); do
|
||||
''${@[1]} ''${@[$i]} &> /dev/null &
|
||||
done
|
||||
}
|
||||
|
||||
# suffix
|
||||
alias -s gz="tar -tf"
|
||||
alias -s {html,HTML}="background zsh"
|
||||
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 "''${@}"
|
||||
}
|
||||
|
||||
weather() {
|
||||
curl "https://wttr.in/''$1"
|
||||
}
|
||||
|
||||
yt-dlp() {
|
||||
command yt-dlp --paths ~/Videos "$@"
|
||||
}
|
||||
|
||||
bindkey -s ^f "tmux-sessionizer\n"
|
||||
bindkey -s ^v "nvim\n"
|
||||
|
||||
setopt auto_cd
|
||||
setopt auto_pushd
|
||||
setopt pushd_ignore_dups
|
||||
setopt pushdminus
|
||||
'';
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue