1
0
Fork 0
mirror of https://github.com/ryanccn/flake.git synced 2026-01-27 04:06:28 +01:00

refactor: use snowfall

This commit is contained in:
Ryan Cao 2024-02-10 11:56:31 +08:00
parent bb39b10e1f
commit de8503d9a6
Signed by: ryanccn
SSH key fingerprint: SHA256:NtP/BlVhoQq4xU6BEcZeT8nIPvHntkJ3lIc2yB+F09E
34 changed files with 181 additions and 194 deletions

View file

@ -0,0 +1,38 @@
{
config,
inputs,
...
}: let
shellAliases = builtins.mapAttrs (_: alias: alias.command) (import ../aliases);
in {
programs.zsh = {
enable = true;
enableAutosuggestions = true;
enableCompletion = true;
dotDir = ".config/zsh";
syntaxHighlighting.enable = true;
envExtra = builtins.readFile ./envExtra.zsh;
# initExtraBeforeCompInit = builtins.readFile ./zsh/initExtraBeforeCompInit.zsh;
initExtra = builtins.readFile ./initExtra.zsh;
inherit shellAliases;
localVariables = {
vivid_theme = "catppuccin-${config.catppuccin.flavour}";
};
plugins = [
{
name = "ohmyzsh-macos";
file = "plugins/macos/macos.plugin.zsh";
src = inputs.ohmyzsh;
}
{
name = "vivid-zsh";
src = inputs.vivid-zsh;
}
];
};
}

View file

@ -0,0 +1,20 @@
# 1Password SSH
export SSH_AUTH_SOCK="$HOME/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock"
# fnm shell env
eval "$(fnm env --use-on-cd)"
# deno
export PATH="$HOME/.deno/bin:$PATH"
# pnpm
export PNPM_HOME="${HOME}/Library/pnpm"
# direnv
export DIRENV_LOG_FORMAT=""
# docker
export PATH="$HOME/.docker/bin:$PATH"
# local bin
export PATH="$HOME/.local/bin:$PATH"

View file

@ -0,0 +1,35 @@
# zsh options
setopt interactivecomments
unsetopt menu_complete
unsetopt flowcontrol
setopt auto_menu
setopt complete_in_word
setopt always_to_end
# configure completion styles
zstyle ':completion:*' menu select
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
zstyle ':completion:*' group-name \'\'
function take() {
mkdir "$1"
cd "$1" || return 1
}
function clean_vscode_workspace_storage() {
for i in "$HOME/Library/Application Support/Code/User/workspaceStorage/"*; do
if [ -f $i/workspace.json ]; then
older="$(python3 -c "import sys, json; print(json.load(open(sys.argv[1], 'r'))['folder'])" $i/workspace.json 2>/dev/null | sed 's#^file://##;s/+/ /g;s/%\(..\)/\\x\1/g;')";
if [ -n "$folder" ] && [ ! -d "$folder" ]; then
echo "Removing workspace $(basename $i) for deleted folder $folder of size $(du -sh $i|cut -f1)"; rm -rfv "$i";
fi
fi
done
}
# nix-your-shell
eval "$(nix-your-shell zsh)"
# iTerm
[ -e "$HOME/.iterm2_shell_integration.zsh" ] && source "$HOME/.iterm2_shell_integration.zsh"