updated the tmux config a bit, and made a custom, independent zsh
config.
This commit is contained in:
		
							parent
							
								
									2883f9499d
								
							
						
					
					
						commit
						d66419712f
					
				
					 7 changed files with 507 additions and 7 deletions
				
			
		
							
								
								
									
										218
									
								
								zsh/.zsh/dircolors
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										218
									
								
								zsh/.zsh/dircolors
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,218 @@
 | 
			
		|||
# Configuration file for dircolors, a utility to help you set the
 | 
			
		||||
# LS_COLORS environment variable used by GNU ls with the --color option.
 | 
			
		||||
# Copyright (C) 1996-2014 Free Software Foundation, Inc.
 | 
			
		||||
# Copying and distribution of this file, with or without modification,
 | 
			
		||||
# are permitted provided the copyright notice and this notice are preserved.
 | 
			
		||||
# The keywords COLOR, OPTIONS, and EIGHTBIT (honored by the
 | 
			
		||||
# slackware version of dircolors) are recognized but ignored.
 | 
			
		||||
# Below, there should be one TERM entry for each termtype that is colorizable
 | 
			
		||||
TERM Eterm
 | 
			
		||||
TERM ansi
 | 
			
		||||
TERM color-xterm
 | 
			
		||||
TERM con132x25
 | 
			
		||||
TERM con132x30
 | 
			
		||||
TERM con132x43
 | 
			
		||||
TERM con132x60
 | 
			
		||||
TERM con80x25
 | 
			
		||||
TERM con80x28
 | 
			
		||||
TERM con80x30
 | 
			
		||||
TERM con80x43
 | 
			
		||||
TERM con80x50
 | 
			
		||||
TERM con80x60
 | 
			
		||||
TERM cons25
 | 
			
		||||
TERM console
 | 
			
		||||
TERM cygwin
 | 
			
		||||
TERM dtterm
 | 
			
		||||
TERM eterm-color
 | 
			
		||||
TERM gnome
 | 
			
		||||
TERM gnome-256color
 | 
			
		||||
TERM hurd
 | 
			
		||||
TERM jfbterm
 | 
			
		||||
TERM konsole
 | 
			
		||||
TERM kterm
 | 
			
		||||
TERM linux
 | 
			
		||||
TERM linux-c
 | 
			
		||||
TERM mach-color
 | 
			
		||||
TERM mach-gnu-color
 | 
			
		||||
TERM mlterm
 | 
			
		||||
TERM putty
 | 
			
		||||
TERM putty-256color
 | 
			
		||||
TERM rxvt
 | 
			
		||||
TERM rxvt-256color
 | 
			
		||||
TERM rxvt-cygwin
 | 
			
		||||
TERM rxvt-cygwin-native
 | 
			
		||||
TERM rxvt-unicode
 | 
			
		||||
TERM rxvt-unicode-256color
 | 
			
		||||
TERM rxvt-unicode256
 | 
			
		||||
TERM screen
 | 
			
		||||
TERM screen.xterm-256color
 | 
			
		||||
TERM screen-256color
 | 
			
		||||
TERM screen-256color-bce
 | 
			
		||||
TERM screen-bce
 | 
			
		||||
TERM screen-w
 | 
			
		||||
TERM screen.Eterm
 | 
			
		||||
TERM screen.rxvt
 | 
			
		||||
TERM screen.linux
 | 
			
		||||
TERM st
 | 
			
		||||
TERM st-256color
 | 
			
		||||
TERM terminator
 | 
			
		||||
TERM vt100
 | 
			
		||||
TERM xterm
 | 
			
		||||
TERM xterm-16color
 | 
			
		||||
TERM xterm-256color
 | 
			
		||||
TERM xterm-88color
 | 
			
		||||
TERM xterm-color
 | 
			
		||||
TERM xterm-debian
 | 
			
		||||
# Below are the color init strings for the basic file types. A color init
 | 
			
		||||
# string consists of one or more of the following numeric codes:
 | 
			
		||||
# Attribute codes:
 | 
			
		||||
# 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed
 | 
			
		||||
# Text color codes:
 | 
			
		||||
# 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white
 | 
			
		||||
