Extract a zsh mixin
This commit is contained in:
parent
6635e80bbf
commit
094874946a
10 changed files with 100 additions and 94 deletions
|
@ -10,6 +10,7 @@
|
|||
../../modules/mixins/phpactor
|
||||
../../modules/mixins/starship.nix
|
||||
../../modules/mixins/tmux.nix
|
||||
../../modules/mixins/zsh
|
||||
|
||||
../common
|
||||
../../users/opdavies
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
./programs.nix
|
||||
./services.nix
|
||||
|
||||
../../modules/mixins/zsh
|
||||
|
||||
../common
|
||||
../../users/opdavies
|
||||
../../users/eric
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
./services.nix
|
||||
|
||||
../../modules/mixins/docker.nix
|
||||
../../modules/mixins/zsh
|
||||
|
||||
./modules/acme.nix
|
||||
./modules/audiobookshelf.nix
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
../../modules/mixins/starship.nix
|
||||
../../modules/mixins/thunar.nix
|
||||
../../modules/mixins/tmux.nix
|
||||
../../modules/mixins/zsh
|
||||
../../modules/profiles/dwm
|
||||
../../modules/profiles/xbanish.nix
|
||||
|
||||
|
|
|
@ -3,6 +3,5 @@
|
|||
{
|
||||
imports = [
|
||||
./bin
|
||||
./zsh
|
||||
];
|
||||
}
|
||||
|
|
|
@ -1,93 +0,0 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
enableCompletion = true;
|
||||
syntaxHighlighting.enable = true;
|
||||
|
||||
zsh-abbr = {
|
||||
enable = true;
|
||||
|
||||
abbreviations = import ./abbreviations.nix;
|
||||
globalAbbreviations = import ./global-abbreviations.nix;
|
||||
};
|
||||
|
||||
dotDir = ".config/zsh";
|
||||
|
||||
shellAliases = (import ./aliases.nix { inherit config; });
|
||||
|
||||
localVariables = {
|
||||
ABBR_SET_EXPANSION_CURSOR = 1;
|
||||
};
|
||||
|
||||
initExtra = ''
|
||||
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 "$@"
|
||||
}
|
||||
|
||||
bindkey -s ^f "tmux-sessionizer\n"
|
||||
bindkey -s ^v "nvim\n"
|
||||
|
||||
setopt auto_cd
|
||||
setopt auto_pushd
|
||||
setopt pushd_ignore_dups
|
||||
setopt pushdminus
|
||||
'';
|
||||
};
|
||||
}
|
95
modules/mixins/zsh/default.nix
Normal file
95
modules/mixins/zsh/default.nix
Normal file
|
@ -0,0 +1,95 @@
|
|||
{
|
||||
home-manager.users.opdavies =
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
enableCompletion = true;
|
||||
syntaxHighlighting.enable = true;
|
||||
|
||||
zsh-abbr = {
|
||||
enable = true;
|
||||
|
||||
abbreviations = import ./abbreviations.nix;
|
||||
globalAbbreviations = import ./global-abbreviations.nix;
|
||||
};
|
||||
|
||||
dotDir = ".config/zsh";
|
||||
|
||||
shellAliases = (import ./aliases.nix { inherit config; });
|
||||
|
||||
localVariables = {
|
||||
ABBR_SET_EXPANSION_CURSOR = 1;
|
||||
};
|
||||
|
||||
initExtra = ''
|
||||
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 "$@"
|
||||
}
|
||||
|
||||
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