diff --git a/shell/.gitignore b/shell/.gitignore new file mode 100644 index 0000000..dea2d4f --- /dev/null +++ b/shell/.gitignore @@ -0,0 +1 @@ +.zcompdump diff --git a/shell/.zshrc b/shell/.zshrc new file mode 100644 index 0000000..2d1ba30 --- /dev/null +++ b/shell/.zshrc @@ -0,0 +1,54 @@ +if [ -d ~/.config/shell/profile.d ] ; then + for p in ~/.config/shell/profile.d/*.sh; do + [ -f "$p" ] && . "$p" + done + unset p +fi + +HISTSIZE= +SAVEHIST= +HISTFILE="$XDG_STATE_HOME/shell/zsh_history" + +case $- in + *i*) ;; + *) return;; +esac + +autoload -U compinit +zstyle ':completion:*' menu select +zmodload zsh/complist +compinit +_comp_options+=(globdots) + +autoload -U colors && colors +setopt autocd +stty stop undef +setopt interactive_comments +setopt inc_append_history +bindkey -v +export KEYTIMEOUT=1 + +if [ -n "$HISTFILE" ] && ! [ -d "${HISTFILE%/*}" ] ; then + mkdir -p "${HISTFILE%/*}" && touch "$HISTFILE" +fi + +_prompt_git_branch() { + GIT_BRANCH="$(git branch 2>/dev/null | sed '/\*/!d;s/^\*\s*//g;s/\s*$//g')" + [ -n "$GIT_BRANCH" ] && printf '%s ' "$GIT_BRANCH" +} + +precmd() { + psvar[1]=$(_prompt_git_branch) +} + +PS1=$'\e[0;2m%T\e[0m \e[0;34m%~\e[0m \e[0;35;1m%1v\e[0m%(?.%F{green}.%F{red})>\e[0m ' + +if [ -f ~/.config/shell/aliases.sh ] ; then + . ~/.config/shell/aliases.sh +fi + +if [ -f ~/.config/shell/gui.sh ] ; then + . ~/.config/shell/gui.sh +fi + +source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.plugin.zsh 2>/dev/null diff --git a/shell/aliases.sh b/shell/aliases.sh index 8e48fd4..4c9f0a4 100644 --- a/shell/aliases.sh +++ b/shell/aliases.sh @@ -35,6 +35,7 @@ command -v eza >/dev/null 2>&1 && command -v trash >/dev/null 2>&1 && alias rm="trash" alias \ + cal="calcurse" \ fzf="fzf --cycle --reverse" \ diff="diff --color=auto" \ grep="grep --color=auto" \ @@ -48,4 +49,5 @@ alias \ clip="xsel -ib" \ em="emacsclient -c -a 'emacs' $@" \ wget="wget --hsts-file=$XDG_DATA_HOME/wget/wget-hsts" \ - ssh="ssh ${SSH_CONFIG}" + ssh="ssh ${SSH_CONFIG}" \ + lg="lazygit" diff --git a/shell/bashrc b/shell/bashrc index 2a13a98..7128979 100644 --- a/shell/bashrc +++ b/shell/bashrc @@ -1,12 +1,18 @@ #!/bin/bash -if test -d ~/.config/shell/profile.d/; then - for profile in ~/.config/shell/profile.d/*.sh; do - test -r "$profile" && . "$profile" +if [ -d ~/.config/shell/profile.d ] ; then + for p in ~/.config/shell/profile.d/*.sh; do + [ -f "$p" ] && . "$p" done - unset profile + unset p fi +BASH_ENV="$XDG_CONFIG_HOME/shell/bashrc" +HISTFILE="$XDG_STATE_HOME/shell/bash_history" +HISTCONTROL=ignoreboth +HISTIZE= +HISTFILESIZE= + case $- in *i*) ;; *) return;; diff --git a/shell/profile.d/config.sh b/shell/profile.d/config.sh index b80ce24..de1cd7b 100644 --- a/shell/profile.d/config.sh +++ b/shell/profile.d/config.sh @@ -1,8 +1,3 @@ -export \ - HISTCONTROL=ignoreboth \ - HISTIZE= \ - HISTFILESIZE= - export \ QT_QPA_PLATFORMTHEME="qt5ct" \ CM_SELECTIONS="clipboard" \ diff --git a/shell/profile.d/unix-shell-script-kit b/shell/profile.d/unix-shell-script-kit.sh similarity index 100% rename from shell/profile.d/unix-shell-script-kit rename to shell/profile.d/unix-shell-script-kit.sh diff --git a/shell/profile.d/xdgspec.sh b/shell/profile.d/xdgspec.sh index e9943d6..5c3ed14 100644 --- a/shell/profile.d/xdgspec.sh +++ b/shell/profile.d/xdgspec.sh @@ -5,7 +5,6 @@ export \ XDG_CONFIG_HOME="$HOME/.config" export \ - BASH_ENV="$XDG_CONFIG_HOME/shell/bashrc" \ _JAVA_OPTIONS=-Djava.util.prefs.userRoot="$XDG_CONFIG_HOME/java" \ MATHEMATICA_USERBASE="$XDG_CONFIG_HOME/mathematica" \ XCURSOR_PATH=/usr/share/icons:$XDG_DATA_HOME/icons \ @@ -18,7 +17,6 @@ export \ XSERVERRC="$XDG_CONFIG_HOME/X11/xserverrc" \ MBSYNCRC="$XDG_CONFIG_HOME/isync/mbsyncrc" \ XAUTHORITY="$XDG_RUNTIME_DIR/Xauthority" \ - HISTFILE="$XDG_STATE_HOME/shell/bash_history" \ XINITRC="$XDG_CONFIG_HOME/X11/xinitrc" \ LESSHISTFILE="$XDG_DATA_HOME/lesshst" \ ELECTRUMDIR="$XDG_DATA_HOME/electrum" \ @@ -28,4 +26,5 @@ export \ GNUPGHOME="$XDG_DATA_HOME/gnupg" \ GOPATH="$XDG_DATA_HOME/go" \ SSH_CONFIG="-F ${XDG_CONFIG_HOME}/ssh/config" \ - GIT_SSH_COMMAND="ssh -F ${XDG_CONFIG_HOME}/ssh/config" + GIT_SSH_COMMAND="ssh -F ${XDG_CONFIG_HOME}/ssh/config" \ + ZDOTDIR="$XDG_CONFIG_HOME/shell"