diff --git a/README.org b/README.org index 868b9f3..596a707 100644 --- a/README.org +++ b/README.org @@ -8,6 +8,10 @@ - [[#maintainers][Maintainers]] - [[#prerequisites][Prerequisites]] - [[#applications][Applications]] +- [[#zsh][Zsh]] + - [[#theme][Theme]] + - [[#plugin-manager][Plugin Manager]] + - [[#plugins][Plugins]] - [[#configuration][Configuration]] - [[#installation][Installation]] - [[#find--delete-orphaned-symlinks][Find & delete orphaned symlinks]] @@ -38,14 +42,35 @@ A repository of my personal configuration files. - [[https://neomutt.org/][neomutt]] - [[https://neovim.io/][neovim]] - [[http://jonls.dk/redshift/][redshift]] -- [[https://github.com/denysdovhan/spaceship-prompt][spaceship zsh]] - [[https://github.com/baskerville/sxhkd][sxhkd]] - [[https://tmux.github.io/][tmux]] - [[https://vifm.info/][vifm]] - [[https://weechat.org/][weechat]] - [[https://github.com/freedesktop/xcompmgr][xcompmgr]] - [[https://github.com/stoeckmann/xwallpaper][xwallpaper]] -- [[https://www.zsh.org/][zsh]] + +* Zsh +** Theme +- [[https://github.com/denysdovhan/spaceship-prompt][spaceship zsh]] +** Plugin Manager +- [[https://github.com/zplug/zplug][zplug]] +** Plugins +- [[https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/archlinux][archlinux]] +- [[https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/composer][composer]] +- [[https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/docker][docker]] +- [[https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/docker-compose][docker-compose]] +- [[https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/extract][extract]] +- [[https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/git][git]] +- [[https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/gitignore][gitignore]] +- [[https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/pass][pass]] +- [[https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/ripgrep][ripgrep]] +- [[https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/rsync][rsync]] +- [[https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/sudo][sudo]] +- [[https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/systemd][systemd]] +- [[https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/tmux][tmux]] +- [[https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/vi-mode][vi-mode]] +- [[https://github.com/zsh-users/zsh-autosuggestions][zsh-autosuggestions]] +- [[https://github.com/zsh-users/zsh-syntax-highlighting][zsh-syntax-highlighting]] * Configuration ** Installation diff --git a/zsh/.zshenv b/zsh/.zshenv index fec3a35..c00a533 100644 --- a/zsh/.zshenv +++ b/zsh/.zshenv @@ -1,55 +1,16 @@ +path_if_exists() { + if [[ -d $1 ]]; then + export PATH="$1:$PATH" + fi +} + # Stop tmux bitching about 256 colours TERM="xterm-256color" -# Path to your oh-my-zsh installation. -ZSH="/home/alrayyes/.oh-my-zsh" - -# Set name of the theme to load. Optionally, if you set this to "random" -# it'll load a random theme each time that oh-my-zsh is loaded. -# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes -#ZSH_THEME="robbyrussell" -ZSH_THEME="spaceship" - -# Uncomment the following line to use case-sensitive completion. -# CASE_SENSITIVE="true" - -# Uncomment the following line to use hyphen-insensitive completion. Case -# sensitive completion must be off. _ and - will be interchangeable. -# HYPHEN_INSENSITIVE="true" - -# Uncomment the following line to disable bi-weekly auto-update checks. -# DISABLE_AUTO_UPDATE="true" - -# Uncomment the following line to change how often to auto-update (in days). -# export UPDATE_ZSH_DAYS=13 - -# Uncomment the following line to disable colors in ls. -# DISABLE_LS_COLORS="true" - -# Uncomment the following line to disable auto-setting terminal title. -# DISABLE_AUTO_TITLE="true" - -# Uncomment the following line to enable command auto-correction. -# ENABLE_CORRECTION="true" - -# Uncomment the following line to display red dots whilst waiting for completion. -# COMPLETION_WAITING_DOTS="true" - -# Uncomment the following line if you want to disable marking untracked files -# under VCS as dirty. This makes repository status check for large repositories -# much, much faster. -# DISABLE_UNTRACKED_FILES_DIRTY="true" - -# Uncomment the following line if you want to change the command execution time -# stamp shown in the history command output. -# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" -# HIST_STAMPS="mm/dd/yyyy" - -# Would you like to use another custom folder than $ZSH/custom? -# ZSH_CUSTOM=/path/to/new-custom-folder - # PATH -export PATH="$PATH:/home/alrayyes/.config/yarn/global/node_modules/.bin:/home/alrayyes/.local/bin:/home/alrayyes/.emacs.d/bin" +path_if_exists ~/.config/yarn/global/node_modules/.bin +path_if_exists ~/.local/bin +path_if_exists ~/.emacs.d/bin # Set GPG TTY export GPG_TTY="$(tty)" diff --git a/zsh/.zshrc b/zsh/.zshrc index b963e75..14dc7b9 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -1,13 +1,48 @@ -# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) -# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ -# Example format: plugins=(rails git textmate ruby lighthouse) -# Add wisely, as too many plugins slow down shell startup. -# -# fzf & sudo must start after vi-mode for it to work properly -# -plugins=(aws archlinux bower common-aliases composer docker extract git git-flow gitignore httpie pass rsync symfony2 systemd tmux vi-mode fzf sudo yarn zsh-syntax-highlighting ) +source_if_exists() { + if [[ -f $1 ]]; then + source $1 + fi +} -source $ZSH/oh-my-zsh.sh +# Check if zplug is installed +if [[ ! -d ~/.zplug ]]; then + git clone https://github.com/b4b4r07/zplug ~/.zplug +fi +source ~/.zplug/init.zsh + +# Spaceship theme +zplug "denysdovhan/spaceship-prompt", use:spaceship.zsh, from:github, as:theme + +# Oh my zsh lugins +# sudo must start after vi-mode for it to work properly +zplug "plugins/archlinux", from:oh-my-zsh +zplug "plugins/composer", from:oh-my-zsh +zplug "plugins/docker", from:oh-my-zsh +zplug "plugins/docker-compose", from:oh-my-zsh +zplug "plugins/extract", from:oh-my-zsh +zplug "plugins/git", from:oh-my-zsh +zplug "plugins/gitignore", from:oh-my-zsh +zplug "plugins/pass", from:oh-my-zsh +zplug "plugins/ripgrep", from:oh-my-zsh +zplug "plugins/rsync", from:oh-my-zsh +zplug "plugins/systemd", from:oh-my-zsh +zplug "plugins/tmux", from:oh-my-zsh +zplug "plugins/vi-mode", from:oh-my-zsh +zplug "plugins/sudo", from:oh-my-zsh +zplug "plugins/yarn", from:oh-my-zsh +zplug "zsh-users/zsh-autosuggestions", from:github, defer:3 +zplug "zsh-users/zsh-syntax-highlighting", from:github, defer:3 + +# Install packages +if ! zplug check --verbose; then + printf "Install zplug plugins? [y/N]: " + if read -q; then + echo + zplug install + fi +fi + +zplug load # vim alias alias vim="nvim" @@ -21,22 +56,27 @@ alias l="exa -al" alias vifm="vifmrun" # Use lf to switch directories and bind it to ctrl-o -lfcd () { - tmp="$(mktemp)" - lf -last-dir-path="$tmp" "$@" - if [ -f "$tmp" ]; then - dir="$(cat "$tmp")" - rm -f "$tmp" - [ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir" - fi +lfcd() { + tmp="$(mktemp)" + lf -last-dir-path="$tmp" "$@" + if [ -f "$tmp" ]; then + dir="$(cat "$tmp")" + rm -f "$tmp" + [ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir" + fi } bindkey -s '^o' 'lfcd\n' + # Set GPG TTY export GPG_TTY="$(tty)" + # Refresh gpg-agent tty in case user switches into an X session gpg-connect-agent updatestartuptty /bye >/dev/null -neofetch - +# Needed for broot source /home/alrayyes/.config/broot/launcher/bash/br + +source_if_exists /usr/share/fzf/key-bindings.zsh + +neofetch