Partial merge of ideas from github.com/toranb/dotfiles

This commit is contained in:
Stefen Auris 2017-08-15 14:36:15 -04:00
parent f0e925e441
commit 8212245774
10 changed files with 108 additions and 3 deletions

View file

@ -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 ../../../..'

View file

@ -0,0 +1,4 @@
# Find a file with a pattern in name:
#--------------------------------------------------------------------
function ff() { find . -type f -iname '*'"$*"'*' -ls ; }

View file

@ -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 ;
}

View file

@ -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 }"
}

View file

@ -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
}

View file

@ -0,0 +1,6 @@
#----------------------------------------------------------------
# Because, well I need to spell check a lot :\
#----------------------------------------------------------------
spell (){
echo $1 | aspell -a
}

View file

@ -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.

View file

@ -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

7
.zshrc
View file

@ -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

22
init.sh
View file

@ -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 "*******************************"