1
0
mirror of https://github.com/alrayyes/dotfiles/ synced 2023-11-14 15:56:30 +00:00

Re added zsh

This commit is contained in:
Ryan Kes 2020-05-16 19:57:01 +02:00
parent 0732b6ad79
commit 919c440ef5
4 changed files with 170 additions and 0 deletions

View File

@ -26,6 +26,10 @@
- [[#ui][UI]]
- [[#npm][NPM]]
- [[#packages-1][Packages]]
- [[#zsh][Zsh]]
- [[#theme-2][Theme]]
- [[#plugin-manager-1][Plugin Manager]]
- [[#plugins-1][Plugins]]
- [[#configuration][Configuration]]
- [[#installation][Installation]]
- [[#find--delete-orphaned-symlinks][Find & delete orphaned symlinks]]
@ -154,6 +158,7 @@ A repository of my personal configuration files.
**** Navigation
- [[https://github.com/unblevable/quick-scope][unblevable/quick-scope]]
*** Programming
- [[https://github.com/airblade/vim-gitgutter][airblade/vim-gitgutter]]
- [[https://github.com/autozimu/LanguageClient-neovim][autozimu/LanguageClient-neovim]]
- [[https://github.com/godlygeek/tabular][godlygeek/tabular]]
- [[https://github.com/preservim/nerdcommenter][preservim/nerdcommenter]]
@ -175,6 +180,30 @@ A repository of my personal configuration files.
** Packages
- [[https://github.com/GoogleChrome/lighthouse][lighthouse]]
* 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/fzf][fzf]]
- [[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
#+BEGIN_SRC shell

3
zsh/.zprofile Normal file
View File

@ -0,0 +1,3 @@
if [[ ! $DISPLAY && $XDG_VTNR -eq 1 ]]; then
exec startx
fi

57
zsh/.zshenv Normal file
View File

@ -0,0 +1,57 @@
path_if_exists() {
if [[ -d $1 ]]; then
export PATH="$1:$PATH"
fi
}
# Stop tmux bitching about 256 colours
TERM="xterm-256color"
# PATH
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)"
# Set default browser
if [ -e "/usr/bin/brave" ]; then
export BROWSER="brave"
else
if [ -e "/usr/bin/firefox" ]; then
export BROWSER="firefox"
elif [ -e "/usr/bin/iceweasel" ]; then
export BROWSER="iceweasel"
fi
fi
# Set default terminal
export TERMINAL="alacritty"
# pkg editor
export VISUAL="nvim"
# editor
export EDITOR="nvim"
# Enable password store extensions
export PASSWORD_STORE_ENABLE_EXTENSIONS="true"
# This needs to be set for bspwm to see config
export XDG_CONFIG_HOME="$HOME/.config"
# Save history file in proper place
HISTFILE=~/.cache/zsh/history
# Use alternative muhome
export MU_HOME="/home/alrayyes/.cache/mu"
# Needed to get zsh to play nice with emacs vterm
if [[ "$INSIDE_EMACS" = 'vterm' ]]; then
alias clear='printf "\e]51;Evterm-clear-scrollback\e\\";tput clear'
fi
vterm_prompt_end() {
printf "\e]51;A$(whoami)@$(hostname):$(pwd)\e\\"
}
PROMPT=$PROMPT'%{$(vterm_prompt_end)%}'

81
zsh/.zshrc Normal file
View File

@ -0,0 +1,81 @@
source_if_exists() {
if [[ -f $1 ]]; then
source $1
fi
}
# 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/fzf", 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 v="nvim"
alias sv="sudo nvim"
# ls alias
alias ls="exa"
alias l="exa -al"
# vifm alias
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
}
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
# Needed for broot
source /home/alrayyes/.config/broot/launcher/bash/br
pfetch