summaryrefslogtreecommitdiffstatshomepage
path: root/zsh
diff options
context:
space:
mode:
Diffstat (limited to 'zsh')
-rw-r--r--zsh/.config/zsh/.zshrc89
-rw-r--r--zsh/.zshenv30
2 files changed, 17 insertions, 102 deletions
diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc
index ceca7dc..69a12ac 100644
--- a/zsh/.config/zsh/.zshrc
+++ b/zsh/.config/zsh/.zshrc
@@ -59,93 +59,8 @@ command -v fd &>/dev/null && _fzf_compgen_dir() {
fd --type d --hidden --follow --exclude ".git" . "$1"
}
-eval "$(starship init zsh 2>/dev/null)"
-
-set_win_title() {
- local prefix
-
- if [ "$USER" != "tobyv" ]; then
- prefix="${USER} in "
- fi
-
- if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
- prefix="${prefix/in/on}${HOST} in "
- fi
-
- echo -ne "\033]0;${prefix}${PWD/$HOME/~}\007"
-}
-
-precmd_functions+=(set_win_title)
-
bindkey '^ ' autosuggest-accept
bindkey '^[[Z' reverse-menu-complete
-# Plugins
-function plugin-load {
- local repo plugin_name plugin_dir initfile initfiles
- export ZPLUGINDIR=${ZPLUGINDIR:-${ZDOTDIR:-$HOME/.config/zsh}/plugins}
- for repo in $@; do
- plugin_name=${repo:t}
- plugin_dir=$ZPLUGINDIR/$plugin_name
- initfile=$plugin_dir/$plugin_name.plugin.zsh
-
- if [[ ! -d $plugin_dir ]]; then
- echo "Cloning $repo"
- git clone -q --depth 1 --recursive --shallow-submodules https://github.com/$repo $plugin_dir
- fi
-
- if [[ ! -e $initfile ]]; then
- initfiles=($plugin_dir/*.plugin.{z,}sh(N) $plugin_dir/*.{z,}sh{-theme,}(N))
- [[ ${#initfiles[@]} -gt 0 ]] || { echo "Plugin has no init file '$repo'." >&2 && continue }
- ln -sf "${initfiles[1]}" "$initfile"
- fi
-
- fpath+=$plugin_dir
- (( $+functions[zsh-defer] )) && zsh-defer . $initfile || . $initfile
- done
-}
-
-repos=(
- romkatv/zsh-defer
- jirutka/zsh-shift-select
- zsh-users/zsh-completions
- Aloxaf/fzf-tab
- joshskidmore/zsh-fzf-history-search
- srijanshetty/zsh-pandoc-completion
- zsh-users/zsh-syntax-highlighting
- zsh-users/zsh-autosuggestions
-)
-
-plugin-load $repos
-
-function comp-load {
- local comp src name comp_file
- export ZCOMPDIR=${ZCOMPDIR:-${XDG_DATA_HOME:-$HOME/.local/share}/zsh/site-functions}
- mkdir -p $ZCOMPDIR
- for comp in $@; do
- src="$(echo $comp | sed 's/[:][^:]*$//')"
- name="$(echo $comp | sed 's/.*[:]//' | sed 's/^[^_]/_&/')"
-
- if [[ -n $name ]]; then
- name="$(basename $src | sed 's/^[^_]/_&/')"
- fi
-
- comp_file=$ZCOMPDIR/$name
-
- if [[ ! -f $comp_file ]]; then
- curl -sL https://raw.githubusercontent.com/$src >$comp_file
- fi
- done
-
- fpath+=$ZCOMPDIR
-
- autoload -U compinit
- compinit -i
-
- zstyle ':completion:*' menu select
-}
-
-comps=(
- dotnet/cli/master/scripts/register-completions.zsh:_dotnet
- docker/cli/master/contrib/completion/zsh/_docker
-)
+command -v starship &>/dev/null && source <(starship init zsh)
+command -v sheldon &>/dev/null && source <(sheldon source)
diff --git a/zsh/.zshenv b/zsh/.zshenv
index 4188ba5..281033c 100644
--- a/zsh/.zshenv
+++ b/zsh/.zshenv
@@ -1,20 +1,20 @@
# XDG
-export XDG_CONFIG_HOME=$HOME/.config
-export XDG_CACHE_HOME=$HOME/.cache
-export XDG_DATA_HOME=$HOME/.local/share
-export XDG_RUNTIME_DIR=$HOME/.xdg
+export XDG_CONFIG_HOME="$HOME"/.config
+export XDG_CACHE_HOME="$HOME"/.cache
+export XDG_DATA_HOME="$HOME"/.local/share
+export XDG_RUNTIME_DIR="$HOME"/.xdg
# Shell
-export ZDOTDIR=$XDG_CONFIG_HOME/zsh
-export BASH_COMPLETION_USER_DIR=$XDG_DATA_HOME/bash-completion/completions
+export ZDOTDIR="$XDG_CONFIG_HOME"/zsh
+export BASH_COMPLETION_USER_DIR="$XDG_DATA_HOME"/bash-completion/completions
# Misc
-export EDITOR="$(command -v vim 2>/dev/null || command -v vi)"
+export EDITOR="$( command -v nvim 2>/dev/null || command -v vim 2>/dev/null || command -v vi )"
export VISUAL="code --wait"
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
export MANROFFOPT="-c"
-export GOPATH=$HOME/.go
-export GPG_TTY=$(tty)
+export GOPATH="$HOME"/.go
+export GPG_TTY=$( tty )
export STARSHIP_LOG="error"
export FZF_PREVIEW_COMMAND="bat --style=numbers,changes --wrap never --color always {} || cat {} || tree -C {}"
export FZF_DEFAULT_COMMAND="fd --type f || git ls-tree -r --name-only HEAD || rg --files || find ."
@@ -22,9 +22,9 @@ export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
export FZF_CTRL_T_OPTS="--min-height 30 --preview-window down:60% --preview-window noborder --preview '($FZF_PREVIEW_COMMAND) 2> /dev/null'"
# Path
-export PATH=$PATH:$HOME/.local/bin
-export PATH=$PATH:$HOME/.scripts
-export PATH=$PATH:$HOME/.go/bin
-export PATH=$PATH:$HOME/.dotnet/tools
-export PATH=$PATH:$HOME/.cargo/bin
-export PATH=$PATH:/usr/local/texlive/2021/bin/x86_64-linux
+export PATH="$PATH":"$HOME"/.local/bin
+export PATH="$PATH":"$HOME"/.scripts
+export PATH="$PATH":"$HOME"/.go/bin
+export PATH="$PATH":"$HOME"/.dotnet/tools
+export PATH="$PATH":"$HOME"/.cargo/bin
+export PATH="$PATH":/usr/local/texlive/2021/bin/x86_64-linux