mirror of https://github.com/nirenjan/dotfiles.git
Add Zsh config files
Prior to this change, I was using Bash as the default shell, but I have now started using Zsh, which has more features. This change adds the zshrc and related plugin files to source control and installs them along with the bashrc files. This also updates tmux to use zsh as the default shell and command.master
parent
a26638a886
commit
8f9698bf75
11
install
11
install
|
@ -227,3 +227,14 @@ then
|
|||
echo " source ~/.bashrc.common"
|
||||
fi
|
||||
|
||||
#######################################################################
|
||||
# Install zsh files
|
||||
#######################################################################
|
||||
lnfile zshrc ~/.zshrc
|
||||
mkfolder ~/.zshrc.d
|
||||
mkfolder ~/.zshrc.d/functions
|
||||
for plugin in zsh/*.zsh
|
||||
do
|
||||
lnfile $plugin ~/.zshrc.d/
|
||||
done
|
||||
|
||||
|
|
|
@ -23,9 +23,9 @@ set-option -g mouse on
|
|||
set-option -g history-limit 100000
|
||||
|
||||
# Default settings
|
||||
set-option -g default-command "/bin/bash"
|
||||
set-option -g default-command "/bin/zsh"
|
||||
#set-option -g default-path "~"
|
||||
set-option -g default-shell "/bin/bash"
|
||||
set-option -g default-shell "/bin/zsh"
|
||||
|
||||
# Display timeout
|
||||
set-option -g display-time 1500
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
#######################################################################
|
||||
# Aliases
|
||||
#######################################################################
|
||||
# Common aliases across systems
|
||||
# ls aliases
|
||||
alias ls='ls --color=auto'
|
||||
alias ll='ls -l'
|
||||
|
||||
# Git aliases
|
||||
alias tgp='time git pull'
|
||||
alias gf='git fetch'
|
||||
|
||||
# Tmux aliases
|
||||
# Attach to an existing tmux session
|
||||
alias work='TERM=screen-256color-bce tmux -2 -u attach -d'
|
||||
# Use this to launch in 256-color mode
|
||||
alias tmux='TERM=screen-256color-bce tmux -2 -u'
|
||||
# Trigger tmux to reopen the socket if it cannot attach
|
||||
alias kick='pkill -USR1 -u $USER tmux'
|
||||
|
||||
# Keep system specific aliases in a seperate file called .aliases
|
||||
# If .aliases exists it will envoked by the next line:
|
||||
if [[ -f $HOME/.aliases ]]
|
||||
then
|
||||
source $HOME/.aliases
|
||||
fi
|
|
@ -0,0 +1,7 @@
|
|||
#######################################################################
|
||||
# ZSH Completion
|
||||
#######################################################################
|
||||
zstyle :compinstall filename '/home/nkrishnan/.zshrc'
|
||||
|
||||
autoload -Uz compinit
|
||||
compinit
|
|
@ -0,0 +1,17 @@
|
|||
#######################################################################
|
||||
# Key Bindings
|
||||
#######################################################################
|
||||
# Use emacs bindings by default
|
||||
bindkey -e
|
||||
|
||||
#######################################################################
|
||||
# Default Editor and line editing
|
||||
#######################################################################
|
||||
export EDITOR=vim
|
||||
|
||||
# Emacs style bindings
|
||||
autoload -U edit-command-line
|
||||
zle -N edit-command-line
|
||||
bindkey '^xe' edit-command-line
|
||||
bindkey '^x^e' edit-command-line
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
gpgconf --launch gpg-agent
|
||||
|
||||
export SSH_AUTH_SOCK="$HOME/.gnupg/S.gpg-agent.ssh"
|
|
@ -0,0 +1,7 @@
|
|||
#######################################################################
|
||||
# History configuration
|
||||
#######################################################################
|
||||
HISTFILE=~/.histfile
|
||||
HISTSIZE=1000
|
||||
SAVEHIST=1000
|
||||
setopt appendhistory
|
|
@ -0,0 +1,59 @@
|
|||
# Add ls coloring
|
||||
# Don't bother setting LS_COLORS if it's alredy set
|
||||
if [[ -n "$LS_COLORS" ]]
|
||||
then
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ "`uname`" == *"Darwin"* ]]
|
||||
then
|
||||
# OS X uses BSD ls which is relatively restricted compared to
|
||||
# GNU ls as far as coloring options go. Stick to the basics here.
|
||||
# LSCOLORS is in pairs (fgcolor, bgcolor)
|
||||
|
||||
# Colorscheme for LSCOLORS (BSD)
|
||||
# a => black A => dark gray
|
||||
# b => red B => bold red
|
||||
# c => green C => bold green
|
||||
# d => brown D => yellow
|
||||
# e => blue E => bold blue
|
||||
# f => magenta F => bold magenta
|
||||
# g => cyan G => bold cyan
|
||||
# h => gray H => white
|
||||
# x => default
|
||||
|
||||
# Ordering for LSCOLORS(BSD)
|
||||
# 1. directory
|
||||
# 2. symbolic link
|
||||
# 3. socket
|
||||
# 4. pipe
|
||||
# 5. executable
|
||||
# 6. block device
|
||||
# 7. character device
|
||||
# 8. executable with setuid set
|
||||
# 9. executable with setguid set
|
||||
# 10. directory writable by others, with sticky bit
|
||||
# 11. directory writable by others, without sticky bit
|
||||
|
||||
export LSCOLORS="ExGxbxdxCxegedabagacad"
|
||||
|
||||
# Must use either CLICOLOR=1 or ls -G
|
||||
export CLICOLOR=1
|
||||
fi
|
||||
|
||||
DCFILE="$HOME/.dircolors"
|
||||
|
||||
# We can presume we are on a GNU system, or at the very least,
|
||||
# a system which has the GNU coreutils installed
|
||||
if [[ -f $DCFILE ]] && [[ -s $DCFILE ]]
|
||||
then
|
||||
if [[ ! -z `which dircolors` ]]
|
||||
then
|
||||
eval `dircolors $DCFILE`
|
||||
elif [[ ! -z `which gdircolors` ]]
|
||||
then
|
||||
# OS X with coreutils installed from MacPorts will have
|
||||
# dircolors installed by default as gdircolors.
|
||||
eval `gdircolors $DCFILE`
|
||||
fi
|
||||
fi
|
|
@ -0,0 +1,42 @@
|
|||
#######################################################################
|
||||
# Git prompt functionality
|
||||
#######################################################################
|
||||
# Define a default __git_ps1 in case we don't have git prompt functionality
|
||||
function __git_ps1
|
||||
{
|
||||
:
|
||||
}
|
||||
|
||||
# Import the Git prompt shell functions. These can be found
|
||||
# @github:git/git/contrib/completion/git_prompt.sh
|
||||
if [ -f $HOME/.git_prompt.sh ]; then
|
||||
source $HOME/.git_prompt.sh
|
||||
fi
|
||||
|
||||
# Prompt header function, prints user, hostname and current directory
|
||||
function prompt_header
|
||||
{
|
||||
# Build the prompt prefix
|
||||
local prefix
|
||||
# Add the current date in YYYY-MM-DD HH:MM:SS format (yellow color)
|
||||
prefix='%F{yellow}%D{%F %T}%f'
|
||||
# Add <user>@<hostname> (blue color)
|
||||
prefix="$prefix %F{blue}%n@%m%f"
|
||||
# Add current working directory (green color)
|
||||
# This replaces the smartwd functionality with zsh conditionals
|
||||
prefix="$prefix [%F{green}%(6~#%-3~/.../%2~#%~)%f]"
|
||||
# Add the status of the last command, but only if it failed
|
||||
prefix="$prefix %(?..%F{red}!! %? !!%f)"
|
||||
|
||||
# Configuration for __git_ps1
|
||||
GIT_PS1_SHOWCOLORHINTS=yes
|
||||
GIT_PS1_SHOWDIRTYSTATE=yes
|
||||
GIT_PS1_SHOWUNTRACKEDFILES=yes
|
||||
GIT_PS1_SHOWUPSTREAM=verbose
|
||||
__git_ps1 $'\n'$prefix$'\n' '%# ' '(%s)'
|
||||
}
|
||||
|
||||
if [[ ! -z $TERM && "$TERM" != "dumb" ]]
|
||||
then
|
||||
add-zsh-hook precmd 'prompt_header'
|
||||
fi
|
|
@ -0,0 +1,28 @@
|
|||
#######################################################################
|
||||
# Add path entries
|
||||
#######################################################################
|
||||
function add_to_path {
|
||||
if [[ ! ${path[(r)$1]} == $1 ]]
|
||||
then
|
||||
path=($1 $path)
|
||||
fi
|
||||
}
|
||||
|
||||
add_to_path $HOME/bin
|
||||
|
||||
#######################################################################
|
||||
# Plugins
|
||||
#######################################################################
|
||||
autoload -U add-zsh-hook
|
||||
fpath+="$HOME/.zshrc.d/functions"
|
||||
|
||||
setopt nullglob
|
||||
for plugin in $HOME/.zshrc.d/*.zsh
|
||||
do
|
||||
source $plugin
|
||||
done
|
||||
setopt nonullglob
|
||||
|
||||
|
||||
# Additional options
|
||||
setopt autocd extendedglob nomatch notify
|
Loading…
Reference in New Issue