zsh: added shell configurations

This commit is contained in:
Nico 2025-05-03 16:15:56 +10:00
parent 012b23bb1b
commit 04e2e47d76
2 changed files with 109 additions and 0 deletions

50
nix/modules/shell.nix Normal file
View file

@ -0,0 +1,50 @@
{ config, lib, pkgs }:
{
programs.zsh.enable = true;
environment.systemPackages = with pkgs; [
git
tmux
tlrc
file
stow
btop
jq
fzf
killall
ripgrep
wget
ffmpeg
imagemagick
];
programs.direnv = {
enable = true;
silent = true;
loadInNixShell = true;
nix-direnv.enable = true;
direnvrcExtra = ''
export PROMPT="* $PROMPT"
'';
};
programs.neovim = {
enable = true;
vimAlias = true;
viAlias = true;
withRuby = true;
withPython3 = true;
withNodeJs = true;
};
neovim = pkgs.neovim.override {
nativeBuildInputs = with pkgs; [
cargo
nodejs
go
];
};
}

59
stow/.zshrc Normal file
View file

@ -0,0 +1,59 @@
# z shell configuration
PROMPT="%F{green}%~ %F{yellow}%m %f"
bindkey -e
# hist
HISTFILE="$HOME/.local/share/zsh_hist"
SAVEHIST=10000000
HISTSIZE=10000000
setopt hist_save_no_dups
setopt hist_ignore_all_dups
setopt hist_find_no_dups
setopt hist_ignore_space
# shell alias
alias ls="ls -h --color=auto"
alias la="ls -ah --color=auto"
alias ll="ls -ahl --color=auto"
# env vars
export GOPATH="$HOME/.local/share/go"
export PATH="$PATH:$GOPATH/bin"
export EDITOR="nvim"
# functions
func calc() {
# why isn't this in bash by default
#
if command -v python3 > /dev/null; then
python3 -c "print($1)"
else
echo "python3 needs to be installed for this to work!"
fi
}
# plugins
plugindir="$HOME/.local/share/zsh_plug"
func plugInstall() {
# clones a repo and then sources it.
# first arg is git url, second is source
# location
foldername=$(basename $1)
clonepath="$plugindir/$foldername"
sourcefile="$clonepath/$2"
if command -v git > /dev/null && [ ! -d "$clonepath" ]; then
git clone $1 "$clonepath"
fi
if [ -f "$sourcefile" ]; then
source "$sourcefile"
fi
}
plugInstall https://github.com/zsh-users/zsh-syntax-highlighting zsh-syntax-highlighting.zsh