summaryrefslogtreecommitdiff
path: root/zsh/.zsh
diff options
context:
space:
mode:
authorUrbain Vaes <urbain@vaes.uk>2018-01-10 17:31:15 +0100
committerUrbain Vaes <urbain@vaes.uk>2018-01-10 17:44:10 +0100
commit93a8f4479e0e61a153239dc15fe8b0e42979870c (patch)
treebad2b729654e0f216d5f52fab990c077a6c0e0be /zsh/.zsh
parentb63d5389cfca88ac1da44ebcff3139f420dd72f3 (diff)
Sort references by time
Diffstat (limited to 'zsh/.zsh')
-rw-r--r--zsh/.zsh/.zprofile3
-rw-r--r--zsh/.zsh/.zshenv11
-rw-r--r--zsh/.zsh/.zshrc111
-rw-r--r--zsh/.zsh/alias25
-rw-r--r--zsh/.zsh/functions40
-rw-r--r--zsh/.zsh/plugins39
6 files changed, 116 insertions, 113 deletions
diff --git a/zsh/.zsh/.zprofile b/zsh/.zsh/.zprofile
index 13942bb..38e7bb0 100644
--- a/zsh/.zsh/.zprofile
+++ b/zsh/.zsh/.zprofile
@@ -1,8 +1,5 @@
export EDITOR=vim
export HISTSIZE=1000000
-# We need to reset $PATH because /etc/profile is read after ~/.zshenv
-export PATH="$HOME/bin:$HOME/.guix-profile/bin:$HOME/bin:/usr/lib/surfraw${PATH:+:}$PATH"
-
# Start X automatically
[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx
diff --git a/zsh/.zsh/.zshenv b/zsh/.zsh/.zshenv
new file mode 100644
index 0000000..2cd7b6a
--- /dev/null
+++ b/zsh/.zsh/.zshenv
@@ -0,0 +1,11 @@
+export ZDOTDIR=$HOME/.zsh
+
+# Source guix & nix profiles
+guix_profile=$HOME/.guix-env
+nix_profile=$HOME/.nix-profile/etc/profile.d/nix.sh
+
+[[ -f $guix_profile ]] && . $guix_profile
+[[ -f $nix_profile ]] && . $nix_profile
+
+# Export pass without repetitions
+export -U PATH="/usr/local/sbin:/usr/local/bin:/usr/bin:$HOME/bin:$HOME/.gem/ruby/2.5.0/bin:/usr/lib/surfraw${PATH:+:}$PATH"
diff --git a/zsh/.zsh/.zshrc b/zsh/.zsh/.zshrc
index a5fdea8..95d0bb0 100644
--- a/zsh/.zsh/.zshrc
+++ b/zsh/.zsh/.zshrc
@@ -1,9 +1,42 @@
-# source /home/urbain/.nix-profile/etc/profile.d/nix.sh
+## zgen {{{
-# Source configuration files
-source "$HOME/.zsh/plugins"
-source "$HOME/.zsh/functions"
-source "$HOME/.zsh/alias"
+[ ! -d ~/.zsh/zgen ] && git clone https://github.com/tarjoilija/zgen.git ~/.zsh/zgen
+source "$HOME/.zsh/zgen/zgen.zsh"
+
+# Load plugins
+if ! zgen saved; then
+
+ echo "Creating a zgen save"
+
+ # Load oh-my-zsh framework
+ zgen oh-my-zsh
+
+ # Oh-my-zsh plugins
+ zgen oh-my-zsh plugins/git
+ zgen oh-my-zsh plugins/vi-mode
+
+ # Navigation plugins
+ zgen load urbainvaes/fzf-marks
+
+ # Other plugins
+ zgen load rupa/z
+
+ # zsh-users plugins
+ zgen load zsh-users/zsh-completions src
+ zgen load zsh-users/zsh-syntax-highlighting
+ zgen load zsh-users/zsh-autosuggestions
+
+ # Save all to init script
+ zgen save
+fi
+
+# Autosuggestion
+{
+ ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=6'
+ bindkey '^y' autosuggest-accept
+}
+
+# }}}
# Custom key bindings for built-in widgets
bindkey -a 'k' history-beginning-search-backward
@@ -13,11 +46,14 @@ bindkey '^N' history-beginning-search-forward
PROMPT='%0~ $ '
-[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
# Options
unsetopt histverify
+## fzf {{{
+
+[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
+
# Use fzf with z
unalias z 2> /dev/null
z() {
@@ -27,3 +63,66 @@ z() {
}
zle -N z
bindkey '^z' z
+
+# }}}
+## Colors {{{
+
+[[ -z ${ZSH_COLORS} ]] && ZSH_COLORS=${HOME}/.local/share/zsh/colors.zsh
+[[ -f ${ZSH_COLORS} ]] && source ${ZSH_COLORS}
+
+colorschemes=$(ls ${HOME}/.Xresources)
+
+function colo {
+
+ XRESOURCE=$1
+ XRESOURCE_FILE=${HOME}/.Xresources/${XRESOURCE}
+
+ # Change colors for current session
+ if [[ ! -z "$TMUX" ]]; then
+ printf '\x1bPtmux;'
+ esc='\x1b\x1b'
+ else
+ esc='\x1b'
+ fi
+
+ /usr/bin/cpp ${XRESOURCE_FILE} | tr -d ' \t' | sed -n \
+ -e "s/.*background:/${esc}]11;/p" \
+ -e "s/.*foreground:/${esc}]10;/p" \
+ -e "s/.*borderColor:/${esc}]708;/p" \
+ -e "s/.*color\\([0-9][^:]*\\):/${esc}]4;\\1;/p" | tr \\n \\a
+
+ # Change color for future sessions
+ xrdb ${XRESOURCE_FILE}
+}
+
+# Completion for colorschemes (-M -> Case insensitive)
+compctl -k "(${colorschemes})" -M 'm:{a-z}={A-Z}' colo
+
+# }}}
+## Aliases {{{
+
+# Commands
+alias cdd='cd ~/dotfiles'
+
+# Programs
+alias a='vifm . .'
+alias ff='FreeFem++'
+alias m='cd ~/.mutt/attachments && mutt && cd -'
+alias e='nvim'
+alias mux='tmuxinator'
+alias n='nvim'
+alias ns='nvim -S Session.vim'
+alias v='vim'
+alias vs="vim -S Session.vim"
+alias email="mbsync -a"
+
+# Git
+alias g='git'
+alias rd='cd $(git rev-parse --show-toplevel)'
+
+# GNU Make
+alias mi='make install'
+alias mc='make clean'
+alias mca='make clean-all'
+
+# }}}
diff --git a/zsh/.zsh/alias b/zsh/.zsh/alias
deleted file mode 100644
index 5f6a856..0000000
--- a/zsh/.zsh/alias
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/zsh
-
-# Commands
-alias cdd='cd ~/dotfiles'
-
-# Programs
-alias a='vifm . .'
-alias ff='FreeFem++'
-alias m='cd ~/.mutt/attachments && mutt && cd -'
-alias e='nvim'
-alias mux='tmuxinator'
-alias n='nvim'
-alias ns='nvim -S Session.vim'
-alias v='vim'
-alias vs="vim -S Session.vim"
-alias email="mbsync -a"
-
-# Git
-alias g='git'
-alias rd='cd $(git rev-parse --show-toplevel)'
-
-# GNU Make
-alias mi='make install'
-alias mc='make clean'
-alias mca='make clean-all'
diff --git a/zsh/.zsh/functions b/zsh/.zsh/functions
deleted file mode 100644
index c5bbb09..0000000
--- a/zsh/.zsh/functions
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/zsh
-
-[[ -z ${ZSH_COLORS} ]] && ZSH_COLORS=${HOME}/.local/share/zsh/colors.zsh
-[[ -f ${ZSH_COLORS} ]] && source ${ZSH_COLORS}
-
-colorschemes=$(ls ${HOME}/.Xresources)
-
-function colo {
-
- XRESOURCE=$1
- XRESOURCE_FILE=${HOME}/.Xresources/${XRESOURCE}
-
- # Change colors for current session
- if [[ ! -z "$TMUX" ]]; then
- printf '\x1bPtmux;'
- esc='\x1b\x1b'
- else
- esc='\x1b'
- fi
-
- /usr/bin/cpp ${XRESOURCE_FILE} | tr -d ' \t' | sed -n \
- -e "s/.*background:/${esc}]11;/p" \
- -e "s/.*foreground:/${esc}]10;/p" \
- -e "s/.*borderColor:/${esc}]708;/p" \
- -e "s/.*color\\([0-9][^:]*\\):/${esc}]4;\\1;/p" | tr \\n \\a
-
- # Change color for future sessions
- xrdb ${XRESOURCE_FILE}
-
- # Change default environment variable for future sessions
- mkdir -p $(dirname ${ZSH_COLORS})
-
- echo "export COLORSCHEME=${XRESOURCE%.*}" > ${ZSH_COLORS}
- echo "export BACKGROUND=${XRESOURCE#*.}" >> ${ZSH_COLORS}
- echo "export XRESOURCE=${XRESOURCE}" >> ${ZSH_COLORS}
- source ${ZSH_COLORS}
-}
-
-# Completion for colorschemes (-M -> Case insensitive)
-compctl -k "(${colorschemes})" -M 'm:{a-z}={A-Z}' colo
diff --git a/zsh/.zsh/plugins b/zsh/.zsh/plugins
deleted file mode 100644
index 649f00d..0000000
--- a/zsh/.zsh/plugins
+++ /dev/null
@@ -1,39 +0,0 @@
-#! /bin/zsh
-
-# Load zgen
-[ ! -d ~/.zsh/zgen ] && git clone https://github.com/tarjoilija/zgen.git ~/.zsh/zgen
-source "$HOME/.zsh/zgen/zgen.zsh"
-
-# Load plugins
-if ! zgen saved; then
-
- echo "Creating a zgen save"
-
- # Load oh-my-zsh framework
- zgen oh-my-zsh
-
- # Oh-my-zsh plugins
- zgen oh-my-zsh plugins/git
- zgen oh-my-zsh plugins/vi-mode
-
- # Navigation plugins
- zgen load urbainvaes/fzf-marks
-
- # Other plugins
- zgen load rupa/z
- zgen load djui/alias-tips
-
- # zsh-users plugins
- zgen load zsh-users/zsh-completions src
- zgen load zsh-users/zsh-syntax-highlighting
- zgen load zsh-users/zsh-autosuggestions
-
- # Save all to init script
- zgen save
-fi
-
-# Autosuggestion
-{
- ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=6'
- bindkey '^y' autosuggest-accept
-}