diff --git a/.oh-my-zsh/custom/aliases.zsh b/.oh-my-zsh/custom/aliases.zsh index 6e2ab3e..5d6564b 100644 --- a/.oh-my-zsh/custom/aliases.zsh +++ b/.oh-my-zsh/custom/aliases.zsh @@ -24,3 +24,13 @@ cls() { cd "$1"; ls;} #cd into directory and list contents md5check() { md5sum "$1" | grep "$2";} #md5sum file, compare to md5sum as second parameter #ssh aliases alias ssh-agent="eval `ssh-agent -s`" + +#Command Replacement aliases +alias less='less -imJMW' + +#Navigation aliases +alias ..='cd ..' +alias ...='cd ../..' +alias ....='cd ../../..' +alias .....='cd ../../../..' + diff --git a/.oh-my-zsh/custom/plugins/ff.zsh b/.oh-my-zsh/custom/plugins/ff.zsh new file mode 100644 index 0000000..583d43a --- /dev/null +++ b/.oh-my-zsh/custom/plugins/ff.zsh @@ -0,0 +1,4 @@ +# Find a file with a pattern in name: +#-------------------------------------------------------------------- +function ff() { find . -type f -iname '*'"$*"'*' -ls ; } + diff --git a/.oh-my-zsh/custom/plugins/nicemount.plugin.zsh b/.oh-my-zsh/custom/plugins/nicemount.plugin.zsh new file mode 100644 index 0000000..810711b --- /dev/null +++ b/.oh-my-zsh/custom/plugins/nicemount.plugin.zsh @@ -0,0 +1,6 @@ +# Displays mounted drive information in a nicely formatted manner +# ------------------------------------------------------------------- +function nicemount() { + (echo "DEVICE PATH TYPE FLAGS" && mount | awk '$2="";1') | column -t ; +} + diff --git a/.oh-my-zsh/custom/plugins/path.plugin.zsh b/.oh-my-zsh/custom/plugins/path.plugin.zsh new file mode 100644 index 0000000..7f45865 --- /dev/null +++ b/.oh-my-zsh/custom/plugins/path.plugin.zsh @@ -0,0 +1,11 @@ +# Display a neatly formatted path <<2 +# ------------------------------------------------------------------- +path() { +echo $PATH | tr ":" "\n" | \ + awk "{ sub(\"/usr\", \"$fg_no_bold[green]/usr$reset_color\"); \ + sub(\"/bin\", \"$fg_no_bold[blue]/bin$reset_color\"); \ + sub(\"/opt\", \"$fg_no_bold[cyan]/opt$reset_color\"); \ + sub(\"/sbin\", \"$fg_no_bold[magenta]/sbin$reset_color\"); \ + sub(\"/local\", \"$fg_no_bold[yellow]/local$reset_color\"); \ + print }" + } diff --git a/.oh-my-zsh/custom/plugins/simple_server.plugin.zsh b/.oh-my-zsh/custom/plugins/simple_server.plugin.zsh new file mode 100644 index 0000000..57684cd --- /dev/null +++ b/.oh-my-zsh/custom/plugins/simple_server.plugin.zsh @@ -0,0 +1,15 @@ +#------------------------------------------------------------------------------- +# cd into a directory you want to share and then +# type webshare. You will be able to connect to that directory +# with other machines on the local net work with IP:8000 +# the function will display the current machines ip address +#------------------------------------------------------------------------------- +function webshare() { + if [ "$(uname)" = "Darwin" ]; then + local_ip=`ifconfig | grep 192 | cut -d ' ' -f 2` + else + local_ip=`hostname -I | cut -d " " -f 1` + fi + echo "connect to $local_ip:8000" + python -m SimpleHTTPServer > /dev/null 2>&1 + } diff --git a/.oh-my-zsh/custom/plugins/spell.plugin.zsh b/.oh-my-zsh/custom/plugins/spell.plugin.zsh new file mode 100644 index 0000000..6b74a4b --- /dev/null +++ b/.oh-my-zsh/custom/plugins/spell.plugin.zsh @@ -0,0 +1,6 @@ +#---------------------------------------------------------------- +# Because, well I need to spell check a lot :\ +#---------------------------------------------------------------- +spell (){ + echo $1 | aspell -a +} diff --git a/.oh-my-zsh/custom/vim-grep.zsh b/.oh-my-zsh/custom/vim-grep.zsh new file mode 100644 index 0000000..feeef11 --- /dev/null +++ b/.oh-my-zsh/custom/vim-grep.zsh @@ -0,0 +1,10 @@ +function vim-grep () { + vim $(grep -Rl "$@" ./*) +} + +#Not a vim tip exclusively, but I have a great bash command I use really frequently for quickly opening files in a big project by grepping for strings that I know to be unique to that file. It can also be useful for simple refactoring where an IDE is not necessary. I creatively named it vim-grep +#Incredibly simple, but in a large project instead of +#$ vim src/com/mycompany/project/v1/tpsreportgen/model/TpsModel.java +#I can use +#$ vim-grep "class TpsModel" +#If I dropped the 'class' from the search I would immediately have a command to edit all files that have TPSModel imported into them as well. \ No newline at end of file diff --git a/.tmux.conf b/.tmux.conf index 4f58478..b1bc6c0 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -2,22 +2,35 @@ set -g prefix C-a unbind C-b bind C-a send-prefix +set -sg escape-time 0 + +# Ensure terminal starts with its own colour scheme (helps Vim/Neovim themes to not break) +set-option -g default-terminal "xterm-256color" +set -g default-terminal "xterm-256color" +set -g xterm-keys on + #Mouse/Scrollback Tweaks set -g history-limit 20000 setw -g mode-keys vi set-option -g mouse on set-option -g pane-active-border-fg yellow + #New Keybindings bind-key r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded" + #Powerline Settings run-shell "powerline-daemon -q" source "/usr/share/powerline/bindings/tmux/powerline.conf" + #Misc Enables -set -g default-terminal "screen-256color" +set-option -g renumber-windows on setw -g monitor-activity on set -g visual-activity on set -g status-justify centre +set -g status-utf8 on + #### COLOUR (Solarized dark) +set -g default-terminal "screen-256color" ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=3' # default statusbar colors set-option -g status-bg black #base02 @@ -52,3 +65,8 @@ set-window-option -g clock-mode-colour green #green # bell set-window-option -g window-status-bell-style fg=black,bg=red #base02, red +# start with window 1 (instead of 0) +set -g base-index 1 + +# start with pane 1 +set -g pane-base-index 1 \ No newline at end of file diff --git a/.zshrc b/.zshrc index 6a86128..5613748 100644 --- a/.zshrc +++ b/.zshrc @@ -96,3 +96,10 @@ if [[ -z "$SSH_CLIENT" ]] then . /usr/share/powerline/bindings/zsh/powerline.zsh fi + +#zsh options +setopt auto_cd +setopt complete_aliases +setopt extended_glob +setopt hist_ignore_all_dups +setopt share_history diff --git a/init.sh b/init.sh index 8a9b73f..58b692c 100755 --- a/init.sh +++ b/init.sh @@ -2,8 +2,13 @@ #install pre-req. echo "installing required packages" sudo apt-get install tmux zsh vim powerline -#backup existing configs, if they exist - +#remove existing configs, if they exist +rm -ri ~/.tmux.conf +rm -ri ~/.zsh-custom +rm -ri ~/.vimrc +rm -ri ~/.vim +rm -ri ~/.oh-my-zsh +rm -ri ~/.zshrc #make links #ln -s /home/`whoami`/stevset/.bash_aliases /home/`whoami`/.bash_aliases #ln -s /home/`whoami`/stevset/.bashrc /home/`whoami`/.bashrc @@ -16,3 +21,16 @@ ln -s /home/`whoami`/stevset/.vimrc /home/`whoami`/.vimrc #set new shell echo "set new shell to zsh" chsh -s /bin/zsh + +echo -n "Would you like to configure your git name and email? (y/n) => "; read answer +if [[ $answer = "Y" ]] || [[ $answer = "y" ]]; then + echo -n "What is your git user name => "; read name + git config --global user.name "$name" + echo -n "What is your git email => "; read email + git config --global user.email "$email" +fi + +echo "*******************************" +echo "* Restart your terminal *" +echo "*******************************" +