# Background color codes:
 | 
			
		||||
# 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white
 | 
			
		||||
#NORMAL 00 # no color code at all
 | 
			
		||||
#FILE 00 # regular file: use no color at all
 | 
			
		||||
RESET 0 # reset to "normal" color
 | 
			
		||||
DIR 01;34 # directory
 | 
			
		||||
LINK target #01;36 # symbolic link. (If you set this to 'target' instead of a
 | 
			
		||||
 # numerical value, the color is as for the file pointed to.)
 | 
			
		||||
MULTIHARDLINK 00 # regular file with more than one link
 | 
			
		||||
FIFO 40;33 # pipe
 | 
			
		||||
SOCK 01;35 # socket
 | 
			
		||||
DOOR 01;35 # door
 | 
			
		||||
BLK 40;33;01 # block device driver
 | 
			
		||||
CHR 40;33;01 # character device driver
 | 
			
		||||
ORPHAN 40;31;01 # symlink to nonexistent file, or non-stat'able file
 | 
			
		||||
SETUID 37;41 # file that is setuid (u+s)
 | 
			
		||||
SETGID 30;43 # file that is setgid (g+s)
 | 
			
		||||
CAPABILITY 30;41 # file with capability
 | 
			
		||||
STICKY_OTHER_WRITABLE 37;41 # dir that is sticky and other-writable (+t,o+w)
 | 
			
		||||
OTHER_WRITABLE 31;40 # dir that is other-writable (o+w) and not sticky
 | 
			
		||||
STICKY 37;44 # dir with the sticky bit set (+t) and not other-writable
 | 
			
		||||
# This is for files with execute permission:
 | 
			
		||||
EXEC 01;32
 | 
			
		||||
# List any file extensions like '.gz' or '.tar' that you would like ls
 | 
			
		||||
# to colorize below. Put the extension, a space, and the color init string.
 | 
			
		||||
# (and any comments you want to add after a '#')
 | 
			
		||||
# If you use DOS-style suffixes, you may want to uncomment the following:
 | 
			
		||||
#.cmd 01;32 # executables (bright green)
 | 
			
		||||
#.exe 01;32
 | 
			
		||||
#.com 01;32
 | 
			
		||||
#.btm 01;32
 | 
			
		||||
#.bat 01;32
 | 
			
		||||
# Or if you want to colorize scripts even if they do not have the
 | 
			
		||||
# executable bit actually set.
 | 
			
		||||
#.sh 01;32
 | 
			
		||||
#.csh 01;32
 | 
			
		||||
 # archives or compressed (bright red)
 | 
			
		||||
.tar 01;31
 | 
			
		||||
.tgz 01;31
 | 
			
		||||
.arc 01;31
 | 
			
		||||
.arj 01;31
 | 
			
		||||
.taz 01;31
 | 
			
		||||
.lha 01;31
 | 
			
		||||
.lz4 01;31
 | 
			
		||||
.lzh 01;31
 | 
			
		||||
.lzma 01;31
 | 
			
		||||
.tlz 01;31
 | 
			
		||||
.txz 01;31
 | 
			
		||||
.tzo 01;31
 | 
			
		||||
.t7z 01;31
 | 
			
		||||
.zip 01;31
 | 
			
		||||
.z 01;31
 | 
			
		||||
.Z 01;31
 | 
			
		||||
.dz 01;31
 | 
			
		||||
.gz 01;31
 | 
			
		||||
.lrz 01;31
 | 
			
		||||
.lz 01;31
 | 
			
		||||
.lzo 01;31
 | 
			
		||||
.xz 01;31
 | 
			
		||||
.bz2 01;31
 | 
			
		||||
.bz 01;31
 | 
			
		||||
.tbz 01;31
 | 
			
		||||
.tbz2 01;31
 | 
			
		||||
.tz 01;31
 | 
			
		||||
.deb 01;31
 | 
			
		||||
.rpm 01;31
 | 
			
		||||
.jar 01;31
 | 
			
		||||
.war 01;31
 | 
			
		||||
.ear 01;31
 | 
			
		||||
.sar 01;31
 | 
			
		||||
.rar 01;31
 | 
			
		||||
.alz 01;31
 | 
			
		||||
