diff --git a/.zshrc b/.zshrc index 1d880d2..2a52b27 100644 --- a/.zshrc +++ b/.zshrc @@ -2,26 +2,6 @@ if [ -e "$HOME/.nix-profile/etc/profile.d/nix.sh" ]; then . "$HOME/.nix-profile/etc/profile.d/nix.sh" fi -# shellcheck disable=2148,SC2168,SC1090,SC2125 -local FOUND_ATUIN=$+commands[atuin] - -if [[ $FOUND_ATUIN -eq 1 ]]; then - source <(atuin init zsh) -fi - -if command -v starship > /dev/null ; then - source <(starship init zsh) -fi - -if command -v direnv > /dev/null ; then - source <(direnv hook zsh) -fi - -if command -v zoxide > /dev/null ; then - source <(zoxide init zsh) - alias z="$(which zoxide)" -fi - export BAT_THEME="Solarized (light)" export MANPAGER="sh -c 'col -bx | bat -l man -p'" @@ -47,6 +27,34 @@ export FZF_COMPLETION_TRIGGER='~~' export FZF_COMPLETION_OPTS='--border --info=inline' export FZF_DEFAULT_COMMAND='fd --type f --strip-cwd-prefix' +# Use fd (https://github.com/sharkdp/fd) instead of the default find +# command for listing path candidates. +# - The first argument to the function ($1) is the base path to start traversal +# - See the source code (completion.{bash,zsh}) for the details. +_fzf_compgen_path() { + fd --hidden --follow --exclude ".git" . "$1" +} + +# Use fd to generate the list for directory completion +_fzf_compgen_dir() { + fd --type d --hidden --follow --exclude ".git" . "$1" +} + +# (EXPERIMENTAL) Advanced customization of fzf options via _fzf_comprun function +# - The first argument to the function is the name of the command. +# - You should make sure to pass the rest of the arguments to fzf. +_fzf_comprun() { + local command=$1 + shift + + case "$command" in + cd) fzf "$@" --preview 'tree -C {} | head -200' ;; + export|unset) fzf "$@" --preview "eval 'echo \$'{}" ;; + ssh) fzf "$@" --preview 'dig {}' ;; + *) fzf "$@" ;; + esac +} + export LS_COLORS="su=0:ca=0:*~=0;38;2;102;102;102:mh=0:do=0;38;2;0;0;0;48;2;255;106;193:pi=0;38;2;0;0;0;48;2;64;120;242:tw=0:sg=0:ln=0;38;2;255;106;193:ex=1;38;2;228;86;73:ow=0:mi=0;38;2;0;0;0;48;2;228;86;73:cd=0;38;2;255;106;193;48;2;51;51;51:rs=0:fi=0:bd=0;38;2;1;132;188;48;2;51;51;51:st=0:or=0;38;2;0;0;0;48;2;228;86;73:no=0:di=0;38;2;64;120;242:so=0;38;2;0;0;0;48;2;255;106;193:*.d=0;38;2;80;161;79:*.r=0;38;2;80;161;79:*.p=0;38;2;80;161;79:*.a=1;38;2;228;86;73:*.z=4;38;2;1;132;188:*.c=0;38;2;80;161;79:*.h=0;38;2;80;161;79:*.m=0;38;2;80;161;79:*.t=0;38;2;80;161;79:*.o=0;38;2;102;102;102:*.ex=0;38;2;80;161;79:*.nb=0;38;2;80;161;79:*.td=0;38;2;80;161;79:*.wv=0;38;2;255;106;193:*.ui=0;38;2;193;132;1:*.el=0;38;2;80;161;79:*.md=0;38;2;193;132;1:*.cr=0;38;2;80;161;79:*.mn=0;38;2;80;161;79:*.pm=0;38;2;80;161;79:*.ts=0;38;2;80;161;79:*css=0;38;2;80;161;79:*.di=0;38;2;80;161;79:*.go=0;38;2;80;161;79:*.fs=0;38;2;80;161;79:*.vb=0;38;2;80;161;79:*.rb=0;38;2;80;161;79:*.js=0;38;2;80;161;79:*.ps=0;38;2;228;86;73:*.lo=0;38;2;102;102;102:*.gz=4;38;2;1;132;188:*.py=0;38;2;80;161;79:*.hh=0;38;2;80;161;79:*.7z=4;38;2;1;132;188:*.cp=0;38;2;80;161;79:*.ml=0;38;2;80;161;79:*.kt=0;38;2;80;161;79:*.bz=4;38;2;1;132;188:*.la=0;38;2;102;102;102:*.sh=0;38;2;80;161;79:*.gv=0;38;2;80;161;79:*.ll=0;38;2;80;161;79:*.as=0;38;2;80;161;79:*.ko=1;38;2;228;86;73:*.bc=0;38;2;102;102;102:*.rm=0;38;2;255;106;193:*.jl=0;38;2;80;161;79:*.xz=4;38;2;1;132;188:*.so=1;38;2;228;86;73:*.hs=0;38;2;80;161;79:*.rs=0;38;2;80;161;79:*.cc=0;38;2;80;161;79:*.pp=0;38;2;80;161;79:*.cs=0;38;2;80;161;79:*.pl=0;38;2;80;161;79:*.hi=0;38;2;102;102;102:*.bmp=0;38;2;255;106;193:*TODO=1:*.tgz=4;38;2;1;132;188:*.zip=4;38;2;1;132;188:*.zsh=0;38;2;80;161;79:*.mp4=0;38;2;255;106;193:*.xcf=0;38;2;255;106;193:*.pbm=0;38;2;255;106;193:*.deb=4;38;2;1;132;188:*.inl=0;38;2;80;161;79:*.htc=0;38;2;80;161;79:*.inc=0;38;2;80;161;79:*.htm=0;38;2;193;132;1:*.tbz=4;38;2;1;132;188:*.epp=0;38;2;80;161;79:*.tml=0;38;2;193;132;1:*.cxx=0;38;2;80;161;79:*.ltx=0;38;2;80;161;79:*.ini=0;38;2;193;132;1:*.fls=0;38;2;102;102;102:*.tmp=0;38;2;102;102;102:*.bat=1;38;2;228;86;73:*.sbt=0;38;2;80;161;79:*.txt=0;38;2;193;132;1:*.iso=4;38;2;1;132;188:*.wmv=0;38;2;255;106;193:*.svg=0;38;2;255;106;193:*.swp=0;38;2;102;102;102:*.bag=4;38;2;1;132;188:*.ico=0;38;2;255;106;193:*.bak=0;38;2;102;102;102:*.sxi=0;38;2;228;86;73:*.pps=0;38;2;228;86;73:*.kts=0;38;2;80;161;79:*.mov=0;38;2;255;106;193:*.dmg=4;38;2;1;132;188:*.flv=0;38;2;255;106;193:*.blg=0;38;2;102;102;102:*.fon=0;38;2;255;106;193:*.rar=4;38;2;1;132;188:*.toc=0;38;2;102;102;102:*.rtf=0;38;2;228;86;73:*.log=0;38;2;102;102;102:*.yml=0;38;2;193;132;1:*.bin=4;38;2;1;132;188:*.ppt=0;38;2;228;86;73:*.hpp=0;38;2;80;161;79:*.idx=0;38;2;102;102;102:*.mir=0;38;2;80;161;79:*.pod=0;38;2;80;161;79:*.csx=0;38;2;80;161;79:*.hxx=0;38;2;80;161;79:*.pgm=0;38;2;255;106;193:*.tsx=0;38;2;80;161;79:*.odt=0;38;2;228;86;73:*.ipp=0;38;2;80;161;79:*.bz2=4;38;2;1;132;188:*.xml=0;38;2;193;132;1:*.ics=0;38;2;228;86;73:*.nix=0;38;2;193;132;1:*.pkg=4;38;2;1;132;188:*.dll=1;38;2;228;86;73:*.avi=0;38;2;255;106;193:*.fsi=0;38;2;80;161;79:*.jpg=0;38;2;255;106;193:*.m4a=0;38;2;255;106;193:*.otf=0;38;2;255;106;193:*.fsx=0;38;2;80;161;79:*.awk=0;38;2;80;161;79:*.eps=0;38;2;255;106;193:*.tar=4;38;2;1;132;188:*.swf=0;38;2;255;106;193:*.def=0;38;2;80;161;79:*.rpm=4;38;2;1;132;188:*.zst=4;38;2;1;132;188:*.bsh=0;38;2;80;161;79:*.sxw=0;38;2;228;86;73:*.vim=0;38;2;80;161;79:*.tcl=0;38;2;80;161;79:*.cgi=0;38;2;80;161;79:*.tex=0;38;2;80;161;79:*.pas=0;38;2;80;161;79:*.wma=0;38;2;255;106;193:*.csv=0;38;2;193;132;1:*.mpg=0;38;2;255;106;193:*.sql=0;38;2;80;161;79:*.dpr=0;38;2;80;161;79:*.mp3=0;38;2;255;106;193:*.png=0;38;2;255;106;193:*.ind=0;38;2;102;102;102:*.jar=4;38;2;1;132;188:*.apk=4;38;2;1;132;188:*.mkv=0;38;2;255;106;193:*.pyo=0;38;2;102;102;102:*.php=0;38;2;80;161;79:*.kex=0;38;2;228;86;73:*.ilg=0;38;2;102;102;102:*.bib=0;38;2;193;132;1:*.xlr=0;38;2;228;86;73:*.xls=0;38;2;228;86;73:*.h++=0;38;2;80;161;79:*.asa=0;38;2;80;161;79:*.pyc=0;38;2;102;102;102:*.mli=0;38;2;80;161;79:*.vob=0;38;2;255;106;193:*.pid=0;38;2;102;102;102:*.ppm=0;38;2;255;106;193:*.cpp=0;38;2;80;161;79:*.m4v=0;38;2;255;106;193:*.clj=0;38;2;80;161;79:*.gif=0;38;2;255;106;193:*.doc=0;38;2;228;86;73:*.com=1;38;2;228;86;73:*.vcd=4;38;2;1;132;188:*.exs=0;38;2;80;161;79:*.git=0;38;2;102;102;102:*.bst=0;38;2;193;132;1:*.pro=0;38;2;80;161;79:*.erl=0;38;2;80;161;79:*.img=4;38;2;1;132;188:*.aif=0;38;2;255;106;193:*.arj=4;38;2;1;132;188:*.rst=0;38;2;193;132;1:*.ttf=0;38;2;255;106;193:*.ods=0;38;2;228;86;73:*hgrc=0;38;2;80;161;79:*.aux=0;38;2;102;102;102:*.dox=0;38;2;80;161;79:*.fnt=0;38;2;255;106;193:*.bbl=0;38;2;102;102;102:*.psd=0;38;2;255;106;193:*.xmp=0;38;2;193;132;1:*.mid=0;38;2;255;106;193:*.ogg=0;38;2;255;106;193:*.bcf=0;38;2;102;102;102:*.cfg=0;38;2;193;132;1:*.exe=1;38;2;228;86;73:*.tif=0;38;2;255;106;193:*.dot=0;38;2;80;161;79:*.elm=0;38;2;80;161;79:*.pdf=0;38;2;228;86;73:*.odp=0;38;2;228;86;73:*.lua=0;38;2;80;161;79:*.c++=0;38;2;80;161;79:*.pyd=0;38;2;102;102;102:*.out=0;38;2;102;102;102:*.gvy=0;38;2;80;161;79:*.sty=0;38;2;102;102;102:*.ps1=0;38;2;80;161;79:*.wav=0;38;2;255;106;193:*.lisp=0;38;2;80;161;79:*.epub=0;38;2;228;86;73:*.flac=0;38;2;255;106;193:*.conf=0;38;2;193;132;1:*.toml=0;38;2;193;132;1:*.psd1=0;38;2;80;161;79:*.diff=0;38;2;80;161;79:*.opus=0;38;2;255;106;193:*.lock=0;38;2;102;102;102:*.tiff=0;38;2;255;106;193:*.json=0;38;2;193;132;1:*.fish=0;38;2;80;161;79:*.java=0;38;2;80;161;79:*.psm1=0;38;2;80;161;79:*.dart=0;38;2;80;161;79:*.xlsx=0;38;2;228;86;73:*.orig=0;38;2;102;102;102:*.webm=0;38;2;255;106;193:*.docx=0;38;2;228;86;73:*.jpeg=0;38;2;255;106;193:*.tbz2=4;38;2;1;132;188:*.yaml=0;38;2;193;132;1:*.less=0;38;2;80;161;79:*.purs=0;38;2;80;161;79:*.rlib=0;38;2;102;102;102:*.html=0;38;2;193;132;1:*.bash=0;38;2;80;161;79:*.h264=0;38;2;255;106;193:*.pptx=0;38;2;228;86;73:*.mpeg=0;38;2;255;106;193:*.hgrc=0;38;2;80;161;79:*.make=0;38;2;80;161;79:*.cabal=0;38;2;80;161;79:*.shtml=0;38;2;193;132;1:*README=0;38;2;250;250;250;48;2;193;132;1:*.class=0;38;2;102;102;102:*shadow=0;38;2;193;132;1:*.swift=0;38;2;80;161;79:*.xhtml=0;38;2;193;132;1:*.ipynb=0;38;2;80;161;79:*.cmake=0;38;2;80;161;79:*.cache=0;38;2;102;102;102:*passwd=0;38;2;193;132;1:*.mdown=0;38;2;193;132;1:*.dyn_o=0;38;2;102;102;102:*.scala=0;38;2;80;161;79:*.toast=4;38;2;1;132;188:*.patch=0;38;2;80;161;79:*TODO.md=1:*LICENSE=0;38;2;153;153;153:*.flake8=0;38;2;80;161;79:*.gradle=0;38;2;80;161;79:*.config=0;38;2;193;132;1:*.ignore=0;38;2;80;161;79:*.dyn_hi=0;38;2;102;102;102:*COPYING=0;38;2;153;153;153:*.matlab=0;38;2;80;161;79:*.groovy=0;38;2;80;161;79:*INSTALL=0;38;2;250;250;250;48;2;193;132;1:*setup.py=0;38;2;80;161;79:*TODO.txt=1:*Makefile=0;38;2;80;161;79:*.desktop=0;38;2;193;132;1:*.gemspec=0;38;2;80;161;79:*Doxyfile=0;38;2;80;161;79:*configure=0;38;2;80;161;79:*.DS_Store=0;38;2;102;102;102:*.rgignore=0;38;2;80;161;79:*README.md=0;38;2;250;250;250;48;2;193;132;1:*.fdignore=0;38;2;80;161;79:*.kdevelop=0;38;2;80;161;79:*.cmake.in=0;38;2;80;161;79:*COPYRIGHT=0;38;2;153;153;153:*.markdown=0;38;2;193;132;1:*CODEOWNERS=0;38;2;80;161;79:*.localized=0;38;2;102;102;102:*INSTALL.md=0;38;2;250;250;250;48;2;193;132;1:*Dockerfile=0;38;2;193;132;1:*.scons_opt=0;38;2;102;102;102:*README.txt=0;38;2;250;250;250;48;2;193;132;1:*SConscript=0;38;2;80;161;79:*.gitconfig=0;38;2;80;161;79:*SConstruct=0;38;2;80;161;79:*.gitignore=0;38;2;80;161;79:*.synctex.gz=0;38;2;102;102;102:*INSTALL.txt=0;38;2;250;250;250;48;2;193;132;1:*.gitmodules=0;38;2;80;161;79:*MANIFEST.in=0;38;2;80;161;79:*Makefile.am=0;38;2;80;161;79:*Makefile.in=0;38;2;102;102;102:*LICENSE-MIT=0;38;2;153;153;153:*.travis.yml=0;38;2;80;161;79:*appveyor.yml=0;38;2;80;161;79:*configure.ac=0;38;2;80;161;79:*.applescript=0;38;2;80;161;79:*CONTRIBUTORS=0;38;2;250;250;250;48;2;193;132;1:*.fdb_latexmk=0;38;2;102;102;102:*.clang-format=0;38;2;80;161;79:*CMakeLists.txt=0;38;2;80;161;79:*LICENSE-APACHE=0;38;2;153;153;153:*CMakeCache.txt=0;38;2;102;102;102:*.gitattributes=0;38;2;80;161;79:*CONTRIBUTORS.md=0;38;2;250;250;250;48;2;193;132;1:*requirements.txt=0;38;2;80;161;79:*CONTRIBUTORS.txt=0;38;2;250;250;250;48;2;193;132;1:*.sconsign.dblite=0;38;2;102;102;102:*package-lock.json=0;38;2;102;102;102:*.CFUserTextEncoding=0;38;2;102;102;102" if which exa > /dev/null 2>&1 ; then @@ -83,3 +91,7 @@ function ll { } alias http_server="python3 -m http.server" +alias z="$(which zoxide)" + +[ -f "$HOME/.zshrc.local" ] && source "$HOME/.zshrc.local" +[ -f "$HOME/.zshrc.auto" ] && source "$HOME/.zshrc.auto"