diff options
-rw-r--r-- | bash/.bashrc | 26 | ||||
-rw-r--r-- | bash/.profile | 30 | ||||
-rw-r--r-- | sheldon/.config/sheldon/plugins.toml | 45 | ||||
-rw-r--r-- | zsh/.config/zsh/.zshrc | 89 | ||||
-rw-r--r-- | zsh/.zshenv | 30 |
5 files changed, 83 insertions, 137 deletions
diff --git a/bash/.bashrc b/bash/.bashrc index 24c8780..25d092d 100644 --- a/bash/.bashrc +++ b/bash/.bashrc @@ -1,3 +1,5 @@ +#!/usr/bin/bash + # Aliases alias ls='ls --color=tty' alias l='ls -lah' @@ -26,26 +28,10 @@ alias dclf="docker compose logs -f" alias dct="docker context" alias dcu="docker context use" -if [ $PS1 && -d "$BASHCOMPDIR" ]; then - for f in $BASHCOMPDIR/*; do - source $f +if [[ $- == *i* ]] && [ -d "$BASHCOMPDIR" ]; then + for f in "$BASHCOMPDIR"/*; do + source "$f" done fi -command -v starship >/dev/null 2>&1 && eval "$(starship init bash)" - -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" -} - -starship_precmd_user_func="set_win_title" +command -v starship >/dev/null 2>&1 && source <(starship init bash) diff --git a/bash/.profile b/bash/.profile index 4188ba5..281033c 100644 --- a/bash/.profile +++ b/bash/.profile @@ -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 diff --git a/sheldon/.config/sheldon/plugins.toml b/sheldon/.config/sheldon/plugins.toml new file mode 100644 index 0000000..297a017 --- /dev/null +++ b/sheldon/.config/sheldon/plugins.toml @@ -0,0 +1,45 @@ +[plugins] + +[plugins.zsh-defer] +github = 'romkatv/zsh-defer' + +[templates] +defer = { value = 'zsh-defer source "{{ file }}"', each = true } +comp = { value = 'mkdir -p "$XDG_DATA_HOME/zsh/site-functions"; ln -sf "{{ file }}" "$XDG_DATA_HOME/zsh/site-functions/_{{ name }}"', each = true } + +[plugins.fast-syntax-highlighting] +github = "zdharma-continuum/fast-syntax-highlighting" +apply = ["defer"] + +[plugins.zsh-shift-select] +github = "jirutka/zsh-shift-select" +apply = ["defer"] + +[plugins.fzf-tab] +github = "Aloxaf/fzf-tab" +apply = ["defer"] + +[plugins.zsh-fzf-history-search] +github = "joshskidmore/zsh-fzf-history-search" +apply = ["defer"] + +[plugins.zsh-completions] +github = "zsh-users/zsh-completions" + +[plugins.zsh-pandoc-completion] +github = "srijanshetty/zsh-pandoc-completion" + +[plugins.dotnet] +remote = "https://raw.githubusercontent.com/dotnet/cli/master/scripts/register-completions.zsh" +apply = ["comp"] + +[plugins.docker] +remote = "https://raw.githubusercontent.com/docker/cli/master/contrib/completion/zsh/_docker" +apply = ["comp"] + +[plugins.zsh-autosuggestions] +github = "zsh-users/zsh-autosuggestions" +use = ["{{ name }}.zsh"] + +[plugins.compinit] +inline = 'autoload -Uz compinit && zsh-defer compinit'
\ No newline at end of file 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 |