Skip to content

Commit

Permalink
feat: zsh tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
nekowinston committed May 2, 2024
1 parent 92bc2d7 commit bf97a55
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 22 deletions.
32 changes: 29 additions & 3 deletions home/apps/zsh.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
pkgs,
...
}: let
inherit (pkgs.stdenv) isLinux;
srcs = pkgs.callPackage ../../_sources/generated.nix {};
zshPlugins = plugins: (map (plugin: rec {
name = src.name;
Expand All @@ -16,6 +17,7 @@ in {
LESSHISTFILE = "-";
MANPAGER = "sh -c 'col -bx | bat -l man -p'";
};
home.packages = [pkgs.onefetch];

programs = {
atuin = {
Expand Down Expand Up @@ -127,9 +129,33 @@ in {
ZVM_VI_HIGHLIGHT_FOREGROUND=white
}
'';
initExtra = ''
for script in "${./zsh/functions}"/**/*; do source "$script"; done
'';
initExtra =
''
function incognito() {
if [[ -n $ZSH_INCOGNITO ]]; then
add-zsh-hook precmd _atuin_precmd
add-zsh-hook preexec _atuin_preexec
unset ZSH_INCOGNITO
else
add-zsh-hook -d precmd _atuin_precmd
add-zsh-hook -d preexec _atuin_preexec
export ZSH_INCOGNITO=1
fi
}
onefetch_in_git_dir() {
if [[ -d '.git' ]]; then
${pkgs.onefetch}/bin/onefetch --no-merges --no-bots --no-color-palette --text-colors 1 1 3 4 4
fi
}
add-zsh-hook chpwd onefetch_in_git_dir
''
+ lib.optionalString isLinux ''
function open() {
nohup xdg-open "$*" > /dev/null 2>&1
}
'';

dotDir = ".config/zsh";
oh-my-zsh = {
Expand Down
12 changes: 0 additions & 12 deletions home/apps/zsh/functions/incognito

This file was deleted.

7 changes: 0 additions & 7 deletions home/apps/zsh/functions/open

This file was deleted.

0 comments on commit bf97a55

Please sign in to comment.