Set up zsh stuff
This commit is contained in:
parent
26bc5c35e3
commit
2567417d14
17
configs/zsh/.zshrc
Normal file
17
configs/zsh/.zshrc
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
|
||||||
|
# There are some important env vars that need to exist
|
||||||
|
export ZSH="$HOME/.oh-my-zsh"
|
||||||
|
export EWCONFIG_ROOT="$HOME/.config/ewconfig"
|
||||||
|
|
||||||
|
# Load zsh-specific stuff
|
||||||
|
plugins=(zsh-autosuggestions)
|
||||||
|
source $ZSH/oh-my-zsh.sh
|
||||||
|
|
||||||
|
# Load my custom prompt and macros
|
||||||
|
. $EWCONFIG_ROOT/configs/zsh/prompt.sh
|
||||||
|
. $EWCONFIG_ROOT/configs/zsh/macros.sh
|
||||||
|
|
||||||
|
# Load per-host configuration
|
||||||
|
if [ -f $EWCONFIG_ROOT/configs/zsh/by_host/$HOSTNAME.sh ]; then
|
||||||
|
. $EWCONFIG_ROOT/configs/zsh/by_host/$HOSTNAME.sh
|
||||||
|
fi
|
1
configs/zsh/by_host/ewpratten-desktop.sh
Normal file
1
configs/zsh/by_host/ewpratten-desktop.sh
Normal file
@ -0,0 +1 @@
|
|||||||
|
#! /bin/bash
|
1
configs/zsh/by_host/ewpratten-laptop.sh
Normal file
1
configs/zsh/by_host/ewpratten-laptop.sh
Normal file
@ -0,0 +1 @@
|
|||||||
|
#! /bin/bash
|
40
configs/zsh/macros.sh
Normal file
40
configs/zsh/macros.sh
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
alias ls="ls --color=auto"
|
||||||
|
alias ll="ls -l"
|
||||||
|
alias la="ls -a"
|
||||||
|
alias :q="exit"
|
||||||
|
alias :wq="exit"
|
||||||
|
alias cls=clear
|
||||||
|
alias p4='ping 8.8.8.8 -c 4'
|
||||||
|
alias quickhttp='sudo python -m SimpleHTTPServer 443'
|
||||||
|
alias zshreload="source ~/.zshrc"
|
||||||
|
|
||||||
|
# Makes a directory, then moves into it
|
||||||
|
mkcd() {
|
||||||
|
if [ $# != 1 ]; then
|
||||||
|
echo "Usage: mkcd <dir>"
|
||||||
|
else
|
||||||
|
mkdir -p $1 && cd $1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Auto-extract anything
|
||||||
|
extract() {
|
||||||
|
if [ -f $1 ]; then
|
||||||
|
case $1 in
|
||||||
|
*.tar.bz2) tar xvjf $1 ;;
|
||||||
|
*.tar.gz) tar xvzf $1 ;;
|
||||||
|
*.bz2) bunzip2 $1 ;;
|
||||||
|
*.rar) unrar x $1 ;;
|
||||||
|
*.gz) gunzip $1 ;;
|
||||||
|
*.tar) tar xvf $1 ;;
|
||||||
|
*.tbz2) tar xvjf $1 ;;
|
||||||
|
*.tgz) tar xvzf $1 ;;
|
||||||
|
*.zip) unzip $1 ;;
|
||||||
|
*.Z) uncompress $1 ;;
|
||||||
|
*.7z) 7z x $1 ;;
|
||||||
|
*) echo "don't know how to extract '$1'..." ;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
echo "'$1' is not a valid file!"
|
||||||
|
fi
|
||||||
|
}
|
24
configs/zsh/prompt.sh
Normal file
24
configs/zsh/prompt.sh
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# This is some kind of dark magic.
|
||||||
|
# I have no memory of whats going on here, but this has been my config since 2015-ish, so it shall not be touched.
|
||||||
|
|
||||||
|
autoload -U colors && colors
|
||||||
|
NEWLINE=$'\n'
|
||||||
|
export PROMPT="%{$fg[green]%}%n@%M %{$fg[cyan]%}%~ $ %{$reset_color%}"
|
||||||
|
setopt prompt_subst
|
||||||
|
autoload -Uz vcs_info
|
||||||
|
zstyle ':vcs_info:*' actionformats \
|
||||||
|
'%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f '
|
||||||
|
zstyle ':vcs_info:*' formats \
|
||||||
|
'%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{5}]%f '
|
||||||
|
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r'
|
||||||
|
|
||||||
|
zstyle ':vcs_info:*' enable git cvs svn
|
||||||
|
|
||||||
|
# or use pre_cmd, see man zshcontrib
|
||||||
|
vcs_info_wrapper() {
|
||||||
|
vcs_info
|
||||||
|
if [ -n "$vcs_info_msg_0_" ]; then
|
||||||
|
echo "%{$fg[grey]%}${vcs_info_msg_0_}%{$reset_color%}$del"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
export RPROMPT=$'%@ $(vcs_info_wrapper) %?'
|
@ -6,9 +6,6 @@
|
|||||||
|
|
||||||
- link:
|
- link:
|
||||||
~/.gitconfig: configs/git/.gitconfig
|
~/.gitconfig: configs/git/.gitconfig
|
||||||
~/.ssh/config:
|
|
||||||
path: configs/ssh/config
|
|
||||||
force: true
|
|
||||||
|
|
||||||
- create:
|
- create:
|
||||||
- ~/Downloads
|
- ~/Downloads
|
||||||
|
Loading…
x
Reference in New Issue
Block a user