diff --git a/home/private_dot_config/zsh/completions/_fnhelp b/home/private_dot_config/zsh/completions/_fnhelp new file mode 100644 index 0000000..091fc95 --- /dev/null +++ b/home/private_dot_config/zsh/completions/_fnhelp @@ -0,0 +1,4 @@ +#compdef fnhelp + +# show files in the functions dir (exclude dirs) +_path_files -W "$ZDOTDIR/functions" -g "**/*(.)" diff --git a/home/private_dot_config/zsh/completions/_g b/home/private_dot_config/zsh/completions/_g new file mode 100644 index 0000000..4e8551d --- /dev/null +++ b/home/private_dot_config/zsh/completions/_g @@ -0,0 +1 @@ +#compdef g=git diff --git a/home/private_dot_config/zsh/completions/readme.md b/home/private_dot_config/zsh/completions/readme.md new file mode 100644 index 0000000..c5c0792 --- /dev/null +++ b/home/private_dot_config/zsh/completions/readme.md @@ -0,0 +1,8 @@ +# Completions + +Add user contributed completions to this directory. + +Read more about how Zsh completions work in this [how-to][1] article. + + +[1]: https://github.com/zsh-users/zsh-completions/blob/master/zsh-completions-howto.org diff --git a/home/private_dot_config/zsh/conf.d/aliases.zsh b/home/private_dot_config/zsh/conf.d/aliases.zsh new file mode 100644 index 0000000..6834d03 --- /dev/null +++ b/home/private_dot_config/zsh/conf.d/aliases.zsh @@ -0,0 +1,37 @@ +# +# aliases - Set whatever Zsh aliases you want. +# + +# single character aliases - be sparing! +alias g=git + +# mask built-ins with better defaults +alias vi=vim + +# this one is kinda dangerous +alias rr="rm -rf" + +# more ways to ls +alias ls="ls --group-directories-first --color=always" +alias l='ls -lh' +alias la='ls -lAh' +alias ldot='ls -ld .*' +alias lr='ls -R' +alias lsl="ls -lhFA --color=always | less" +alias left='ls -t -1' + +# GNU make +alias mkrt='make -C $(git rev-parse --show-toplevel)' +alias mk="make" +alias mkc="make -C" + +# url encode/decode +alias urldecode='python3 -c "import sys, urllib.parse as ul; \ + print(ul.unquote_plus(sys.argv[1]))"' +alias urlencode='python3 -c "import sys, urllib.parse as ul; \ + print (ul.quote_plus(sys.argv[1]))"' + +# misc +alias zshrc='${EDITOR:-vim} "${ZDOTDIR:-$HOME}"/.zshrc' +# alias zbench='for i in {1..10}; do /usr/bin/time zsh -lic exit; done' +alias zdot='cd ${ZDOTDIR:-~}' diff --git a/home/private_dot_config/zsh/conf.d/misc.zsh b/home/private_dot_config/zsh/conf.d/misc.zsh new file mode 100644 index 0000000..f464ac0 --- /dev/null +++ b/home/private_dot_config/zsh/conf.d/misc.zsh @@ -0,0 +1,28 @@ +# +# misc - Set general Zsh config options here, or change plugin settings. +# + +# +# Options +# + +# Undo options from plugins +setopt NO_BEEP # Be quiet! +setopt NO_HIST_BEEP # Be quiet! + +# +# OMZ +# +MAGIC_ENTER_GIT_COMMAND="$MAGIC_ENTER_OTHER_COMMAND && git status -sb" + +# +# Zsh-Utils +# +# The belek/zsh-utils completion plugin also introduces compstyles. Let's use that! +(( ! $+functions[compstyle_zshzoo_setup] )) || compstyle_zshzoo_setup + +# let make handle it's own shell completion +zstyle ':completion::complete:make:*:targets' call-command true + + + diff --git a/home/private_dot_config/zsh/dot_editorconfig b/home/private_dot_config/zsh/dot_editorconfig new file mode 100644 index 0000000..4f7df9b --- /dev/null +++ b/home/private_dot_config/zsh/dot_editorconfig @@ -0,0 +1,33 @@ +# +# .editorconfig +# + +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true +indent_style = tab +indent_size = 4 + +[*.md] +indent_style = space +trim_trailing_whitespace = false + +[*.zsh] +indent_style = space +indent_size = 2 + +[.{zsh*,zlog*,zprofile}] +indent_style = space +indent_size = 2 + +[**/functions/*] +indent_style = space +indent_size = 2 + +[**/completions/_*] +indent_style = space +indent_size = 2 diff --git a/home/private_dot_config/zsh/dot_zprofile b/home/private_dot_config/zsh/dot_zprofile new file mode 100644 index 0000000..d725ab0 --- /dev/null +++ b/home/private_dot_config/zsh/dot_zprofile @@ -0,0 +1,56 @@ +# +# .zprofile - Zsh file loaded on login. +# + +# +# XDG +# + +# https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html +export XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-$HOME/.config} +export XDG_CACHE_HOME=${XDG_CACHE_HOME:-$HOME/.cache} +export XDG_DATA_HOME=${XDG_DATA_HOME:-$HOME/.local/share} +export XDG_STATE_HOME=${XDG_STATE_HOME:-$HOME/.local/state} +export XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR:-$HOME/.xdg} + +for xdgdir in XDG_{CONFIG,CACHE,DATA,STATE}_HOME XDG_RUNTIME_DIR; do + [[ -e ${(P)xdgdir} ]] || mkdir -p ${(P)xdgdir} +done + +# +# Paths +# + +# Ensure path arrays do not contain duplicates. +typeset -gU path fpath cdpath mailpath + +# Set the list of directories that zsh searches for commands. +path=( + $HOME/{go,.cargo}/bin(N) + $HOME/.extra/bin(N) + $HOME/{,.local/}{,s}bin(N) + /opt/{homebrew,local}/{,s}bin(N) + /usr/{,local/}{,s}bin(N) + $path +) + +# +# Less +# + +# Set default less options. +export LESS="${LESS:--g -i -M -R -S -w -z-4}" + +# Set the less input preprocessor. +if [[ -z "$LESSOPEN" ]] && (( $#commands[(i)lesspipe(|.sh)] )); then + export LESSOPEN="| /usr/bin/env $commands[(i)lesspipe(|.sh)] %s 2>&-" +fi + +# +# Misc +# + +# Use `< file` to quickly view the contents of any file. +[[ -z "$READNULLCMD" ]] || READNULLCMD=$PAGER + +# vim: ft=zsh sw=2 ts=2 et diff --git a/home/private_dot_config/zsh/dot_zsh_plugins.txt b/home/private_dot_config/zsh/dot_zsh_plugins.txt new file mode 100644 index 0000000..b90992b --- /dev/null +++ b/home/private_dot_config/zsh/dot_zsh_plugins.txt @@ -0,0 +1,113 @@ +# +# .zsh_plugins.txt - antidote plugins file +# + +### Overview +# +# The `.zsh_plugins.txt` file is used by antidote to configure Zsh bundles. Bundles are +# just a fancy way of referring to Zsh utilities, frameworks, prompts, or plugins. +# `.zsh_plugins.txt` is used by antidote to generate a static `.zsh_plugins.zsh` file, +# which can then be sourced in your `.zshrc`. You can use this file as a starting point +# for your own config. Strip out instructional comments (ie: lines beginning with a '#') +# and any plugins you don't need, then add what you like and make it yours! +# +# NOTE: Order matters in this file! Some bundles need to be last, and others are +# prerequisites. Read the documentation for the plugins you use to ensure proper +# configuration. +# +### + + +### Utilities +# +# Utilities aren't traditional Zsh plugins - they aren't sourced Zsh scripts. Instead +# they provide commands that can be executed from your terminal session. One good +# example is zsh-bench, which is a utility that benchmarks your Zsh config. Utility +# bundles can often be made available simply with the `kind:path` annotation. +# +### +romkatv/zsh-bench kind:path + +### Framework: Oh-My-Zsh + +ohmyzsh/ohmyzsh path:lib/clipboard.zsh +ohmyzsh/ohmyzsh path:plugins/copybuffer +ohmyzsh/ohmyzsh path:plugins/copyfile +ohmyzsh/ohmyzsh path:plugins/copypath +ohmyzsh/ohmyzsh path:plugins/extract +ohmyzsh/ohmyzsh path:plugins/magic-enter +ohmyzsh/ohmyzsh path:plugins/fancy-ctrl-z + +### Framework: zsh-utils +# +# zsh-utils is a micro-framework that is also well suited to pair with antidote. It +# provides much of the same core functionality from other bigger frameworks without the +# bloat or performance hit. Using zsh-utils, you may find you don't need much else. +# If you want a really thin framework, this is great. +# +### +belak/zsh-utils path:history +belak/zsh-utils path:utility +#belak/zsh-utils path:editor +#belak/zsh-utils path:prompt +#belak/zsh-utils path:completion + + +### Deferred Plugins +# +# Antidote allows you to defer loading plugins. This is similar to concepts like "turbo +# mode" in other plugin managers. Antidote handles deferring plugins by leveraging +# romkatv/zsh-defer, which "defers execution of a zsh command until zsh has nothing else +# to do and is waiting for user input". In general, you should not defer plugins unless +# you know for sure they properly support deferred loading, and there are no adverse +# side-effects (see: https://github.com/romkatv/zsh-defer#Caveats). However, for +# certain plugins, this can greatly increase your zsh startup speed. +# +### +# Syntax highlighting +#zsh-users/zsh-syntax-highlighting kind:defer +zdharma-continuum/fast-syntax-highlighting kind:defer +Aloxaf/fzf-tab kind:defer + +### Completions +# +# You may want to add some additional completions to Zsh. Completions look in your fpath +# for completion functions, which are functions named with a leading underscore +# (eg: _git). You need to add all supplemental completions to your fpath prior to +# running `compinit` to use completions functionality properly. You will want to find +# a completion plugin that runs `compinit` for you, or you can run it yourself in +# your .zshrc after antidote loads like this: +# +# autoload -Uz compinit && compinit +# +### + +# zsh-users/zsh-completions is a popular plugin for adding supplemental completions. +# We combine the `path:` and `kind:fpath` annotations here: +zsh-users/zsh-completions path:src kind:fpath + +# Compinit plugins should be near the end of .zsh_plugins.txt so that $fpath has been +# fully populated. Use zsh-utils for its completion plugin. +belak/zsh-utils path:completion + + +### Final Plugins +# +# Remember plugin order matters! Put plugins that need run last at the bottom of your +# .zsh_plugins.txt file. +# +### + +# Add fzf completions scripts +junegunn/fzf path:shell/completion.zsh +junegunn/fzf path:shell/key-bindings.zsh + +# Source everything in $ZDOTDIR/rc.d prior to wrapping up. +mattmc3/zshrc.d +~/.config/zsh/plugins/zexists + +# These popular core plugins should be loaded at the end +zsh-users/zsh-autosuggestions kind:defer +zsh-users/zsh-history-substring-search + +# vim: ft=zsh sw=2 ts=2 et diff --git a/home/private_dot_config/zsh/dot_zshenv b/home/private_dot_config/zsh/dot_zshenv new file mode 100644 index 0000000..77ff433 --- /dev/null +++ b/home/private_dot_config/zsh/dot_zshenv @@ -0,0 +1,24 @@ +# +# .zshenv - Zsh environment file, loaded always. +# +# NOTE: .zshenv has to live at ~/.zshenv, not in $ZDOTDIR! You can get around this by +# symlinking .zshenv from your $ZDOTDIR: `ln -sf $ZDOTDIR/.zshenv ~/.zshenv` +# + +# +# ZDOTDIR +# + +export XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-${HOME}/.config} +export ZDOTDIR=${ZDOTDIR:-${XDG_CONFIG_HOME}/zsh} + +# +# .zprofile +# + +# We use .zprofile for everything else (load for non-login, non-interactive shells). +if [[ ( "$SHLVL" -eq 1 && ! -o LOGIN ) && -s "${ZDOTDIR:-$HOME}/.zprofile" ]]; then + source "${ZDOTDIR:-$HOME}/.zprofile" +fi + +# vim: ft=zsh sw=2 ts=2 et diff --git a/home/private_dot_config/zsh/dot_zshrc b/home/private_dot_config/zsh/dot_zshrc new file mode 100644 index 0000000..bb69757 --- /dev/null +++ b/home/private_dot_config/zsh/dot_zshrc @@ -0,0 +1,63 @@ +# +# .zshrc - Zsh file loaded on interactive shell sessions. +# + +# +# Profiling +# + +# Load zprof first if we need to profile. +[[ ${ZPROFRC:-0} -eq 0 ]] || zmodload zsh/zprof +alias zprofrc="ZPROFRC=1 zsh" + +# +# Options +# + +# Set general Zsh options needed for config. +setopt extended_glob + +# +# Lazy-load functions +# + +# Autoload functions directory and its subdirs. +for funcdir in $ZDOTDIR/functions $ZDOTDIR/functions/*(N/); do + fpath=($funcdir $fpath) + autoload -Uz $fpath[1]/*(.:t) +done +unset funcdir + +# +# Pre-antidote +# + +# Be sure to set any supplemental completions directories before compinit is run. +fpath=(${ZDOTDIR}/completions(-/FN) $fpath) + +# +# antidote +# + +[[ -d ${ZDOTDIR:-~}/.antidote ]] || + git clone https://github.com/mattmc3/antidote ${ZDOTDIR:-~}/.antidote + +# Set the name of the static .zsh plugins file antidote will generate. +zsh_plugins=${ZDOTDIR:-~}/.zsh_plugins.zsh + +# Ensure you have a .zsh_plugins.txt file where you can add plugins. +[[ -f ${zsh_plugins:r}.txt ]] || touch ${zsh_plugins:r}.txt + +# Lazy-load antidote. +fpath+=(${ZDOTDIR:-~}/.antidote/functions) +autoload -Uz $fpath[-1]/antidote + +# Generate static file in a subshell when .zsh_plugins.txt is updated. +if [[ ! $zsh_plugins -nt ${zsh_plugins:r}.txt ]]; then + (antidote bundle <${zsh_plugins:r}.txt >|$zsh_plugins) +fi + +# Source your static plugins file. +source $zsh_plugins + +# vim: ft=zsh sw=2 ts=2 et diff --git a/home/private_dot_config/zsh/functions/autosuggestions-keybinds b/home/private_dot_config/zsh/functions/autosuggestions-keybinds new file mode 100644 index 0000000..4e0bf87 --- /dev/null +++ b/home/private_dot_config/zsh/functions/autosuggestions-keybinds @@ -0,0 +1,15 @@ +##? Post load function for zsh-autosuggestions + +# function autosuggestions-keybinds { + +# https://github.com/zsh-users/zsh-autosuggestions +ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=8' +if [[ -n "$key_info" ]]; then + # vi + bindkey -M viins "$key_info[Control]F" vi-forward-word + bindkey -M viins "$key_info[Control]E" vi-add-eol +fi + +# } + +# vim: ft=zsh sw=2 ts=2 et diff --git a/home/private_dot_config/zsh/functions/envsubst b/home/private_dot_config/zsh/functions/envsubst new file mode 100644 index 0000000..22becbf --- /dev/null +++ b/home/private_dot_config/zsh/functions/envsubst @@ -0,0 +1,15 @@ +##? envsubst - fall-back wrapper in the event the envsubst command does not exist. + +# function envsubst { +if (( ! $+commands[envsubst] )); then + function envsubst { + command envsubst "$@" + } +else + function envsubst { + python -c 'import os,sys;[sys.stdout.write(os.path.expandvars(l)) for l in sys.stdin]' + } +fi +# } + +# vim: ft=zsh sw=2 ts=2 et diff --git a/home/private_dot_config/zsh/functions/fnhelp b/home/private_dot_config/zsh/functions/fnhelp new file mode 100644 index 0000000..5a2c7d6 --- /dev/null +++ b/home/private_dot_config/zsh/functions/fnhelp @@ -0,0 +1,13 @@ +##? fnhelp - use '##?' comments in function files as help docs. +##? +##? usage: fnhelp + +# function fnhelp { +local ZFUNCDIR="${ZFUNCDIR:-${ZDOTDIR:-~/.config/zsh}/functions}" +if [[ ! -f "$ZFUNCDIR/$1" ]]; then + echo >&2 "fnhelp: function not found '$1'." && return 1 +fi +command grep "^##?" "$ZFUNCDIR/$1" | cut -c 5- +# } + +# vim: ft=zsh sw=2 ts=2 et diff --git a/home/private_dot_config/zsh/functions/format-qmd b/home/private_dot_config/zsh/functions/format-qmd new file mode 100644 index 0000000..2bcd554 --- /dev/null +++ b/home/private_dot_config/zsh/functions/format-qmd @@ -0,0 +1,5 @@ +# TODO: add support for outputs + +jupytext --from qmd $1 --pipe black --opt 'notebook_metadata_filter=-all' + +# vim ft=zsh diff --git a/home/private_dot_config/zsh/functions/gi b/home/private_dot_config/zsh/functions/gi new file mode 100644 index 0000000..68f8b77 --- /dev/null +++ b/home/private_dot_config/zsh/functions/gi @@ -0,0 +1,3 @@ +curl -sL "https://www.toptal.com/developers/gitignore/api/$@" + +# vim ft=zsh diff --git a/home/private_dot_config/zsh/functions/history-substring-search-keybinds b/home/private_dot_config/zsh/functions/history-substring-search-keybinds new file mode 100644 index 0000000..b2f7a45 --- /dev/null +++ b/home/private_dot_config/zsh/functions/history-substring-search-keybinds @@ -0,0 +1,25 @@ +##? Post load function for zsh-history-substring-search plugin + +# function history-substring-search-keybinds { + +# https://github.com/zsh-users/zsh-history-substring-search +if [[ -n "$key_info" ]]; then + # Emacs + bindkey -M emacs "$key_info[Control]P" history-substring-search-up + bindkey -M emacs "$key_info[Control]N" history-substring-search-down + + # Vi + bindkey -M vicmd "k" history-substring-search-up + bindkey -M vicmd "j" history-substring-search-down + + # Emacs and Vi + for keymap in 'emacs' 'viins'; do + bindkey -M "$keymap" "$key_info[Up]" history-substring-search-up + bindkey -M "$keymap" "$key_info[Down]" history-substring-search-down + done + + unset keymap +fi +# } + +# vim: ft=zsh sw=2 ts=2 et diff --git a/home/private_dot_config/zsh/functions/is-exe b/home/private_dot_config/zsh/functions/is-exe new file mode 100644 index 0000000..9f16a28 --- /dev/null +++ b/home/private_dot_config/zsh/functions/is-exe @@ -0,0 +1,7 @@ +#? check if executable exists + +if [ -x "$(command -v $1)" ]; then + return 0 +else + return 1 +fi diff --git a/home/private_dot_config/zsh/functions/is-tty b/home/private_dot_config/zsh/functions/is-tty new file mode 100644 index 0000000..20b5c70 --- /dev/null +++ b/home/private_dot_config/zsh/functions/is-tty @@ -0,0 +1,11 @@ +##? check if running in a tty + +case $(tty) in /dev/tty[0-9]*) + return 0 + ;; +*) + return 1 + ;; +esac + +# vim: ft=zsh sw=2 ts=2 et diff --git a/home/private_dot_config/zsh/functions/pmodload b/home/private_dot_config/zsh/functions/pmodload new file mode 100644 index 0000000..a04c5de --- /dev/null +++ b/home/private_dot_config/zsh/functions/pmodload @@ -0,0 +1,5 @@ +# function pmodload { + # if you are using Prezto, you'll need an empty pmodload function +# } + +# vim: ft=zsh sw=2 ts=2 et diff --git a/home/private_dot_config/zsh/functions/reload b/home/private_dot_config/zsh/functions/reload new file mode 100644 index 0000000..ed7424b --- /dev/null +++ b/home/private_dot_config/zsh/functions/reload @@ -0,0 +1,6 @@ +##? reload zshell configs + +source $ZDOTDIR/.zshenv +source $ZDOTDIR/.zshrc + +# vim: ft=zsh sw=2 ts=2 et diff --git a/home/private_dot_config/zsh/functions/web b/home/private_dot_config/zsh/functions/web new file mode 100644 index 0000000..93cac83 --- /dev/null +++ b/home/private_dot_config/zsh/functions/web @@ -0,0 +1,18 @@ +##? open file in $BROWSER + +if [[ -z "$BROWSER" ]]; then + echo 'set $BROWSER' + return +fi +for i +do + if [[ ! -r $i ]] + then + echo "$0: file doesn't exist: \`$i'" >&2 + continue + fi + $BROWSER "$i" > /dev/null 2>&1 & + disown +done + +# vim: ft=zsh sw=2 ts=2 et diff --git a/home/private_dot_config/zsh/zexists.d/cmd/anit-lsd.zsh b/home/private_dot_config/zsh/zexists.d/cmd/anit-lsd.zsh new file mode 100644 index 0000000..cf53d10 --- /dev/null +++ b/home/private_dot_config/zsh/zexists.d/cmd/anit-lsd.zsh @@ -0,0 +1 @@ +alias lt="tree -L 3" diff --git a/home/private_dot_config/zsh/zexists.d/cmd/anti-nvim.zsh b/home/private_dot_config/zsh/zexists.d/cmd/anti-nvim.zsh new file mode 100644 index 0000000..c51c135 --- /dev/null +++ b/home/private_dot_config/zsh/zexists.d/cmd/anti-nvim.zsh @@ -0,0 +1,2 @@ +EDITOR=vim +VISUAL=vim diff --git a/home/private_dot_config/zsh/zexists.d/cmd/anti-starship.zsh b/home/private_dot_config/zsh/zexists.d/cmd/anti-starship.zsh new file mode 100644 index 0000000..f07027a --- /dev/null +++ b/home/private_dot_config/zsh/zexists.d/cmd/anti-starship.zsh @@ -0,0 +1,11 @@ +echo "no starship = dumber prompt" + +autoload -Uz vcs_info +precmd() { + vcs_info +} + +zstyle ':vcs_info:git:*' formats '%b ' + +setopt PROMPT_SUBST +PROMPT='%F{green}%*%f %F{blue}%~%f %F{red}${vcs_info_msg_0_}%f$ ' diff --git a/home/private_dot_config/zsh/zexists.d/cmd/bat.zsh b/home/private_dot_config/zsh/zexists.d/cmd/bat.zsh new file mode 100644 index 0000000..6035e73 --- /dev/null +++ b/home/private_dot_config/zsh/zexists.d/cmd/bat.zsh @@ -0,0 +1,3 @@ +export BAT_THEME=Catppuccin +export BAT_STYLE=header,numbers,grid + diff --git a/home/private_dot_config/zsh/zexists.d/cmd/eget.zsh b/home/private_dot_config/zsh/zexists.d/cmd/eget.zsh new file mode 100644 index 0000000..f9a9b6c --- /dev/null +++ b/home/private_dot_config/zsh/zexists.d/cmd/eget.zsh @@ -0,0 +1 @@ +export EGET_BIN=$HOME/bin diff --git a/home/private_dot_config/zsh/zexists.d/cmd/fnm.zsh b/home/private_dot_config/zsh/zexists.d/cmd/fnm.zsh new file mode 100644 index 0000000..e5f20e1 --- /dev/null +++ b/home/private_dot_config/zsh/zexists.d/cmd/fnm.zsh @@ -0,0 +1 @@ +eval "$(fnm env --shell zsh)" diff --git a/home/private_dot_config/zsh/zexists.d/cmd/fzf.zsh b/home/private_dot_config/zsh/zexists.d/cmd/fzf.zsh new file mode 100644 index 0000000..0eb2299 --- /dev/null +++ b/home/private_dot_config/zsh/zexists.d/cmd/fzf.zsh @@ -0,0 +1,11 @@ +#!/usr/bin/env zsh + +# catppuccin +FZF_COLORS=" +--color=bg+:#302D41,bg:#1E1E2E,spinner:#F8BD96,hl:#F28FAD +--color=fg:#D9E0EE,header:#F28FAD,info:#DDB6F2,pointer:#F8BD96 +--color=marker:#F8BD96,fg+:#F2CDCD,prompt:#DDB6F2,hl+:#F28FAD +" + +export FZF_DEFAULT_OPTS=${FZF_COLORS}${FZF_LAYOUT} + diff --git a/home/private_dot_config/zsh/zexists.d/cmd/lazygit.zsh b/home/private_dot_config/zsh/zexists.d/cmd/lazygit.zsh new file mode 100644 index 0000000..4023854 --- /dev/null +++ b/home/private_dot_config/zsh/zexists.d/cmd/lazygit.zsh @@ -0,0 +1 @@ +alias lg=lazygit diff --git a/home/private_dot_config/zsh/zexists.d/cmd/lsd.zsh b/home/private_dot_config/zsh/zexists.d/cmd/lsd.zsh new file mode 100644 index 0000000..bb98335 --- /dev/null +++ b/home/private_dot_config/zsh/zexists.d/cmd/lsd.zsh @@ -0,0 +1,3 @@ +is-tty && alias lsd="lsd --icon never" +alias ls="lsd --group-directories-first --color=always" +alias lt='lsd --tree --depth=3' diff --git a/home/private_dot_config/zsh/zexists.d/cmd/micromamba.zsh b/home/private_dot_config/zsh/zexists.d/cmd/micromamba.zsh new file mode 100644 index 0000000..02f8474 --- /dev/null +++ b/home/private_dot_config/zsh/zexists.d/cmd/micromamba.zsh @@ -0,0 +1,19 @@ + +alias umamba=micromamba + +# >>> mamba initialize >>> +# !! Contents within this block are managed by 'mamba init' !! +export MAMBA_EXE="$HOME/bin/micromamba"; +export MAMBA_ROOT_PREFIX="$HOME/.micromamba"; +__mamba_setup="$("$MAMBA_EXE" shell hook --shell zsh --prefix "$MAMBA_ROOT_PREFIX" 2> /dev/null)" +if [ $? -eq 0 ]; then + eval "$__mamba_setup" +else + if [ -f "$HOME/.micromamba/etc/profile.d/micromamba.sh" ]; then + . "$HOME/.micromamba/etc/profile.d/micromamba.sh" + else + export PATH="$HOME/.micromamba/bin:$PATH" # extra space after export prevents interference from conda init + fi +fi +unset __mamba_setup +# <<< mamba initialize <<< diff --git a/home/private_dot_config/zsh/zexists.d/cmd/nvim.zsh b/home/private_dot_config/zsh/zexists.d/cmd/nvim.zsh new file mode 100644 index 0000000..2763053 --- /dev/null +++ b/home/private_dot_config/zsh/zexists.d/cmd/nvim.zsh @@ -0,0 +1,3 @@ +export EDITOR=nvim +export VISUAL=nvim +alias vim=nvim diff --git a/home/private_dot_config/zsh/zexists.d/cmd/pnpm.zsh b/home/private_dot_config/zsh/zexists.d/cmd/pnpm.zsh new file mode 100644 index 0000000..2fe43c3 --- /dev/null +++ b/home/private_dot_config/zsh/zexists.d/cmd/pnpm.zsh @@ -0,0 +1,3 @@ +export PNPM_HOME="$HOME/.local/share/pnpm" +path=( "$PNPM_HOME" $path) + diff --git a/home/private_dot_config/zsh/zexists.d/cmd/starship.zsh b/home/private_dot_config/zsh/zexists.d/cmd/starship.zsh new file mode 100644 index 0000000..62fb284 --- /dev/null +++ b/home/private_dot_config/zsh/zexists.d/cmd/starship.zsh @@ -0,0 +1,7 @@ +if is-tty; then + export STARSHIP_CONFIG=~/.config/starship/plain.toml +else + export STARSHIP_CONFIG=~/.config/starship/config.toml +fi + +eval "$(starship init zsh)" diff --git a/home/private_dot_config/zsh/zexists.d/cmd/tmux.zsh b/home/private_dot_config/zsh/zexists.d/cmd/tmux.zsh new file mode 100644 index 0000000..3e58d9e --- /dev/null +++ b/home/private_dot_config/zsh/zexists.d/cmd/tmux.zsh @@ -0,0 +1,7 @@ +alias t-labbook="$DOTFILES_DIR/tmux/labbook.sh" +# source custom tmux.conf with older tmux +alias tmux="tmux -f ~/.config/tmux/tmux.conf" +alias t='tmux' +alias tn='tmux new-session' +alias tl='tmux list-sessions' + diff --git a/home/private_dot_config/zsh/zexists.d/cmd/zellij.zsh b/home/private_dot_config/zsh/zexists.d/cmd/zellij.zsh new file mode 100644 index 0000000..6b21f19 --- /dev/null +++ b/home/private_dot_config/zsh/zexists.d/cmd/zellij.zsh @@ -0,0 +1,3 @@ +alias zs="zellij -s" +alias zl="zellij ls" +alias za="zellij a" diff --git a/home/private_dot_config/zsh/zexists.d/cmd/zoxide.zsh b/home/private_dot_config/zsh/zexists.d/cmd/zoxide.zsh new file mode 100644 index 0000000..6f0192e --- /dev/null +++ b/home/private_dot_config/zsh/zexists.d/cmd/zoxide.zsh @@ -0,0 +1,5 @@ +eval "$(zoxide init zsh --cmd cd)" + +if is-exe lsd; then + export _ZO_FZF_OPTS="--preview 'command lsd --tree --color always --icon always {2..}'" +fi diff --git a/home/private_dot_config/zsh/zexists.d/path/dir-DOLLAR-HOME-SLASH-.deno b/home/private_dot_config/zsh/zexists.d/path/dir-DOLLAR-HOME-SLASH-.deno new file mode 100644 index 0000000..bd5eb87 --- /dev/null +++ b/home/private_dot_config/zsh/zexists.d/path/dir-DOLLAR-HOME-SLASH-.deno @@ -0,0 +1,4 @@ +#!/usr/bin/env zsh + +export DENO_INSTALL="$HOME/.deno"; \ +path=("$DENO_INSTALL/bin" $path) diff --git a/home/private_dot_config/zsh/zexists.d/path/dir-DOLLAR-HOME-SLASH-.nimble b/home/private_dot_config/zsh/zexists.d/path/dir-DOLLAR-HOME-SLASH-.nimble new file mode 100644 index 0000000..f83a6d9 --- /dev/null +++ b/home/private_dot_config/zsh/zexists.d/path/dir-DOLLAR-HOME-SLASH-.nimble @@ -0,0 +1,3 @@ +#!/usr/bin/env zsh + +path=("$HOME/.nimble/bin" $path) diff --git a/home/private_dot_config/zsh/zexists.d/path/dir-DOLLAR-HOME-SLASH-.pkgs-SLASH-google-cloud-sdk b/home/private_dot_config/zsh/zexists.d/path/dir-DOLLAR-HOME-SLASH-.pkgs-SLASH-google-cloud-sdk new file mode 100644 index 0000000..f555b85 --- /dev/null +++ b/home/private_dot_config/zsh/zexists.d/path/dir-DOLLAR-HOME-SLASH-.pkgs-SLASH-google-cloud-sdk @@ -0,0 +1,2 @@ +source "$HOME/.pkgs/google-cloud-sdk/completion.zsh.inc" +path=("$HOME/.pkgs/google-cloud-sdk/bin" $path) diff --git a/home/private_dot_config/zsh/zexists.d/path/dir-DOLLAR-HOME-SLASH-bun b/home/private_dot_config/zsh/zexists.d/path/dir-DOLLAR-HOME-SLASH-bun new file mode 100644 index 0000000..128b862 --- /dev/null +++ b/home/private_dot_config/zsh/zexists.d/path/dir-DOLLAR-HOME-SLASH-bun @@ -0,0 +1,6 @@ +#!/usr/bin/env zsh +# bun completions +[[ -s "$HOME/.bun/_bun" ]] && source "$HOME/.bun/_bun" +# bun +export BUN_INSTALL="$HOME/.bun" +path=("$BUN_INSTALL/bin" $path) diff --git a/home/private_dot_config/zsh/zexists.d/path/dir-DOLLAR-HOME-SLASH-mambaforge b/home/private_dot_config/zsh/zexists.d/path/dir-DOLLAR-HOME-SLASH-mambaforge new file mode 100644 index 0000000..8e50c55 --- /dev/null +++ b/home/private_dot_config/zsh/zexists.d/path/dir-DOLLAR-HOME-SLASH-mambaforge @@ -0,0 +1,52 @@ +#!/usr/bin/env zsh +# Updated to use $HOME + +# >>> conda initialize >>> +# !! Contents within this block are managed by 'conda init' !! +__conda_setup="$("$HOME/mambaforge/bin/conda" 'shell.zsh' 'hook' 2>/dev/null)" +if [ $? -eq 0 ]; then + eval "$__conda_setup" +else + if [ -f "$HOME/mambaforge/etc/profile.d/conda.sh" ]; then + . "$HOME/mambaforge/etc/profile.d/conda.sh" + else + export PATH="$HOME/mambaforge/bin:$PATH" + fi +fi +unset __conda_setup + +if [ -f "$HOME/mambaforge/etc/profile.d/mamba.sh" ]; then + . "$HOME/mambaforge/etc/profile.d/mamba.sh" +fi + +# <<< conda initialize <<< + +# <<< mamba initialize <<< + +snake() { + if [[ $1 == "no" ]]; then + if [[ $VIRTUAL_ENV != "" ]]; then + echo "deactivate python virtualenv: $VIRTUAL_ENV" + deactivate + elif [[ $CONDA_DEFAULT_ENV != "" ]]; then + echo "deactivating conda env: $CONDA_DEFAULT_ENV" + conda deactivate + else + echo 'no environment to leave' + fi + else + if [[ -d $(pwd)/env ]]; then + printf 'activating project-specific env: %s\n' "${PWD##*/}/env" + conda activate ./env + elif [[ -d $(pwd)/venv ]]; then + echo "activating python virtualenv" + source ./venv/bin/activate + elif [[ -d $(pwd)/.venv ]]; then + echo "activating python virtualenv" + source ./.venv/bin/activate + else + echo "is there an environment to activate?" + echo "I was expecting either a conda(env) or virtualenv(venv,.venv)" + fi + fi +}