feat: zsh tweaks

This commit is contained in:
winston 2024-05-02 20:06:56 +02:00
parent 92bc2d77a8
commit bf97a55b92
Signed by: winston
GPG key ID: 3786770EDBC2B481
3 changed files with 29 additions and 22 deletions

View file

@ -4,6 +4,7 @@
pkgs, pkgs,
... ...
}: let }: let
inherit (pkgs.stdenv) isLinux;
srcs = pkgs.callPackage ../../_sources/generated.nix {}; srcs = pkgs.callPackage ../../_sources/generated.nix {};
zshPlugins = plugins: (map (plugin: rec { zshPlugins = plugins: (map (plugin: rec {
name = src.name; name = src.name;
@ -16,6 +17,7 @@ in {
LESSHISTFILE = "-"; LESSHISTFILE = "-";
MANPAGER = "sh -c 'col -bx | bat -l man -p'"; MANPAGER = "sh -c 'col -bx | bat -l man -p'";
}; };
home.packages = [pkgs.onefetch];
programs = { programs = {
atuin = { atuin = {
@ -127,8 +129,32 @@ in {
ZVM_VI_HIGHLIGHT_FOREGROUND=white ZVM_VI_HIGHLIGHT_FOREGROUND=white
} }
''; '';
initExtra = '' initExtra =
for script in "${./zsh/functions}"/**/*; do source "$script"; done ''
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"; dotDir = ".config/zsh";

View file

@ -1,12 +0,0 @@
# vim:ft=zsh
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
}

View file

@ -1,7 +0,0 @@
# vim:ft=zsh
# exit early if we're on macOS
[[ $(uname) == "Darwin" ]] && return
function open() {
nohup xdg-open "$*" > /dev/null 2>&1
}