feat: Add my current zsh config
This commit is contained in:
parent
d3d3ece835
commit
9fb1e280db
176
zsh.nix
Executable file
176
zsh.nix
Executable file
@ -0,0 +1,176 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
{
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
|
||||
zplug = {
|
||||
enable = true;
|
||||
plugins = [
|
||||
{ name = "zsh-users/zsh-autosuggestions"; } # Simple plugin installation
|
||||
{ name = "romkatv/powerlevel10k"; tags = [ as:theme depth:1 ]; } # Installations with additional options. For the list of options, please refer to Zplug README.
|
||||
{ name = "zsh-users/zsh-syntax-highlighting"; }
|
||||
{ name = "MichaelAquilina/zsh-you-should-use"; } # Did you forget to use an alias?
|
||||
{ name = "gko/ssh-connect"; tags = [ use:ssh-connect.sh ]; } # List of most used ssh connections
|
||||
{ name = "sineto/web-search"; }
|
||||
{ name = "plugins/dirhistory"; tags = [ from:oh-my-zsh ]; }
|
||||
{ name = "plugins/command-not-found"; tags = [ from:oh-my-zsh ]; }
|
||||
{ name = "davidde/git"; } # Aliases for git
|
||||
{ name = "agkozak/zsh-z"; } # Jump arount your filesystem with ease
|
||||
{ name = "babarot/enhancd"; tags = [ use:init.sh ]; } # Includes simmilar functionality to zsh-z
|
||||
{ name = "zsh-users/zsh-completions"; } # Adds some missing completions to zsh
|
||||
{ name = "zsh-users/zaw"; } # Desctiptions for command outputs (afaik)zplug "plugins/git", from:oh-my-zsh
|
||||
{ name = "supercrabtree/k"; } # Directory listings for Zsh with git features.
|
||||
];
|
||||
};
|
||||
|
||||
initExtra = ''
|
||||
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
|
||||
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
|
||||
# case $(tty) in
|
||||
# (/dev/tty[1-9]) PS1='console version';;
|
||||
# (*) PS1='not console version';;
|
||||
# esac
|
||||
|
||||
# if [[ -n $DISPLAY != "" ]]; then
|
||||
# if (( $\{+DISPLAY} )); then
|
||||
# [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
|
||||
# else
|
||||
# # [[ ! -f ~/.p10k-tty.zsh ]] || source ~/.p10k-tty.zsh
|
||||
# source ~/.p10k-tty.zsh
|
||||
# fi
|
||||
|
||||
eval $(thefuck --alias)
|
||||
|
||||
# Basic auto/tab complete:
|
||||
autoload -U compinit
|
||||
zstyle ':completion:*' menu select
|
||||
zmodload zsh/complist
|
||||
compinit
|
||||
_comp_options+=(globdots) # Include hidden files.
|
||||
|
||||
# Custom ZSH Binds
|
||||
bindkey '^ ' autosuggest-accept
|
||||
bindkey "^[[H" beginning-of-line
|
||||
bindkey "^[[F" end-of-line
|
||||
bindkey "^[[1;5C" forward-word
|
||||
bindkey "^[[1;5D" backward-word
|
||||
bindkey "^[[3~" delete-char
|
||||
|
||||
# Extracting
|
||||
ex ()
|
||||
{
|
||||
if [ -f $1 ] ; then
|
||||
case $1 in
|
||||
*.tar.bz2) tar xjf $1 ;;
|
||||
*.tar.gz) tar xzf $1 ;;
|
||||
*.tar.xz) tar xJf $1 ;;
|
||||
*.bz2) bunzip2 $1 ;;
|
||||
*.rar) unrar x $1 ;;
|
||||
*.gz) gunzip $1 ;;
|
||||
*.tar) tar xf $1 ;;
|
||||
*.tbz2) tar xjf $1 ;;
|
||||
*.tgz) tar xzf $1 ;;
|
||||
*.zip) unzip $1 ;;
|
||||
*.Z) uncompress $1;;
|
||||
*.7z) 7z x $1 ;;
|
||||
*) echo "'$1' cannot be extracted via ex()" ;;
|
||||
esac
|
||||
else
|
||||
echo "'$1' is not a valid file"
|
||||
fi
|
||||
}
|
||||
|
||||
# Kitty binds
|
||||
if [ "$TERM" = "xterm-kitty" ]; then
|
||||
alias ssh="kitty +kitten ssh"
|
||||
alias icat="kitty +kitten icat"
|
||||
alias d="kitty +kitten diff"
|
||||
alias get="kitty +kitten transfer"
|
||||
alias put="kitty +kitten transfer --direction=upload"
|
||||
alias kclip="kitty +kitten clipboard"
|
||||
fi
|
||||
'';
|
||||
|
||||
shellAliases = {
|
||||
update = "sudo nixos-rebuild switch";
|
||||
|
||||
ls="lsd";
|
||||
# ls, the common ones I use a lot shortened for rapid fire usage
|
||||
l="ls -lFh"; #size,show type,human readable
|
||||
la="ls -lAFh"; #long list,show almost all,show type,human readable
|
||||
lr="ls -tRFh"; #sorted by date,recursive,show type,human readable
|
||||
lt="ls -ltFh"; #long list,sorted by date,show type,human readable
|
||||
ll="ls -l"; #long list
|
||||
ldot="ls -ld .*";
|
||||
lS="ls -1FSsh";
|
||||
lart="ls -1Fcart";
|
||||
lrt="ls -1Fcrt";
|
||||
|
||||
grep="grep --color";
|
||||
sgrep="grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS} ";
|
||||
|
||||
t="tail -f";
|
||||
|
||||
# Command line head / tail shortcuts
|
||||
H="| head";
|
||||
T="| tail";
|
||||
G="| grep";
|
||||
L="| less";
|
||||
M="| most";
|
||||
LL="2>&1 | less";
|
||||
CA="2>&1 | cat -A";
|
||||
NE="2> /dev/null";
|
||||
NUL="> /dev/null 2>&1";
|
||||
P="2>&1| pygmentize -l pytb";
|
||||
|
||||
dud="du -d 1 -h";
|
||||
duf="du -sh *";
|
||||
# fd="find . -type d -name";
|
||||
ff="find . -type f -name";
|
||||
|
||||
h="history";
|
||||
hgrep="fc -El 0 | grep";
|
||||
help="man";
|
||||
p="ps -f";
|
||||
sortnr="sort -n -r";
|
||||
unexport="unset";
|
||||
|
||||
# Use trash instead of rm if available
|
||||
|
||||
rm="trash";
|
||||
cp="cp -i";
|
||||
mv="mv -i";
|
||||
|
||||
cls="clear";
|
||||
|
||||
sshc="ssh-connect";
|
||||
};
|
||||
|
||||
history = {
|
||||
# ignoreAllDups = true;
|
||||
path = "${config.xdg.cacheHome}/zhistory";
|
||||
save = 10000;
|
||||
size = 10000;
|
||||
# share = true;
|
||||
};
|
||||
|
||||
# histSize = 10000;
|
||||
# histFile = "${config.xdg.cacheHome}/zhistory";
|
||||
};
|
||||
|
||||
home.packages = with pkgs; [
|
||||
tldr
|
||||
thefuck
|
||||
lsd
|
||||
eza
|
||||
trash-cli
|
||||
fzf # enhancd
|
||||
fd # enhancd
|
||||
# rofi # for fd
|
||||
gnutar # ex
|
||||
bzip2 # ex
|
||||
unzip # ex
|
||||
p7zip # ex
|
||||
gzip # ex
|
||||
];
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user