.ace 01;31
 | 
			
		||||
.zoo 01;31
 | 
			
		||||
.cpio 01;31
 | 
			
		||||
.7z 01;31
 | 
			
		||||
.rz 01;31
 | 
			
		||||
.cab 01;31
 | 
			
		||||
# image formats
 | 
			
		||||
.jpg 01;35
 | 
			
		||||
.jpeg 01;35
 | 
			
		||||
.gif 01;35
 | 
			
		||||
.bmp 01;35
 | 
			
		||||
.pbm 01;35
 | 
			
		||||
.pgm 01;35
 | 
			
		||||
.ppm 01;35
 | 
			
		||||
.tga 01;35
 | 
			
		||||
.xbm 01;35
 | 
			
		||||
.xpm 01;35
 | 
			
		||||
.tif 01;35
 | 
			
		||||
.tiff 01;35
 | 
			
		||||
.png 01;35
 | 
			
		||||
.svg 01;35
 | 
			
		||||
.svgz 01;35
 | 
			
		||||
.mng 01;35
 | 
			
		||||
.pcx 01;35
 | 
			
		||||
.mov 01;35
 | 
			
		||||
.mpg 01;35
 | 
			
		||||
.mpeg 01;35
 | 
			
		||||
.m2v 01;35
 | 
			
		||||
.mkv 01;35
 | 
			
		||||
.webm 01;35
 | 
			
		||||
.ogm 01;35
 | 
			
		||||
.mp4 01;35
 | 
			
		||||
.m4v 01;35
 | 
			
		||||
.mp4v 01;35
 | 
			
		||||
.vob 01;35
 | 
			
		||||
.qt 01;35
 | 
			
		||||
.nuv 01;35
 | 
			
		||||
.wmv 01;35
 | 
			
		||||
.asf 01;35
 | 
			
		||||
.rm 01;35
 | 
			
		||||
.rmvb 01;35
 | 
			
		||||
.flc 01;35
 | 
			
		||||
.avi 01;35
 | 
			
		||||
.fli 01;35
 | 
			
		||||
.flv 01;35
 | 
			
		||||
.gl 01;35
 | 
			
		||||
.dl 01;35
 | 
			
		||||
.xcf 01;35
 | 
			
		||||
.xwd 01;35
 | 
			
		||||
.yuv 01;35
 | 
			
		||||
.cgm 01;35
 | 
			
		||||
.emf 01;35
 | 
			
		||||
# http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions
 | 
			
		||||
.axv 01;35
 | 
			
		||||
.anx 01;35
 | 
			
		||||
.ogv 01;35
 | 
			
		||||
.ogx 01;35
 | 
			
		||||
# audio formats
 | 
			
		||||
.aac 00;36
 | 
			
		||||
.au 00;36
 | 
			
		||||
.flac 00;36
 | 
			
		||||
.m4a 00;36
 | 
			
		||||
.mid 00;36
 | 
			
		||||
.midi 00;36
 | 
			
		||||
.mka 00;36
 | 
			
		||||
.mp3 00;36
 | 
			
		||||
.mpc 00;36
 | 
			
		||||
.ogg 00;36
 | 
			
		||||
.ra 00;36
 | 
			
		||||
.wav 00;36
 | 
			
		||||
# http://wiki.xiph.org/index.php/MIME_Types_and_File_Extensions
 | 
			
		||||
.axa 00;36
 | 
			
		||||
.oga 00;36
 | 
			
		||||
.spx 00;36
 | 
			
		||||
.xspf 00;36
 | 
			
		||||
							
								
								
									
										71
									
								
								zsh/.zsh/functions.zsh
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										71
									
								
								zsh/.zsh/functions.zsh
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,71 @@
 | 
			
		|||
# intellegently extract archives based on extension. 
 | 
			
		||||
 | 
			
		||||
# web_search from terminal
 | 
			
		||||
