summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2024-02-22 23:50:29 -0500
committerJesse Luehrs <doy@tozt.net>2024-02-22 23:50:29 -0500
commit82afe435a24f4ea88182f3051e6837d5d6c0d68a (patch)
tree413ecb4678dc25e29cef6618de4052d73ebf8334
parent44ce00838e967a1f95b4e55cd4b57fa7aa3f4456 (diff)
downloadconf-82afe435a24f4ea88182f3051e6837d5d6c0d68a.tar.gz
conf-82afe435a24f4ea88182f3051e6837d5d6c0d68a.zip
clean up my shell config a bit
-rw-r--r--bash/.bash_profile2
-rw-r--r--bash/.bashrc25
-rw-r--r--sh/.config/sh/aliases1
-rw-r--r--sh/.config/sh/cdhist.sh174
-rw-r--r--sh/.config/sh/env7
-rw-r--r--sh/.config/sh/functions14
-rw-r--r--zsh/.zshinput16
-rw-r--r--zsh/.zshrc51
8 files changed, 39 insertions, 251 deletions
diff --git a/bash/.bash_profile b/bash/.bash_profile
index b200eb1..e8c96d8 100644
--- a/bash/.bash_profile
+++ b/bash/.bash_profile
@@ -1,4 +1,4 @@
-# shellcheck source=bashrc
+# shellcheck source=bash/.bashrc
. "$HOME"/.bashrc
# vim:ft=sh:
diff --git a/bash/.bashrc b/bash/.bashrc
index 9341497..74ac5cf 100644
--- a/bash/.bashrc
+++ b/bash/.bashrc
@@ -1,15 +1,10 @@
# language environments {{{
-# shellcheck disable=1090
-test -f "$HOME"/perl5/perlbrew/etc/bashrc && source "$HOME"/perl5/perlbrew/etc/bashrc
-test -f "$HOME"/python/bin/activate && source "$HOME"/python/bin/activate
-type rbenv > /dev/null 2>&1 && eval "$(rbenv init -)"
-test -d "$HOME"/.cargo/bin && export PATH="$HOME/.cargo/bin:$PATH"
+test -d "$HOME/.cargo/bin" && export PATH="$HOME/.cargo/bin:$PATH"
# }}}
# environment {{{
-[ -d /usr/share/git/diff-highlight ] && export PATH="/usr/share/git/diff-highlight:${PATH}"
-[ -d /usr/local/share/git-core/contrib/diff-highlight ] && export PATH="/usr/local/share/git-core/contrib/diff-highlight:${PATH}"
-PATH="${HOME}/.bin/local:${HOME}/.bin/$(hostname):${HOME}/.bin:/usr/lib/ccache/bin:$PATH"
+PATH="${HOME}/.bin/local:${HOME}/.bin/$(hostname):${HOME}/.bin:$PATH"
export PATH
+# shellcheck source=sh/.config/sh/env
[ -f "$HOME/.config/sh/env" ] && source "$HOME"/.config/sh/env
# }}}
# Test for an interactive shell. {{{
@@ -19,16 +14,11 @@ if [[ $- != *i* ]] ; then
# Shell is non-interactive. Be done now!
return
fi
-[ -z "$PS1" ] && return # }}}
-# Change the window title of X terminals {{{
-case ${TERM} in
- xterm*|rxvt*|Eterm|aterm|kterm|gnome|screen*)
- PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"'
- ;;
-esac # }}}
+[ -z "$PS1" ] && return
+# }}}
# aliases {{{
+# shellcheck source=sh/.config/sh/aliases
[ -f "$HOME/.config/sh/aliases" ] && source "$HOME"/.config/sh/aliases
-[ -f "$HOME/.config/sh/functions" ] && source "$HOME"/.config/sh/functions
# }}}
# completion {{{
#shellcheck disable=SC1091
@@ -56,8 +46,9 @@ else
export PROMPT_COMMAND="${PROMPT_COMMAND};history -a"
fi
# plugins {{{
-source ~/.config/sh/cdhist.sh
+# shellcheck source=sh/.config/sh/fzf/shell/completion.bash
source ~/.config/sh/fzf/shell/completion.bash
+# shellcheck source=sh/.config/sh/fzf/shell/key-bindings.bash
source ~/.config/sh/fzf/shell/key-bindings.bash
# }}}
# prompt {{{
diff --git a/sh/.config/sh/aliases b/sh/.config/sh/aliases
index ce0b6f0..c5b716f 100644
--- a/sh/.config/sh/aliases
+++ b/sh/.config/sh/aliases
@@ -29,6 +29,7 @@ alias debian="podman run --rm -itv "${HOME}:${HOME}" docker.io/debian:stable bas
alias ubuntu="podman run --rm -itv "${HOME}:${HOME}" docker.io/ubuntu:latest bash"
alias alpine="podman run --rm -itv "${HOME}:${HOME}" docker.io/alpine:latest sh"
alias arch="podman run --rm -itv "${HOME}:${HOME}" docker.io/archlinux:latest sh"
+alias cdu="cd \"\$(git root)\""
# }}}
# vim:ft=sh:fdm=marker
diff --git a/sh/.config/sh/cdhist.sh b/sh/.config/sh/cdhist.sh
deleted file mode 100644
index d67d2e9..0000000
--- a/sh/.config/sh/cdhist.sh
+++ /dev/null
@@ -1,174 +0,0 @@
-### cdhist.sh
-###
-### Copyright (c) 2001 Yusuke Shinyama <yusuke at cs . nyu . edu>
-###
-### Permission to use, copy, modify, distribute this software and
-### its documentation for any purpose is hereby granted, provided
-### that existing copyright notices are retained in all copies and
-### that this notice is included verbatim in any distributions.
-### This software is provided ``AS IS'' without any express or implied
-### warranty.
-###
-
-### WARNING: THIS SCRIPT IS FOR GNU BASH ONLY!
-
-### What is this?
-###
-### Cdhist adds 'web-browser like history' to your bash shell.
-### Every time you change the current directory it records the directory
-### you can go back by simply typing a short command such as '-' or '+',
-### just like clicking web-browsers's 'back' button.
-### It's more convenient than using directory stacks when
-### you walk around two or three directories.
-###
-
-### Usage
-###
-### Just call this file from your .bashrc script.
-### The following commands are added.
-###
-### cd [pathname]
-### Go to the given directory, or your home directory if
-### pathname is omitted. This overrides the original command.
-### You can use it by typing '\cd'.
-###
-### + [n]
-### 'Forward' button. Go to the n'th posterior directory in the history.
-### Go to the next directory if the number is omitted.
-###
-### - [n]
-### 'Back' button. Go to the n'th prior directory in the history.
-### Go to the previous directory if the number is omitted.
-###
-### = [n]
-### Show histories with directory numbers.
-###
-### A directory number shows the index to the current directory
-### in the history. The current directory always has directory number 0.
-### For prior directories, a negative number is given.
-### For posterior directories, a positive number is given.
-###
-### cdhist_reset
-### Clear the cd history.
-###
-
-### Example
-###
-### /home/yusuke:$ . cdhist.sh
-### /home/yusuke:$ cd /tmp
-### /tmp:$ cd /usr/bin
-### /usr/bin:$ cd /etc
-### /etc:$ -
-### /usr/bin:$ -
-### /tmp:$ +
-### /usr/bin:$ =
-### -2 ~
-### -1 /tmp
-### 0:/usr/bin
-### 1 /etc
-### /usr/bin:$ - 2
-### /home/yusuke:$
-###
-
-
-CDHIST_CDQMAX=10
-declare -a CDHIST_CDQ
-
-function cdhist_reset {
- CDHIST_CDQ=("$PWD")
-}
-
-function cdhist_disp {
- echo "$*" | sed "s $HOME ~ g"
-}
-
-function cdhist_add {
- CDHIST_CDQ=("$1" "${CDHIST_CDQ[@]}")
-}
-
-function cdhist_del {
- [[ -n $ZSH_VERSION ]] && setopt localoptions && setopt ksharrays
- local i=${1-0}
- if [ ${#CDHIST_CDQ[@]} -le 1 ]; then return; fi
- for ((; i<${#CDHIST_CDQ[@]}-1; i++)); do
- CDHIST_CDQ[$i]="${CDHIST_CDQ[$((i+1))]}"
- done
- unset CDHIST_CDQ[$i]
-}
-
-function cdhist_rot {
- [[ -n $ZSH_VERSION ]] && setopt localoptions && setopt ksharrays
- local i q
- declare -a q
- for ((i=0; i<$1; i++)); do
- q[$i]="${CDHIST_CDQ[$(((i+$1+$2)%$1))]}"
- done
- for ((i=0; i<$1; i++)); do
- CDHIST_CDQ[$i]="${q[$i]}"
- done
-}
-
-function cdhist_cd {
- [[ -n $ZSH_VERSION ]] && setopt localoptions && setopt ksharrays
- local i f=0
- builtin cd "$@" || return 1
- for ((i=0; i<${#CDHIST_CDQ[@]}; i++)); do
- if [ "${CDHIST_CDQ[$i]}" = "$PWD" ]; then f=1; break; fi
- done
- if [ $f -eq 1 ]; then
- cdhist_rot $((i+1)) -1
- elif [ ${#CDHIST_CDQ[@]} -lt $CDHIST_CDQMAX ]; then
- cdhist_add "$PWD"
- else
- cdhist_rot ${#CDHIST_CDQ[@]} -1
- CDHIST_CDQ[0]="$PWD"
- fi
-}
-
-function cdhist_history {
- [[ -n $ZSH_VERSION ]] && setopt localoptions && setopt ksharrays
- local i d
- if [ $# -eq 0 ]; then
- for ((i=${#CDHIST_CDQ[@]}-1; 0<=i; i--)); do
- cdhist_disp " $i ${CDHIST_CDQ[$i]}"
- done
- elif [ "$1" -lt ${#CDHIST_CDQ[@]} ]; then
- d=${CDHIST_CDQ[$1]}
- if builtin cd "$d"; then
- cdhist_rot $(($1+1)) -1
- else
- cdhist_del $1
- fi
- cdhist_disp "${CDHIST_CDQ[@]}"
- fi
-}
-
-function cdhist_forward {
- [[ -n $ZSH_VERSION ]] && setopt localoptions && setopt ksharrays
- cdhist_rot ${#CDHIST_CDQ[@]} -${1-1}
- if ! builtin cd "${CDHIST_CDQ[0]}"; then
- cdhist_del 0
- fi
- cdhist_disp "${CDHIST_CDQ[@]}"
-}
-
-function cdhist_back {
- [[ -n $ZSH_VERSION ]] && setopt localoptions && setopt ksharrays
- cdhist_rot ${#CDHIST_CDQ[@]} ${1-1}
- if ! builtin cd "${CDHIST_CDQ[0]}"; then
- cdhist_del 0
- fi
- cdhist_disp "${CDHIST_CDQ[@]}"
-}
-
-
-if [ ${#CDHIST_CDQ[@]} = 0 ]; then cdhist_reset; fi
-
-
-### Aliases
-###
-
-function cd { cdhist_cd "$@"; }
-function + { cdhist_forward "$@"; }
-function - { cdhist_back "$@"; }
-function = { cdhist_history "$@"; }
diff --git a/sh/.config/sh/env b/sh/.config/sh/env
index 33b33ec..a715fdb 100644
--- a/sh/.config/sh/env
+++ b/sh/.config/sh/env
@@ -1,5 +1,3 @@
-GPG_TTY=$(tty)
-export GPG_TTY
export MANPAGER="$HOME/.bin/vimmanpager"
export PERLDOC_PAGER="$HOME/.bin/vimmanpager"
EDITOR=$(command -v helix)
@@ -15,12 +13,7 @@ if type sudo-askpass >/dev/null 2>&1; then
fi
export TEXINPUTS=".:$HOME/.config/tex:"
export LESS='-QR'
-export PERL_CPANM_OPT="-q --mirror http://mirrors.kernel.org/cpan/ --mirror http://cpan.metacpan.org/ --prompt"
export FZF_DEFAULT_OPTS="--reverse --inline-info --bind=tab:down,shift-tab:up,change:top,ctrl-space:toggle"
export FZF_DEFAULT_COMMAND="rg --hidden -l ."
-export FANCY_PROMPT_COLORS="user_doy=bright_blue,host_mz-doy1=bright_white,host_tozt=bright_yellow,host_partofme=magenta,host_mail=green,host_hornet=red"
-export PASSWORD_STORE_X_SELECTION=primary
-type brew >/dev/null 2>&1 && export PATH="/usr/local/opt/coreutils/libexec/gnubin:/usr/local/opt/findutils/libexec/gnubin:/usr/local/sbin:$PATH"
-type brew >/dev/null 2>&1 && export MANPATH="/usr/local/opt/coreutils/libexec/gnuman:/usr/local/opt/findutils/libexec/gnuman:$MANPATH"
# vim:ft=sh:
diff --git a/sh/.config/sh/functions b/sh/.config/sh/functions
deleted file mode 100644
index b64c4cf..0000000
--- a/sh/.config/sh/functions
+++ /dev/null
@@ -1,14 +0,0 @@
-function perldoc {
- # XXX bash specific
- if type cpandoc >/dev/null 2>&1; then
- cpandoc "$@"
- else
- command perldoc "$@"
- fi
-}
-
-function cdu {
- cd "$(git root)" || return
-}
-
-# vim:ft=sh:
diff --git a/zsh/.zshinput b/zsh/.zshinput
index 3ab9ac4..ada9a5e 100644
--- a/zsh/.zshinput
+++ b/zsh/.zshinput
@@ -12,31 +12,21 @@ bindkey "^[OB" history-beginning-search-forward-end
bindkey -M viins '^R' fzf-history-widget
bindkey -M vicmd '^R' fzf-history-widget
-bindkey -M vicmd '/' history-incremental-search-backward
-bindkey -M vicmd '?' history-incremental-search-forward
-bindkey -rM viins '^[/'
bindkey -M vicmd ')' vi-digit-or-beginning-of-line
bindkey -M vicmd 'e' vi-change
bindkey -M vicmd 'E' vi-change-eol
-bindkey -M vicmd ',' execute-named-cmd
-bindkey -M vicmd '!' vi-insert
bindkey -M vicmd '_' vi-first-non-blank
bindkey -M vicmd '|' send-break
-bindkey -M vicmd '\' send-break
bindkey "^?" backward-delete-char
bindkey "^H" backward-delete-char
-bindkey "^U" backward-kill-line
-
-bindkey "^[[3~" delete-char
+bindkey -M viins "^[[3~" delete-char
+bindkey -M vicmd "^[[3~" delete-char
page-up-within-tmux() {
if [[ $TMUX == '' ]]; then
- # no-op; default behavior isn't useful, and anyway you don't want to do
- # something TOO cool here since you won't be able to do it inside tmux.
- # TODO if there's any way to command the /emu/ to scroll up one page, i
- # would love to hear about it
+ :
else
tmux copy-mode -u
fi
diff --git a/zsh/.zshrc b/zsh/.zshrc
index 43aac8d..d6a4292 100644
--- a/zsh/.zshrc
+++ b/zsh/.zshrc
@@ -1,35 +1,31 @@
# language environments {{{
-test -f $HOME/perl5/perlbrew/etc/bashrc && source $HOME/perl5/perlbrew/etc/bashrc
-test -f $HOME/python/bin/activate && source $HOME/python/bin/activate
-type rbenv > /dev/null 2>&1 && eval "$(rbenv init -)"
-test -d $HOME/.cargo/bin && export PATH="$HOME/.cargo/bin:$PATH"
+test -d "$HOME/.cargo/bin" && export PATH="$HOME/.cargo/bin:$PATH"
# }}}
# environment {{{
# not using .zshenv, because it runs before /etc/profile, and /etc/profile
# tends to hard-set $PATH and such
-[ -d /usr/share/git/diff-highlight ] && export PATH="/usr/share/git/diff-highlight:${PATH}"
-[ -d /usr/local/share/git-core/contrib/diff-highlight ] && export PATH="/usr/local/share/git-core/contrib/diff-highlight:${PATH}"
-export PATH="${HOME}/.bin/local:${HOME}/.bin/$(hostname):${HOME}/.bin:/usr/lib/ccache/bin:$PATH"
-[ -f "$HOME/.config/sh/env" ] && source $HOME/.config/sh/env
+PATH="${HOME}/.bin/local:${HOME}/.bin/$(hostname):${HOME}/.bin:$PATH"
+export PATH
+# shellcheck source=sh/.config/sh/env
+[ -f "$HOME/.config/sh/env" ] && source "$HOME/.config/sh/env"
# }}}
-# Change the window title of X terminals {{{
-function term_title_precmd () {
- echo -ne "\033]0;${USER}@${HOST}:${PWD/$HOME/~}\007"
-}
-case ${TERM} in
- xterm*|rxvt*|Eterm|aterm|kterm|gnome|screen*)
- precmd_functions+=(term_title_precmd)
- ;;
-esac # }}}
# aliases {{{
-[ -f "$HOME/.config/sh/aliases" ] && source $HOME/.config/sh/aliases
-[ -f "$HOME/.config/sh/functions" ] && source $HOME/.config/sh/functions
+# shellcheck source=sh/.config/sh/aliases
+[ -f "$HOME/.config/sh/aliases" ] && source "$HOME/.config/sh/aliases"
# }}}
# completion {{{
-fpath=(~/.config/zsh/local-completions/$(hostname) ~/.config/zsh/local-completions ~/.config/zsh/zsh-completions/src $fpath)
+# shellcheck disable=SC2206
+fpath=( \
+ "${HOME}/.config/zsh/local-completions/$(hostname)" \
+ "${HOME}/.config/zsh/local-completions" \
+ "${HOME}/.config/zsh/zsh-completions/src" \
+ $fpath \
+)
+# shellcheck source=zsh/.zshcomplete
source ~/.zshcomplete
# }}}
# zsh configuration {{{
+# shellcheck source=zsh/.zshinput
source ~/.zshinput
autoload -U colors
colors
@@ -40,18 +36,19 @@ setopt noclobber
setopt nobeep
setopt completeinword
setopt correct
-export REPORTTIME=120
export HISTFILE=$HOME/.zsh_history
export HISTSIZE=1000000000
export SAVEHIST=1000000000
-export SPROMPT="Correct $fg[red]%R$reset_color to $fg[green]%r$reset_color? [ynae] "
+# shellcheck disable=SC2154
+export SPROMPT="Correct ${fg[red]}%R$reset_color to ${fg[green]}%r$reset_color? [ynae] "
export KEYTIMEOUT=5
# plugins {{{
-# cdhist {{{
-source ~/.config/sh/cdhist.sh
-# }}}
# zsh-syntax-highlighting {{{
+# shellcheck disable=SC2154,SC2034
+{
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets)
+# shellcheck source=zsh/.config/zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
+# shellcheck disable=SC1094
source ~/.config/zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
ZSH_HIGHLIGHT_STYLES[reserved-word]='fg=green'
ZSH_HIGHLIGHT_STYLES[alias]='fg=green'
@@ -67,9 +64,13 @@ ZSH_HIGHLIGHT_STYLES[globbing]='fg=magenta'
ZSH_HIGHLIGHT_STYLES[history-expansion]='none'
ZSH_HIGHLIGHT_STYLES[back-quoted-argument]='fg=green'
ZSH_HIGHLIGHT_STYLES[assign]='fg=cyan'
+}
# }}}
# zsh-autosuggestions {{{
+# shellcheck source=zsh/.config/zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
+# shellcheck disable=SC1094
source ~/.config/zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
+# shellcheck disable=SC2034
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=black,bold'
# see https://github.com/zsh-users/zsh-autosuggestions/issues/619
unset ZSH_AUTOSUGGEST_USE_ASYNC