diff --git a/install.sh b/install.sh index 827e426..eb4d61a 100755 --- a/install.sh +++ b/install.sh @@ -6,7 +6,7 @@ confirm () { # call with a prompt string or use a default read -r -p "${1:-Are you sure? [y/N]} " response case $response in - [yY][eE][sS]|[yY]) + [yY][eE][sS]|[yY]) true ;; *) @@ -41,18 +41,14 @@ echo "Installing vim." confirmAndLink $DIR/vim/vimrc $HOME/.vimrc confirmAndLink $DIR/vim $HOME/.vim -which zsh + +# Install zsh, if relevant. if which zsh then echo "Installing zsh" - - if [ ! -e $HOME/.oh-my-zsh ] - then - curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh - rm $HOME/.zshrc - else - confirmAndLink $DIR/zshrc $HOME/.zshrc - fi - - echo "Installation finished." + + confirmAndLink $DIR/zshrc $HOME/.zshrc + fi + +echo "Installation finished." diff --git a/zshrc b/zshrc index 9db1f38..46ead56 100644 --- a/zshrc +++ b/zshrc @@ -1,25 +1,66 @@ -# Path to your oh-my-zsh installation. -export ZSH=~/.oh-my-zsh -export EDITOR=vim - -ZSH_THEME="clean" - -plugins=(git git-extras composer common-aliases colorize svn tmux ubuntu sudo command-not-found python last-working-dir jsontools bower) - -# User configuration -ZSH_TMUX_AUTOSTART=true - -export PATH="/vol/share/software/gcc/4.8.2/bin:/vol/share/software/texlive/2013/bin/x86_64-linux:${HOME}/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games" - -source $ZSH/oh-my-zsh.sh - -# If I mean interactive, I will tell you. -unalias rm - -# Several aliases +# zshrc aliases +alias ls='ls --color=auto' +alias ll='ls -lh' +alias grep='grep --color=auto' alias gvim='gvim --remote-tab' if (( $+commands[thefuck] )) then alias fuck='$(thefuck $(fc -ln -1))' fi + +export EDITOR=$(which vim) + +# Initialize the prompt +autoload -U promptinit +promptinit +prompt bart + +# No dupes in history +setopt HIST_IGNORE_DUPS + +# Setup the CNF hook +source /usr/share/doc/pkgfile/command-not-found.zsh + +# History search +autoload -U history-search-end +bindkey -v + +zle -N history-beginning-search-backward-end history-search-end +zle -N history-beginning-search-forward-end history-search-end +zle -N history-incremental-search-backward-end history-search-end + +bindkey "\e[A" history-beginning-search-backward-end +bindkey "\e[B" history-beginning-search-forward-end +bindkey '^R' history-incremental-search-backward-end + +# Home and end keys working +bindkey "${terminfo[khome]}" beginning-of-line +bindkey "${terminfo[kend]}" end-of-line + +# Transfer.sh plugin +transfer() { if [ $# -eq 0 ]; then echo "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"; return 1; fi +tmpfile=$( mktemp -t transferXXX ); if tty -s; then basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g'); curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile; else curl --progress-bar --upload-file "-" "https://transfer.sh/$1" >> $tmpfile ; fi; cat $tmpfile; rm -f $tmpfile; }; alias transfer=transfer + +# The following lines were added by compinstall + +zstyle ':completion:*' completer _expand _complete _ignored _correct _approximate +zstyle ':completion:*' list-colors '' +zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s +zstyle ':completion:*' matcher-list '' 'm:{[:lower:]}={[:upper:]}' 'r:|[._-]=* r:|=*' 'm:{[:lower:][:upper:]}={[:upper:][:lower:]} l:|=* r:|=*' +zstyle ':completion:*' menu select=0 +zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s +zstyle ':completion:*' use-compctl true +zstyle ':completion:*' verbose true +zstyle :compinstall filename '/home/bert/.zshrc' + +autoload -Uz compinit +compinit +# End of lines added by compinstall +# Lines configured by zsh-newuser-install +HISTFILE=~/.histfile +HISTSIZE=1000 +SAVEHIST=1000 +setopt autocd notify +bindkey -v +# End of lines configured by zsh-newuser-install