diff --git a/bash/ansi b/bash/ansi index 8ed3e2c..4de8bd5 100644 --- a/bash/ansi +++ b/bash/ansi @@ -22,4 +22,4 @@ set_color() { [[ $prompt -eq 1 ]] && echo -n "\]" } -# vim: ft=sh +# vim: ft=bash diff --git a/bash/ansi3 b/bash/ansi3 index e230b1e..9700c28 100644 --- a/bash/ansi3 +++ b/bash/ansi3 @@ -120,4 +120,4 @@ ansi_sgr() { eval "echo -n \$ANSI_SGR_INDEX__${key}__" } -# vim: ft=sh +# vim: ft=bash diff --git a/bash/ansi4 b/bash/ansi4 index 75de5d9..616c1ca 100644 --- a/bash/ansi4 +++ b/bash/ansi4 @@ -89,4 +89,4 @@ ansi_sgr() { echo -n ${ANSI_SGR_INDEX[$1]} } -# vim: ft=sh +# vim: ft=bash diff --git a/bash/ext b/bash/ext index 3e0cf15..abce399 100644 --- a/bash/ext +++ b/bash/ext @@ -54,3 +54,4 @@ clear_incomplete_line() { fi } +# vim: ft=bash diff --git a/bash/fzf b/bash/fzf index 07b683e..1ae9162 100644 --- a/bash/fzf +++ b/bash/fzf @@ -1,6 +1,3 @@ -# shellcheck shell=bash -# vim: ft=sh - if type fzf 1>/dev/null 2>/dev/null; then __fzf_select__() { @@ -58,3 +55,5 @@ bind '"\C-r": " \C-e\C-u`__fzf_history__`\e\C-e\e^\er"' bind '"\ec": " \C-e\C-u`__fzf_cd__`\e\C-e\er\C-m"' fi + +# vim: ft=bash diff --git a/bash/history b/bash/history index 69664d3..425f97f 100644 --- a/bash/history +++ b/bash/history @@ -13,4 +13,4 @@ export HISTCONTROL=ignoreboth # more! export HISTSIZE=10000 -# vim: ft=sh +# vim: ft=bash diff --git a/bash/profile b/bash/profile index 593eab8..91e351e 100644 --- a/bash/profile +++ b/bash/profile @@ -6,4 +6,4 @@ source ~/.profile # include bashrc too if this is an interactive shell [[ $- == *i* ]] && source ~/.bashrc -# vim: ft=sh +# vim: ft=bash diff --git a/bash/prompt b/bash/prompt index a2ae857..3d45553 100644 --- a/bash/prompt +++ b/bash/prompt @@ -108,4 +108,4 @@ set_prompt() { PS1="$(prompt_build_simple)" } -# vim: ft=sh +# vim: ft=bash diff --git a/bash/prompt_segments b/bash/prompt_segments index 04830f4..8c288fa 100644 --- a/bash/prompt_segments +++ b/bash/prompt_segments @@ -66,4 +66,4 @@ prompt_end() { CURRENT_BG='' } -# vim: ft=sh: +# vim: ft=bash diff --git a/bash/rc b/bash/rc index 7559607..3e80c11 100644 --- a/bash/rc +++ b/bash/rc @@ -45,4 +45,4 @@ set bell-style none # disable deprecation warning export BASH_SILENCE_DEPRECATION_WARNING=1 -# vim: ft=sh +# vim: ft=bash diff --git a/bash/term_title b/bash/term_title index 554e63f..443c915 100644 --- a/bash/term_title +++ b/bash/term_title @@ -15,7 +15,7 @@ fi set_term_title() { case $TERM in - xterm*|rxvt*) + xterm*|rxvt*|alacritty) local title="\033]2;$USER@${HOSTNAME%%.*}:${PWD/#$HOME/~}\a" ;; *) @@ -25,4 +25,4 @@ set_term_title() { printf "$title" } -# vim: ft=sh +# vim: ft=bash diff --git a/shell/aliases b/shell/aliases index 99a1a93..79cbe0c 100644 --- a/shell/aliases +++ b/shell/aliases @@ -11,4 +11,8 @@ esac alias ll="ls -l" alias tree="tree -C" -which colordiff 2>&1 >/dev/null && alias diff="colordiff" +if command -v colordiff 2>&1 >/dev/null; then + alias diff="colordiff" +fi + +# vim: ft=bash diff --git a/shell/android b/shell/android deleted file mode 100644 index 2333ac0..0000000 --- a/shell/android +++ /dev/null @@ -1 +0,0 @@ -export ANDROID_HOME=/usr/local/opt/android-sdk diff --git a/shell/arch b/shell/arch index 401c13a..58b0c4e 100644 --- a/shell/arch +++ b/shell/arch @@ -1 +1,5 @@ -source $HOME/.archrc +if test -f $HOME/.archrc; then + source $HOME/.archrc +fi + +# vim: ft=bash diff --git a/shell/autoload b/shell/autoload index b9d8fc3..05a2b9b 100644 --- a/shell/autoload +++ b/shell/autoload @@ -3,4 +3,4 @@ for file in "$DOTFILES_SHELL_DIR"/*; do [[ -x $file ]] && source "$file" done -# vim: ft=sh +# vim: ft=bash diff --git a/shell/bundler b/shell/bundler index 1fa8641..76baa07 100644 --- a/shell/bundler +++ b/shell/bundler @@ -3,7 +3,7 @@ bundled_commands=(annotate cap capify cucumber guard heroku nanoc rackup rainbows rails rake rspec rubocop ruby shotgun spec spork thin unicorn unicorn_rails irb pry) _bundler-installed() { - which bundle > /dev/null 2>&1 + command -v bundle > /dev/null 2>&1 } _within-bundled-project() { @@ -36,4 +36,4 @@ for cmd in ${bundled_commands[@]}; do fi done -# vim: ft=zsh +# vim: ft=bash diff --git a/shell/ccache b/shell/ccache index 3e2d7be..6eb84eb 100755 --- a/shell/ccache +++ b/shell/ccache @@ -1,2 +1,4 @@ export USE_CCACHE=1 export CCACHE_DIR=$HOME/.local/var/ccache + +# vim: ft=bash diff --git a/shell/chruby b/shell/chruby index 2d847ff..8199260 100755 --- a/shell/chruby +++ b/shell/chruby @@ -39,3 +39,5 @@ _auto-chruby() { chruby "${ruby_version}" fi } + +# vim: ft=bash diff --git a/shell/colors b/shell/colors index ce1addb..12277b2 100755 --- a/shell/colors +++ b/shell/colors @@ -6,3 +6,5 @@ export CLICOLOR # gnome terminal knows colors [[ "$COLORTERM" == "gnome-terminal" ]] && export TERM=xterm-256color [[ "$COLORTERM" == "xfce4-terminal" ]] && export TERM=xterm-256color + +# vim: ft=bash diff --git a/shell/docker b/shell/docker index 35e0a3f..0c9e333 100755 --- a/shell/docker +++ b/shell/docker @@ -4,3 +4,5 @@ #export DOCKER_HOST="tcp://172.16.71.132:2376" #export DOCKER_CERT_PATH="/Users/lloeki/.docker/machine/machines/default" #export DOCKER_MACHINE_NAME="default" + +# vim: ft=bash diff --git a/shell/editor b/shell/editor index a12f1b8..2cd6c15 100755 --- a/shell/editor +++ b/shell/editor @@ -1,5 +1,6 @@ - # default editor EDITOR=vim VISUAL=vim export EDITOR VISUAL + +# vim: ft=bash diff --git a/shell/fzf b/shell/fzf index 0791562..a99b5a2 100755 --- a/shell/fzf +++ b/shell/fzf @@ -1,2 +1,6 @@ -export FZF_DEFAULT_COMMAND='rg --files --no-ignore --hidden --follow --glob "!{.git,node_modules}/*"' -export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" +if command -v rg 2>&1 >/dev/null; then + export FZF_DEFAULT_COMMAND='rg --files --no-ignore --hidden --follow --glob "!{.git,node_modules}/*"' + export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" +fi + +# vim: ft=bash diff --git a/shell/git_prompt_info b/shell/git_prompt_info index 0786afd..0b65937 100644 --- a/shell/git_prompt_info +++ b/shell/git_prompt_info @@ -185,4 +185,4 @@ __git_ps1_vars() { GIT_PS1_PREFIX="$prefix" } -# vim: ft=sh +# vim: ft=bash diff --git a/shell/go b/shell/go index 824a0f2..19af642 100644 --- a/shell/go +++ b/shell/go @@ -1,5 +1,5 @@ _go-installed() { - which go > /dev/null 2>&1 + command -v go > /dev/null 2>&1 } _within-go-project() { @@ -75,4 +75,4 @@ _link-go-package() { ln -sf "$PWD" "$src/$pkgn" } -# vim: ft=sh +# vim: ft=bash diff --git a/shell/go-devtools b/shell/go-devtools index fe17823..300b9cd 100755 --- a/shell/go-devtools +++ b/shell/go-devtools @@ -1 +1,3 @@ export PATH="$HOME/.local/libexec/go/bin:$PATH" + +# vim: ft=bash diff --git a/shell/homebrew b/shell/homebrew index 00d60cd..19d3f1d 100755 --- a/shell/homebrew +++ b/shell/homebrew @@ -1,8 +1,12 @@ -# go -PATH=$PATH:/usr/local/opt/go/libexec/bin +if command -v brew 2>&1 >/dev/null; then + # go + PATH=$PATH:/usr/local/opt/go/libexec/bin -HOMEBREW_NO_EMOJI="you bet" -HOMEBREW_NO_AUTO_UPDATE="1" + HOMEBREW_NO_EMOJI="you bet" + HOMEBREW_NO_AUTO_UPDATE="1" -export HOMEBREW_NO_AUTO_UPDATE -export HOMEBREW_NO_EMOJI + export HOMEBREW_NO_AUTO_UPDATE + export HOMEBREW_NO_EMOJI +fi + +# vim: ft=bash diff --git a/shell/kd b/shell/kd index a6e67a3..dfc398d 100755 --- a/shell/kd +++ b/shell/kd @@ -1,7 +1,7 @@ -# vim: ft=sh +# vim: ft=bash # shellcheck shell=bash -# worKDir +# worKDir or quicKDir function kd() { local conf="$HOME/.kdrc" if [[ $# -eq 0 ]]; then diff --git a/shell/limits b/shell/limits index 0fb5983..d62ecfb 100755 --- a/shell/limits +++ b/shell/limits @@ -1 +1,5 @@ ulimit -S -n 1024 + +# vim: ft=bash + + diff --git a/shell/nix b/shell/nix index 0f921c6..d5f8142 100755 --- a/shell/nix +++ b/shell/nix @@ -1,5 +1,9 @@ -if [ -e /Users/lloeki/.nix-profile/etc/profile.d/nix.sh ]; then . /Users/lloeki/.nix-profile/etc/profile.d/nix.sh; fi +if [[ -e /Users/lloeki/.nix-profile/etc/profile.d/nix.sh ]]; then + . /Users/lloeki/.nix-profile/etc/profile.d/nix.sh +fi #if [[ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]]; then # . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' #fi + +# vim: ft=bash diff --git a/shell/notes b/shell/notes index e350f0d..81aebed 100755 --- a/shell/notes +++ b/shell/notes @@ -14,5 +14,4 @@ function note() { ) } -# vim: ft=zsh - +# vim: ft=bash diff --git a/shell/prompt_segments b/shell/prompt_segments index d170c6a..7daaac1 100644 --- a/shell/prompt_segments +++ b/shell/prompt_segments @@ -49,4 +49,4 @@ prompt_subsegment() { [[ -n $1 ]] && print -Pn $1 } -# vim: ft=sh: +# vim: ft=bash diff --git a/shell/prompt_utils b/shell/prompt_utils index 4619c6c..ed984f3 100644 --- a/shell/prompt_utils +++ b/shell/prompt_utils @@ -39,3 +39,5 @@ __truncate_path() { __tpwd() { __truncate_path "$PWD" } + +# vim: ft=bash diff --git a/shell/prompt_vcs b/shell/prompt_vcs index 18440da..6a7e947 100644 --- a/shell/prompt_vcs +++ b/shell/prompt_vcs @@ -66,4 +66,4 @@ prompt_vcs_action() { fi } -# vim: ft=sh: +# vim: ft=bash diff --git a/shell/pyenv b/shell/pyenv index f4531ae..6b232d7 100755 --- a/shell/pyenv +++ b/shell/pyenv @@ -1,4 +1,10 @@ # pyenv -test -d "$HOME/.pyenv/bin" && PATH="$HOME/.pyenv/bin:$PATH" -which pyenv 2>&1 >/dev/null && eval "$(pyenv init -)" +if test -d "$HOME/.pyenv/bin"; then + PATH="$HOME/.pyenv/bin:$PATH" +fi +if command -v pyenv 2>&1 >/dev/null; then + eval "$(pyenv init -)" +fi export PATH + +# vim: ft=bash diff --git a/shell/rbenv b/shell/rbenv index 5c32ed7..a55697d 100755 --- a/shell/rbenv +++ b/shell/rbenv @@ -1,6 +1,3 @@ -# vim: ft=sh -# shellcheck shell=bash - test -d "/opt/rbenv" && RBENV_ROOT="/opt/rbenv" test -d "$HOME/.rbenv" && RBENV_ROOT="$HOME/.rbenv" export RBENV_ROOT @@ -15,3 +12,5 @@ if _has-rbenv; then eval "$(rbenv init -)" export PATH fi + +# vim: ft=bash diff --git a/shell/ruby b/shell/ruby index 1fef836..1917c73 100755 --- a/shell/ruby +++ b/shell/ruby @@ -1,6 +1,3 @@ -# vim: ft=sh -# shellcheck shell=bash - _gem_home() { GEM_HOME="${HOME}/.gem/ruby/system" export GEM_HOME @@ -25,3 +22,5 @@ _auto-rubygems_gemdeps() { done unset RUBYGEMS_GEMDEPS } + +# vim: ft=bash diff --git a/shell/ssh b/shell/ssh old mode 100644 new mode 100755 index 99735d2..d65387f --- a/shell/ssh +++ b/shell/ssh @@ -1,6 +1,11 @@ -# ssh keychain, if no agent set -if [ -z "$SSH_AUTH_SOCK" ]; then - if which envoy 2>&1 >/dev/null; then - source <(envoy -p) +# start ssh agent, if no agent set +if [[ -n "${XDG_RUNTIME_DIR}" && -z "${SSH_AUTH_SOCK}" ]]; then + if ! pgrep -u "$USER" ssh-agent > /dev/null; then + ssh-agent -t 1h > "${XDG_RUNTIME_DIR}/ssh-agent.env" + fi + if [[ ! -S "${SSH_AUTH_SOCK}" ]] && [[ -f "${XDG_RUNTIME_DIR}/ssh-agent.env" ]]; then + source "${XDG_RUNTIME_DIR}/ssh-agent.env" > /dev/null fi fi + +# vim: ft=bash diff --git a/shell/ssl b/shell/ssl index c503b88..2d92de5 100755 --- a/shell/ssl +++ b/shell/ssl @@ -1,2 +1,5 @@ -[ -f /usr/local/share/ca-bundle.crt ] \ -&& export SSL_CERT_FILE=/usr/local/share/ca-bundle.crt +if [[ -f /usr/local/share/ca-bundle.crt ]]; then + export SSL_CERT_FILE=/usr/local/share/ca-bundle.crt +fi + +# vim: ft=bash diff --git a/shell/user b/shell/user index ee251f6..d234485 100755 --- a/shell/user +++ b/shell/user @@ -1,3 +1,5 @@ # user path PATH=~/.local/bin:$PATH export PATH + +# vim: ft=bash diff --git a/zsh/fzf b/zsh/fzf index 5e6b1dc..4bbefb5 100644 --- a/zsh/fzf +++ b/zsh/fzf @@ -78,3 +78,5 @@ bindkey '^R' fzf-history-widget fi fi + +# vim: ft=zsh diff --git a/zsh/prompt_segments b/zsh/prompt_segments index dea87f3..8420065 100644 --- a/zsh/prompt_segments +++ b/zsh/prompt_segments @@ -64,3 +64,4 @@ rprompt_end() { CURRENT_BG='' } +# vim: ft=zsh diff --git a/zsh/vi b/zsh/vi index 38ae8ce..0f034dd 100644 --- a/zsh/vi +++ b/zsh/vi @@ -5,3 +5,5 @@ KEYTIMEOUT=1 bindkey -sM vicmd '^[' '^G' # fix ^X shortcuts bindkey -rM viins '^X' + +# vim: ft=zsh