function web_search() {
 | 
			
		||||
  emulate -L zsh
 | 
			
		||||
 | 
			
		||||
  # define search engine URLS
 | 
			
		||||
  typeset -A urls
 | 
			
		||||
  urls=(
 | 
			
		||||
    ddg         "https://www.duckduckgo.com/?q="
 | 
			
		||||
    github      "https://github.com/search?q="
 | 
			
		||||
  )
 | 
			
		||||
 | 
			
		||||
  # check whether the search engine is supported
 | 
			
		||||
  if [[ -z "$urls[$1]" ]]; then
 | 
			
		||||
    echo "Search engine $1 not supported."
 | 
			
		||||
    return 1
 | 
			
		||||
  fi
 | 
			
		||||
 | 
			
		||||
  # search or go to main page depending on number of arguments passed
 | 
			
		||||
  if [[ $# -gt 1 ]]; then
 | 
			
		||||
    # build search url:
 | 
			
		||||
    # join arguments passed with '+', then append to search engine URL
 | 
			
		||||
    url="${urls[$1]}${(j:+:)@[2,-1]}"
 | 
			
		||||
  else
 | 
			
		||||
    # build main page url:
 | 
			
		||||
    # split by '/', then rejoin protocol (1) and domain (2) parts with '//'
 | 
			
		||||
    url="${(j://:)${(s:/:)urls[$1]}[1,2]}"
 | 
			
		||||
  fi
 | 
			
		||||
 | 
			
		||||
  open_command "$url"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#use generalized open command
 | 
			
		||||
function open_command() {
 | 
			
		||||
  emulate -L zsh
 | 
			
		||||
  setopt shwordsplit
 | 
			
		||||
 | 
			
		||||
  local open_cmd
 | 
			
		||||
 | 
			
		||||
  # define the open command
 | 
			
		||||
  case "$OSTYPE" in
 | 
			
		||||
    darwin*)  open_cmd='open' ;;
 | 
			
		||||
    cygwin*)  open_cmd='cygstart' ;;
 | 
			
		||||
    linux*)   open_cmd='xdg-open' ;;
 | 
			
		||||
    msys*)    open_cmd='start ""' ;;
 | 
			
		||||
    *)        echo "Platform $OSTYPE not supported"
 | 
			
		||||
              return 1
 | 
			
		||||
              ;;
 | 
			
		||||
  esac
 | 
			
		||||
 | 
			
		||||
  # don't use nohup on OSX
 | 
			
		||||
  if [[ "$OSTYPE" == darwin* ]]; then
 | 
			
		||||
    $open_cmd "$@" &>/dev/null
 | 
			
		||||
  else
 | 
			
		||||
    nohup $open_cmd "$@" &>/dev/null
 | 
			
		||||
  fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Show dots while waiting for tab-completion
 | 
			
		||||
expand-or-complete-with-dots() {
 | 
			
		||||
	# toggle line-wrapping off and back on again
 | 
			
		||||
	[[ -n "$terminfo[rmam]" && -n "$terminfo[smam]" ]] && echoti rmam
 | 
			
		||||
	print -Pn "%{%F{red}......%f%}"
 | 
			
		||||
	[[ -n "$terminfo[rmam]" && -n "$terminfo[smam]" ]] && echoti smam
 | 
			
		||||
 | 
			
		||||
	zle expand-or-complete
 | 
			
		||||
	zle redisplay
 | 
			
		||||
}
 | 
			
		||||
zle -N expand-or-complete-with-dots
 | 
			
		||||
bindkey "^I" expand-or-complete-with-dots
 | 
			
		||||
							
								
								
									
										33
									
								
								zsh/.zsh/prompt.zsh
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								zsh/.zsh/prompt.zsh
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,33 @@
 | 
			
		|||
#This file is to set up the ZSH prompt. This is a customized prompt, and, as will all my zsh things, does not rely on an outside plugin.
 | 
			
		||||
#Also like most of my stuff, mutch of this code is taken from another source. in this case, I used the GRML zshrc as a base.
 | 
			
		||||
#this is a WIP.
 | 
			
		||||
#TODO: make this a proper prompt theme file instead of just a sourced file... maybye.
 | 
			
		||||
 | 
			
		||||
autoload -U promptinit
 | 
			
		||||
promptinit
 | 
			
		||||
autoload -U colors
 | 
			
		||||
colors
 | 
			
		||||
 | 
			
		||||
