Skip to content

Commit

Permalink
update zsh config
Browse files Browse the repository at this point in the history
update zsh config

cleanup

wip

update default plugin path
  • Loading branch information
juliamertz committed Dec 31, 2024
1 parent 54ae135 commit 30195d5
Show file tree
Hide file tree
Showing 12 changed files with 343 additions and 1,805 deletions.
1 change: 0 additions & 1 deletion .envrc

This file was deleted.

8 changes: 2 additions & 6 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,9 @@
'';
in
pkgs.mkShell {
packages = with packages; [
neovim
kitty
tmux
zsh

packages = [
format
pkgs.nurl
];
shellHook = ''
${lib.getExe packages.zsh}
Expand Down
16 changes: 9 additions & 7 deletions helpers.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@
wrapPackage =
args:
let
cfg = {
extraFlags = "";
extraArgs = "";
dependencies = [ ];
postWrap = "";
preWrap = "";
} // args;
cfg = (
lib.mergeAttrs {
extraFlags = "";
extraArgs = "";
dependencies = [ ];
postWrap = "";
preWrap = "";
} args
);

join = value: if builtins.isList value then lib.concatStringsSep " " value else value;
in
Expand Down
71 changes: 48 additions & 23 deletions zsh/.zshrc
Original file line number Diff line number Diff line change
@@ -1,34 +1,59 @@
ZDOTDIR=${ZDOTDIR:-$HOME/.config/zsh}
INIT_PATH=$ZDOTDIR/init
export ZDOTDIR=${ZDOTDIR:-$HOME/.config/zsh}
export ZPLUGINDIR=${ZPLUGINDIR:-$HOME/.local/share/zsh/plugins}
export ZDIR=$ZDOTDIR
export KERNEL=$(uname -s)

source $INIT_PATH/prompt.zsh
source $INIT_PATH/tools.zsh
source $INIT_PATH/zinit.zsh
autoload -Uz compinit && compinit

source $ZDIR/tools.zsh

# Add to PATH
add_path $HOME/.cargo/bin
add_path $HOME/.local/bin
[[ -v ZRUNTIMEDEPS ]] && add_path $ZRUNTIMEDEPS

# Initialize plugins
plugin jeffreytse zsh-vi-mode
plugin zsh-users zsh-syntax-highlighting
plugin zsh-users zsh-autosuggestions
plugin Aloxaf fzf-tab
plugin zsh-users zsh-completions

# Shell integration hooks
try_hook fzf --zsh
try_hook zoxide init zsh
try_hook direnv hook zsh
try_hook /opt/homebrew/bin/brew shellenv
try_hook atuin init zsh --disable-up-arrow

# Key bindings
bindkey '^r' search-hist

# Aliases
alias cat='bat -pp'
alias md='mkdir -p'
alias ll='ls -l'
alias la='ls -la'
alias ..='cd ..'
alias ...='cd ../..'
alias hist='atuin search -i'
alias grep='grep --colour=auto'
alias mkexe='chmod +x'
alias mkmine='chown $(whoami) -R'
alias lg='lazygit'
alias sctl='sudo systemctl'
alias spt='spotify_player'
alias sqlite='litecli'
alias md='mkdir -p'
alias open='xdg-open'

# Plugins
# Linux specific aliases
if [[ $KERNEL == "Linux" ]]; then
alias open='xdg-open'
alias sctl='sudo systemctl'
fi

# Use Neovim as manpager when available
if command -v nvim > /dev/null; then
plugin 'jeffreytse/zsh-vi-mode'
export MANPAGER='nvim +Man!'
fi

plugin 'romkatv/powerlevel10k'
plugin 'zsh-users/zsh-syntax-highlighting'
plugin 'zsh-users/zsh-completions'
plugin 'zsh-users/zsh-autosuggestions'
plugin 'Aloxaf/fzf-tab'
plugin 'hlissner/zsh-autopair'

add_path $HOME/.cargo/bin
add_path $HOME/.local/bin
add_path $HOME/.local/share/flatpak/exports/shar
add_path /var/lib/flatpak/exports/share

source $INIT_PATH/cleanup.zsh
# Initialize prompt
source $ZDIR/prompt.zsh
69 changes: 63 additions & 6 deletions zsh/default.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,68 @@
{ pkgs, wrapPackage, ... }:
wrapPackage {
name = "zsh";
package = pkgs.zsh;
extraArgs = "--set ZDOTDIR '${./.}' --set EDITOR nvim";
dependencies = with pkgs; [
{
pkgs,
wrapPackage,
symlinkJoin,
combineDerivations,
...
}:
let
mkPlugins = p: combineDerivations "zsh-plugin-sources" p;
mkDeps =
deps:
symlinkJoin {
name = "zsh-runtime-dependencies";
paths = deps;
};

pluginPackages =
with pkgs;
mkPlugins [
(fetchFromGitHub {
owner = "jeffreytse";
repo = "zsh-vi-mode";
rev = "cd730cd347dcc0d8ce1697f67714a90f07da26ed";
hash = "sha256-UQo9shimLaLp68U3EcsjcxokJHOTGhOjDw4XDx6ggF4=";
})
(fetchFromGitHub {
owner = "zsh-users";
repo = "zsh-syntax-highlighting";
rev = "5eb677bb0fa9a3e60f0eff031dc13926e093df92";
hash = "sha256-KRsQEDRsJdF7LGOMTZuqfbW6xdV5S38wlgdcCM98Y/Q=";
})
(fetchFromGitHub {
owner = "zsh-users";
repo = "zsh-completions";
rev = "c160d09fddd28ceb3af5cf80e9253af80e450d96";
hash = "sha256-EG6bwbwZW9Cya/BGZ83J5YEAUdfJ0UAQC7bRG7cFL2k=";
})
(fetchFromGitHub {
owner = "zsh-users";
repo = "zsh-autosuggestions";
rev = "0e810e5afa27acbd074398eefbe28d13005dbc15";
hash = "sha256-85aw9OM2pQPsWklXjuNOzp9El1MsNb+cIiZQVHUzBnk=";
})
(fetchFromGitHub {
owner = "Aloxaf";
repo = "fzf-tab";
rev = "6aced3f35def61c5edf9d790e945e8bb4fe7b305";
hash = "sha256-EWMeslDgs/DWVaDdI9oAS46hfZtp4LHTRY8TclKTNK8=";
})
];

runtimeDependencies = with pkgs; [
bat
atuin
jq
zoxide
];
in
wrapPackage {
name = "zsh";
package = pkgs.zsh;
extraArgs = [
"--set ZDOTDIR '${./.}'"
"--set ZRUNTIMEDEPS '${mkDeps runtimeDependencies}/bin'"
"--set ZPLUGINDIR '${pluginPackages}'"
"--set EDITOR nvim"
];
}
5 changes: 0 additions & 5 deletions zsh/init/cleanup.zsh

This file was deleted.

Loading

0 comments on commit 30195d5

Please sign in to comment.