2024-04-16 12:00:00 +00:00
|
|
|
{ pkgs, ... }:
|
|
|
|
|
2023-11-06 23:48:09 +00:00
|
|
|
{
|
|
|
|
programs.zsh = {
|
|
|
|
dotDir = ".config/zsh";
|
2024-06-25 09:19:28 +00:00
|
|
|
enable = true;
|
|
|
|
enableCompletion = true;
|
2023-11-06 23:48:09 +00:00
|
|
|
|
2024-06-30 13:22:55 +00:00
|
|
|
shellAliases = (import ./zsh/aliases.nix);
|
2024-04-16 12:00:00 +00:00
|
|
|
|
2024-06-09 19:51:23 +00:00
|
|
|
initExtra = ''
|
2024-05-09 22:57:05 +00:00
|
|
|
git() {
|
|
|
|
if [[ "''${1}" == "root" ]]; then
|
|
|
|
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
|
|
|
|
else
|
|
|
|
${pkgs.git}/bin/git "''${@}"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2024-05-09 22:40:30 +00:00
|
|
|
just() {
|
|
|
|
if [[ -f .ignored/justfile ]]; then
|
|
|
|
${pkgs.just}/bin/just --justfile .ignored/justfile "''${@}"
|
|
|
|
else
|
|
|
|
${pkgs.just}/bin/just "''${@}"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2024-05-12 07:25:21 +00:00
|
|
|
til() {
|
|
|
|
if [[ ''${#} < 1 ]]; then
|
|
|
|
echo "No text was provided."
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo ''${1} >> TIL.txt
|
|
|
|
}
|
|
|
|
|
|
|
|
todo() {
|
|
|
|
if [[ ''${#} < 1 ]]; then
|
|
|
|
echo "No text was provided."
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo ''${1} >> TODO.txt
|
|
|
|
}
|
|
|
|
|
2024-05-09 22:19:54 +00:00
|
|
|
ttyper() {
|
|
|
|
command ${pkgs.ttyper}/bin/ttyper --language english1000 --words 50 "''${@}"
|
|
|
|
}
|
|
|
|
|
2023-11-06 23:48:09 +00:00
|
|
|
# Plugins
|
2024-05-05 10:55:58 +00:00
|
|
|
source "''${ZPLUG_REPOS}/joshskidmore/zsh-fzf-history-search/zsh-fzf-history-search.plugin.zsh"
|
2023-11-06 23:48:09 +00:00
|
|
|
source "''${ZPLUG_REPOS}/robbyrussell/oh-my-zsh/plugins/git/git.plugin.zsh"
|
|
|
|
source "''${ZPLUG_REPOS}/robbyrussell/oh-my-zsh/plugins/vi-mode/vi-mode.plugin.zsh"
|
|
|
|
|
|
|
|
# Case insensitive autocompletion.
|
|
|
|
zstyle ":completion:*" matcher-list "" "m:{a-zA-Z}={A-Za-z}" "r:|=*" "l:|=* r:|=*"
|
|
|
|
autoload -Uz compinit && compinit
|
|
|
|
|
|
|
|
bindkey -s ^f "t\n"
|
|
|
|
|
|
|
|
clear-ls-all() {
|
|
|
|
clear
|
2024-05-10 23:50:45 +00:00
|
|
|
ls -al
|
2023-11-06 23:48:09 +00:00
|
|
|
}
|
|
|
|
zle -N clear-ls-all
|
|
|
|
|
|
|
|
clear-git-status() {
|
|
|
|
clear
|
|
|
|
git status -sb .
|
|
|
|
}
|
|
|
|
zle -N clear-git-status
|
|
|
|
|
|
|
|
clear-tree-2() {
|
|
|
|
clear
|
|
|
|
tree -L 2
|
|
|
|
}
|
|
|
|
zle -N clear-tree-2
|
|
|
|
|
|
|
|
clear-tree-3() {
|
|
|
|
clear
|
|
|
|
tree -L 3
|
|
|
|
}
|
|
|
|
zle -N clear-tree-3
|
|
|
|
|
|
|
|
bindkey '^G' clear-git-status
|
|
|
|
# bindkey '^H' clear-tree-3
|
|
|
|
# bindkey '^J' clear-tree-2
|
|
|
|
# bindkey '^K' clear-ls-all
|
|
|
|
|
|
|
|
setopt auto_cd
|
|
|
|
setopt auto_pushd
|
|
|
|
setopt pushd_ignore_dups
|
|
|
|
setopt pushdminus
|
|
|
|
'';
|
|
|
|
|
|
|
|
zplug = {
|
|
|
|
enable = true;
|
|
|
|
|
|
|
|
plugins = [
|
|
|
|
{
|
|
|
|
name = "plugin/git";
|
2024-03-18 20:33:28 +00:00
|
|
|
tags = [ "from:oh-my-zsh" ];
|
2023-11-06 23:48:09 +00:00
|
|
|
}
|
2024-06-25 09:19:28 +00:00
|
|
|
|
2023-11-06 23:48:09 +00:00
|
|
|
{
|
|
|
|
name = "plugin/vi-mode";
|
2024-03-18 20:33:28 +00:00
|
|
|
tags = [ "from:oh-my-zsh" ];
|
2023-11-06 23:48:09 +00:00
|
|
|
}
|
2024-06-09 19:51:23 +00:00
|
|
|
|
2024-06-29 19:47:41 +00:00
|
|
|
{ name = "MichaelAquilina/zsh-auto-notify"; }
|
2024-06-25 09:19:28 +00:00
|
|
|
{ name = "olets/zsh-abbr"; }
|
|
|
|
|
2024-03-18 20:33:28 +00:00
|
|
|
{ name = "zsh-users/zsh-completions"; }
|
|
|
|
{ name = "zsh-users/zsh-syntax-highlighting"; }
|
2023-11-06 23:48:09 +00:00
|
|
|
];
|
|
|
|
};
|
2024-07-03 07:00:00 +00:00
|
|
|
|
|
|
|
sessionVariables = {
|
|
|
|
AUTO_NOTIFY_IGNORE = import ./zsh/auto-notify-ignore.nix;
|
|
|
|
};
|
2023-11-06 23:48:09 +00:00
|
|
|
};
|
2024-06-09 19:51:23 +00:00
|
|
|
|
2024-06-30 13:22:55 +00:00
|
|
|
home.file.".config/zsh-abbr/user-abbreviations".text = builtins.readFile ./zsh/abbreviations.zsh;
|
2023-11-06 23:48:09 +00:00
|
|
|
}
|