#stuff to show git things.
 | 
			
		||||
	autoload -Uz vcs_info
 | 
			
		||||
 | 
			
		||||
	setopt prompt_subst
 | 
			
		||||
 | 
			
		||||
	precmd_vcs() {vcs_info}
 | 
			
		||||
 | 
			
		||||
	#when not in a repo, show full path to current directory. when in one, show path from base direcory of the repo.
 | 
			
		||||
	zstyle ':vcs_info:*' nvcsformats '%~'
 | 
			
		||||
	zstyle ':vcs_info:*' formats '%r/%S %F{green}[%b]%f'
 | 
			
		||||
 | 
			
		||||
#the precmd function, called just before printing the prompt. TODO: use this to set our prompt variable as different evey time, in order to get a right aligned portion in the top line.
 | 
			
		||||
function precmd() {
 | 
			
		||||
	precmd_vcs
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#on the top line, show a whole bunch of info. botton line should be as minimal as possilbe (just a single char to  input next to...)
 | 
			
		||||
PROMPT='%F{cyan}[%m@%n]%f%F{red}├────┤%f${vcs_info_msg_0_}
 | 
			
		||||
»'
 | 
			
		||||
 | 
			
		||||
#Make the right prompt blank, just to be sure.
 | 
			
		||||
RPROMPT=
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										157
									
								
								zsh/.zshrc
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										157
									
								
								zsh/.zshrc
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,157 @@
 | 
			
		|||
# Based off of the zshrc of Josh Hartwell, with many additions, deletions, and changes from across the outside community.
 | 
			
		||||
 | 
			
		||||
local ZSH_CONF=$HOME/.zsh                      # Define the place I store all my zsh config stuff
 | 
			
		||||
local ZSH_CACHE=$ZSH_CONF/cache                # for storing files like history and zcompdump 
 | 
			
		||||
local LOCAL_ZSHRC=$HOME/.zshlocal/.zshrc       # Allow the local machine to have its own overriding zshrc if it wants it
 | 
			
		||||
 | 
			
		||||
# Load external config files and tools
 | 
			
		||||
 | 
			
		||||
	# Load misc functions. Done in a seperate file to keep this from getting too long and ugly
 | 
			
		||||
	source $ZSH_CONF/functions.zsh
 | 
			
		||||
	#Load prompt file. Also done to keep it more tidy.
 | 
			
		||||
	source $ZSH_CONF/prompt.zsh
 | 
			
		||||
 | 
			
		||||
# Set important shell variables
 | 
			
		||||
	 export EDITOR=nvim                           # Set default editor
 | 
			
		||||
	 export WORDCHARS=''                         # This is the oh-my-zsh default, I think I'd like it to be a bit different 
 | 
			
		||||
	 export PAGER=less                           # Set default pager
 | 
			
		||||
	 export LESS="-R"                            # Set the default options for less 
 | 
			
		||||
	 export LESSHISTFILE="/dev/null"                    # Prevent the less hist file from being made, I dont want it
 | 
			
		||||
 
 | 
			
		||||
# Misc
 | 
			
		||||
	# Enable the ZLE line editor, which is default behavior, but to be sure
 | 
			
		||||
	setopt ZLE
 | 
			
		||||
	# prevent duplicate entries in path
 | 
			
		||||
	declare -U path
 | 
			
		||||
	# Uses custom colors for LS, as outlined in dircolors
 | 
			
		||||
	eval $(dircolors $ZSH_CONF/dircolors)
 | 
			
		||||
	# Sends cd commands without the need for 'cd'
 | 
			
		||||
	setopt AUTO_CD
 | 
			
		||||
	# Can pipe to mulitple outputs
 | 
			
		||||
	setopt MULTI_OS
 | 
			
		||||
	# Kill all child processes when we exit, dont leave them running
 | 
			
		||||
	unsetopt NO_HUP
 | 
			
		||||
	#Allows comments in interactive shell.
 | 
			
		||||
	setopt INTERACTIVE_COMMENTS
 | 
			
		||||
	# Abc{$cool}efg where $cool is an array surrounds all array variables individually
 | 
			
		||||
	setopt RC_EXPAND_PARAM
 | 
			
		||||
	# Ctrl+S and Ctrl+Q usually disable/enable tty input. This disables those inputs
 | 
			
		||||
	unsetopt FLOW_CONTROL
 | 
			
		||||
	# List jobs in the long format by default. (I dont know what this does but it sounds good)
 | 
			
		||||
	setopt LONG_LIST_JOBS
 | 
			
		||||
	# Make the shell act like vi if i hit escape
 | 
			
		||||
	setopt vi
 | 
			
		||||
 | 
			
		||||
# ZSH History 
 | 
			
		||||
	alias history='fc -fl 1'
 | 
			
		||||
	HISTFILE=$ZSH_CACHE/history                 # Keep our home directory neat by keeping the histfile somewhere else
 | 
			
		||||
	SAVEHIST=10000                              # Big history
 | 
			
		||||
	HISTSIZE=10000                              # Big history
 | 
			
		||||
	setopt EXTENDED_HISTORY                     # Include more information about when the command was executed, etc
 | 
			
		||||
	setopt APPEND_HISTORY                       # Allow multiple terminal sessions to all append to one zsh command history
 | 
			
		||||
	setopt HIST_FIND_NO_DUPS                    # When searching history dont display results already cycled through twice
 | 
			
		||||
	setopt HIST_EXPIRE_DUPS_FIRST               # When duplicates are entered, get rid of the duplicates first when we hit $HISTSIZE 
 | 
			
		||||
	setopt HIST_IGNORE_SPACE                    # Dont enter commands into history if they start with a space
 | 
			
		||||
	setopt HIST_VERIFY                          # makes history substitution commands a bit nicer. I dont fully understand
 | 
			
		||||
	setopt SHARE_HISTORY                        # Shares history across multiple zsh sessions, in real time
 | 
			
		||||
	setopt HIST_IGNORE_DUPS                     # Do not write events to history that are duplicates of the immediately previous event
 | 
			
		||||
	setopt INC_APPEND_HISTORY                   # Add commands to history as they are typed, dont wait until shell exit
 | 
			
		||||
	setopt HIST_REDUCE_BLANKS                   # Remove extra blanks from each command line being added to history
 | 
			
		||||
 | 
			
		||||
# ZSH Auto Completion
 | 
			
		||||
	# Figure out the short hostname
 | 
			
		||||
	if [[ "$OSTYPE" = darwin* ]]; then          
 | 
			
		||||
	   # OS X's $HOST changes with dhcp, etc., so use ComputerName if possible.
 | 
			
		||||
	   SHORT_HOST=$(scutil --get ComputerName 2>/dev/null) || SHORT_HOST=${HOST/.*/}
 | 
			
		||||
	else
 | 
			
		||||
	   SHORT_HOST=${HOST/.*/}
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
	#the auto complete dump is a cache file where ZSH stores its auto complete data, for faster load times
 | 
			
		||||
	local ZSH_COMPDUMP="$ZSH_CACHE/acdump-${SHORT_HOST}-${ZSH_VERSION}"  #where to store autocomplete data
 | 
			
		||||
 | 
			
		||||
	autoload -Uz compinit
 | 
			
		||||
	compinit -i -d "${ZSH_COMPDUMP}"                        # Init auto completion; tell where to store autocomplete dump
 | 
			
		||||
	zstyle ':completion:*' menu select                      # Have the menu highlight as we cycle through options
 | 
			
		||||
	zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'     # Case-insensitive (uppercase from lowercase) completion
 | 
			
		||||
	setopt COMPLETE_IN_WORD                                 # Allow completion from within a word/phrase
 | 
			
		||||
	setopt ALWAYS_TO_END                                    # When completing from the middle of a word, move cursor to end of word
 | 
			
		||||
	setopt MENU_COMPLETE                                    # When using auto-complete, put the first option on the line immediately
 | 
			
		||||
	setopt COMPLETE_ALIASES                                 # Turn on completion for aliases as well
 | 
			
		||||
	setopt LIST_ROWS_FIRST                                  # Cycle through menus horizontally instead of vertically
 | 
			
		||||
 | 
			
		||||
# Globbing
 | 
			
		||||
	setopt NO_CASE_GLOB                         # Case insensitive globbing
 | 
			
		||||
	setopt EXTENDED_GLOB                        # Allow the powerful zsh globbing features, see link:
 | 
			
		||||
	# http://www.refining-linux.org/archives/37/ZSH-Gem-2-Extended-globbing-and-expansion/
 | 
			
		||||
	setopt NUMERIC_GLOB_SORT                    # Sort globs that expand to numbers numerically, not by letter (i.e. 01 2 03)
 | 
			
		||||
   
 | 
			
		||||
# Aliases
 | 
			
		||||
 | 
			
		||||
	alias vim="nvim"
 | 
			
		||||
 | 
			
		||||
	#alias -g ...='../..'
 | 
			
		||||
	#alias -g ....='../../..'
 | 
			
		||||
	#alias -g .....='../../../..'
 | 
			
		||||
	#alias -g ......='../../../../..'
 | 
			
		||||
	#alias -g .......='../../../../../..'
 | 
			
		||||
	#alias -g ........='../../../../../../..'
 | 
			
		||||
 | 
			
		||||
	alias ls="ls -h --color='auto'"
 | 
			
		||||
	alias lsa='ls -A'
 | 
			
		||||
	alias ll='ls -l'
 | 
			
		||||
	alias la='ls -lA'
 | 
			
		||||
	alias lx='ls -lXB'    #Sort by extension
 | 
			
		||||
	alias lt='ls -ltr'
 | 
			
		||||
	alias lk='ls -lSr'
 | 
			
		||||
	alias cdl=changeDirectory; function changeDirectory { cd $1 ; la }
 | 
			
		||||
 | 
			
		||||
	alias md='mkdir -p'
 | 
			
		||||
	alias rd='rmdir'
 | 
			
		||||
 | 
			
		||||
	# Copy with a progress bar
 | 
			
		||||
	alias cpv="rsync -poghb --backup-dir=/tmp/rsync -e /dev/null --progress --" 
 | 
			
		||||
 | 
			
		||||
	alias d='dirs -v | head -10'                      # List the last ten directories we've been to this session, no duplicates
 | 
			
		||||
 | 
			
		||||
	alias ddg='web_search ddg'
 | 
			
		||||
	alias github='web_search github'
 | 
			
		||||
	alias wiki='web_search ddg \!w'
 | 
			
		||||
	alias news='web_search ddg \!n'
 | 
			
		||||
	alias youtube='web_search ddg \!yt'
 | 
			
		||||
	alias map='web_search ddg \!m'
 | 
			
		||||
	alias image='web_search ddg \!i'
 | 
			
		||||
 | 
			
		||||
# Setup grep to be a bit more nice
 | 
			
		||||
	# check if 'x' grep argument available
 | 
			
		||||
	grep-flag-available() {
 | 
			
		||||
		  echo | grep $1 "" >/dev/null 2>&1
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	local GREP_OPTIONS=""
 | 
			
		||||
 | 
			
		||||
	# color grep results
 | 
			
		||||
	if grep-flag-available --color=auto; then
 | 
			
		||||
		  GREP_OPTIONS+=" --color=auto"
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
	# ignore VCS folders (if the necessary grep flags are available)
 | 
			
		||||
	local VCS_FOLDERS="{.bzr,CVS,.git,.hg,.svn}"
 | 
			
		||||
 | 
			
		||||
	if grep-flag-available --exclude-dir=.cvs; then
 | 
			
		||||
		  GREP_OPTIONS+=" --exclude-dir=$VCS_FOLDERS"
 | 
			
		||||
	elif grep-flag-available --exclude=.cvs; then
 | 
			
		||||
		  GREP_OPTIONS+=" --exclude=$VCS_FOLDERS"
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
	# export grep settings
 | 
			
		||||
	alias grep="grep $GREP_OPTIONS"
 | 
			
		||||
 | 
			
		||||
	# clean up
 | 
			
		||||
	unfunction grep-flag-available
 | 
			
		||||
 | 
			
		||||
# Allow local zsh settings (superseding anything in here) in case I want something specific for certain machines
 | 
			
		||||
  if [[ -r $LOCAL_ZSHRC ]]; then
 | 
			
		||||
    source $LOCAL_ZSHRC
 | 
			
		||||
  fi
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue