From b8efb08e00862c9264f69de8a0960c0e16f1c496 Mon Sep 17 00:00:00 2001 From: Ryan Kes Date: Mon, 17 Feb 2020 13:25:44 +0100 Subject: [PATCH] Added zsh --- README.org | 77 ++++++++++++++++++++++++++++++++++++++---------- zsh/.zprofile | 3 ++ zsh/.zshenv | 57 ++++++++++++++++++++++++++++++++++++ zsh/.zshrc | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 202 insertions(+), 16 deletions(-) create mode 100644 zsh/.zprofile create mode 100644 zsh/.zshenv create mode 100644 zsh/.zshrc diff --git a/README.org b/README.org index 5b0d6c2..52b9422 100644 --- a/README.org +++ b/README.org @@ -1,20 +1,65 @@ -* Legacy Dotfiles - :PROPERTIES: - :CUSTOM_ID: legacy-dotfiles - :END: +#+TITLE: Legacy Dotfiles +#+DATE: February 4, 2020 +#+SINCE: {replace with next tagged release version} +#+STARTUP: inlineimages nofold -Old dotfiles that I don't use anymore - - [[https://dwm.suckless.org/][dwm]] - - [[https://i3wm.org/][i3wm]] - - [[https://moc.daper.net/][moc]] - - [[https://www.newsbeuter.org/][newsbeuter]] - - [[https://github.com/davatorium/rofi][rofi]] - - [[https://www.spacemacs.org/][spacemacs]] +* Table of Contents :TOC_3:noexport: +- [[#description][Description]] + - [[#maintainers][Maintainers]] +- [[#prerequisites][Prerequisites]] +- [[#configured-applications][Configured Applications]] +- [[#zsh][Zsh]] + - [[#theme][Theme]] + - [[#plugin-manager][Plugin Manager]] + - [[#plugins][Plugins]] +- [[#license][License]] + +* Description +Legacy dotfiles that I don't use anymore + +** Maintainers ++ [[https://github.com/alrayyes][@alrayyes]] + +* Prerequisites +- [[http://www.gnu.org/software/stow/][stow]] +- [[https://www.python.org/][Python]] + +* Configured Applications +- [[https://dwm.suckless.org/][dwm]] +- [[https://i3wm.org/][i3wm]] +- [[https://moc.daper.net/][moc]] +- [[https://www.newsbeuter.org/][newsbeuter]] +- [[https://github.com/davatorium/rofi][rofi]] +- [[https://www.spacemacs.org/][spacemacs]] +- [[http://zsh.sourceforge.net/][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/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]] * License - :PROPERTIES: - :CUSTOM_ID: license - :END: - +:PROPERTIES: +:CUSTOM_ID: license +:END: This theme is released under the MIT License. For more information read -the [[LICENSE.org][license]]. +the [[file:LICENSE.org][license]]. diff --git a/zsh/.zprofile b/zsh/.zprofile new file mode 100644 index 0000000..3304d79 --- /dev/null +++ b/zsh/.zprofile @@ -0,0 +1,3 @@ +if [[ ! $DISPLAY && $XDG_VTNR -eq 1 ]]; then + exec startx +fi diff --git a/zsh/.zshenv b/zsh/.zshenv new file mode 100644 index 0000000..c00a533 --- /dev/null +++ b/zsh/.zshenv @@ -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)%}' diff --git a/zsh/.zshrc b/zsh/.zshrc new file mode 100644 index 0000000..ab63f2c --- /dev/null +++ b/zsh/.zshrc @@ -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 + +neofetch