-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshrc
679 lines (594 loc) · 30.2 KB
/
.zshrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
# To use this file, rename it to .zshrc and put it in ~/
################################################################################
# Customization by James Nam
# (Feel free to use, modify, and distribute)
################################################################################
################################################################################
# Shell
################################################################################
alias ..='cd ..'
alias l='ls'
alias lsa='ls -A'
alias lsal='ls -Al'
alias lsl='ls -l'
alias f='find . -name' # ex: f README\*
alias g='grep -r' # ex: g termtosearch .
################################################################################
# Git
################################################################################
alias sw='git checkout' # ex: sw my-branch
alias merge='git merge' # ex: merge develop
alias up='git rebase' # ex: up develop
alias p='git pull' # ex: p
alias h='git log --pretty=oneline -20' # ex: h
alias s='git status' # ex: s
alias b='git branch --sort=-committerdate -vv' # ex: b
alias d='git diff' # ex: d
alias ds='git --no-pager diff --stat' # ex: ds <commit hash>
alias ss='git --no-pager show --stat' # ex: ss <commit hash>
alias rename="git branch -m" # ex: rename my-branch my-new-branch
alias del='git branch -D' # ex: del old-branch
alias newb='git checkout -b' # ex: newb my-new-branch
alias push='git push' # ex: push
alias gpush='git push origin HEAD:refs/for/develop' # ex: push (for Gerritt)
alias add='git add -u' # ex: add .
alias undoedit='git checkout --' # ex: undoedit path/to/file
alias Undoedit='git checkout -- .' # ex: Undoedit
alias c='git commit -v' # ex: com
alias undocommit="git reset HEAD ." # ex: undocommit
alias Undocommit="git reset --hard" # ex: Undocommit
alias ca='git commit -v --amend'
alias lo='git log'
alias show='git show'
alias sm='git log -='
################################################################################
# npm
################################################################################
alias ns='npm start'
alias ni='npm install'
################################################################################
# Original config by Sam King
# (https://code.google.com/p/samking-config-files/source/browse/)
################################################################################
################################################################################
# There are many resources online to help you make your shell how you want it.
# http://grml.org/zsh/zsh-lovers.html has a good compilation of many resources,
# including many of the ones cited below. man zsh has a very complete and well
# organized set of man pages. man zshroadmap has a brief intro. A user's guide
# to ZSH is available at zsh.sourceforge.net/Guide.
# http://zsh.sourceforge.net/Doc/ has an online version of the man pages.
# zshwiki.org is also a good resource.
# http://mywiki.wooledge.org/BashFAQ/031 explains how test, [, and [[ work
#
# The order of login shells is:
# * zshenv
# * zprofile (login shells)
# * zshrc (interactive shells)
# * zlogin (login shells)
# Note that /etc/zshenv is read before ~/.zshenv, and the /etc versions of other
# files are similarly read before their dot files.
#
# This file was created by Sam King <[email protected]>. Feel free to
# modify, distribute, and enjoy it. Also let me know if you discover any other
# cool tricks -- ZSH is too huge for me to know everything about it.
# If I got anything from your zshrc online and forgot to credit you, please let
# me know!
################################################################################
################################################################################
# ZSTYLE OPTIONS
# These were generated by compinstall. They can be regenerated using
# compinstall, but that would destroy everything inside the "The following
# lines..." comment.
# They mostly involve expansion and completion.
# To see how to write your own completion functions (if they aren't built in),
# check out http://www.linux-mag.com/id/1106/
# Also, see man zshcompsys for more on compinit and completion generally
################################################################################
# The following lines were added by compinstall
zstyle ':completion:*' completer _expand _complete _ignored _match _correct _approximate _prefix
zstyle ':completion:*' completions 1
zstyle ':completion:*' glob 1
zstyle ':completion:*' list-colors ''
zstyle ':completion:*' matcher-list '+' '+m:{[:lower:]}={[:upper:]}' '+m:{[:lower:][:upper:]}={[:upper:][:lower:]}' '+r:|[._-]=* r:|=* l:|=*'
zstyle ':completion:*' max-errors 3 numeric
zstyle ':completion:*' menu select=long
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
zstyle ':completion:*' substitute 1
# insert all expansions for expand completer
zstyle ':completion:*:expand:*' tag-order all-expansions
# formatting and messages
zstyle ':completion:*' verbose yes
zstyle ':completion:*' group-name ''
zstyle ':completion:*:descriptions' format '%B%d%b'
zstyle ':completion:*:messages' format '%d'
zstyle ':completion:*:warnings' format 'No matches for: %d'
zstyle ':completion:*:corrections' format '%B%d (errors: %e)%b'
# offer indexes before parameters in subscripts
zstyle ':completion:*:*:-subscript-:*' tag-order indexes parameters
# command for process lists, the local web server details and host completion
#zstyle ':completion:*:processes' command 'ps -o pid,s,nice,stime,args'
#zstyle ':completion:*:urls' local 'www' '/var/www/htdocs' 'public_html'
#zstyle '*' accounts $accounts
zstyle '*' hosts $hosts
zstyle '*' users $users
# Filename suffixes to ignore during completion (except after rm command)
zstyle ':completion:*:*:(^rm):*:*files' ignored-patterns '*?.o' '*?.c~' \
'*?.old' '*?.pro'
# ignore completion functions (until the _ignored completer)
zstyle ':completion:*:functions' ignored-patterns '_*'
# don't load every tab-completion module at startup. instead, mark them all
# as autoloaded so that when you need them, they'll get loaded.
autoload -Uz compinit
# allow tab completion for command line options
compinit
# End of lines added by compinstall
################################################################################
# ZSH OPTIONS -- see man zshoptions for full descriptions
# * setopt sets an option; unsetopt unsets an option
# * Even for unsetopt, my comments refer to the option itself
# * setting many of these options are unnecessary since they are set/unset by
# default. They are here for clarity.
# * underscores are optional and ignored in zsh options. There are also
# one-letter names for some options
# * prepending an option with "no" is the same as unsetting it
# * these are the options for interactive shells. Any options for both
# interactive and noninteractive shells should go in zshenv
################################################################################
# Changing Directories
unsetopt auto_cd # if I type a directory without 'cd', zsh automatically
# cds into it
setopt auto_pushd # when I cd, push the old directory onto the dir stack
setopt pushd_ignore_dups # don't push duplicate copies of a directory to
# the directory stack
# Completion
setopt auto_list # when tab completion is ambiguous, list choices
setopt auto_menu # when tab completion is ambiguous, use menu completion
# (fill in the next option when you press tab)
setopt list_beep # when tab completion is ambiguous, beep
unsetopt menu_complete # when tab completion is ambiguous, zsh automatically
# fills in the first option
unsetopt list_ambiguous # when there is an unambiguous prefix, insert that
# before inserting ambiguous stuff from the menu.
# menu_complete takes precedence over this.
# Expansion and Globbing
setopt glob # expand stuff to generate filenames.
setopt extended_glob # treat #, ~, and ^ as globbing patterns
setopt nomatch # zsh gets mad when I glob patterns that don't exist
# History
setopt append_history # append to the history file
setopt hist_ignore_dups # don't add immediately repeated commands to history
setopt extended_history # add timestamps to history. For a rough idea of the
# extra disk space this uses, you'll use up an extra
# 15kB for running 1000 commands. Your call.
# Init
# Input / Output
setopt aliases # use aliases defined below
setopt correct # correct my bad spelling of commands
unsetopt correct_all # correct my bad spelling of all argument son a line
# This is unset because it is fairly common to have an
# argument that is similar to a file in the current
# directory (eg, sudo git would correct to .git)
setopt print_exit_value # prints the exit value of commands when it's not 0
# (success); useful when writing shell scripts
# Job Control
setopt bg_nice # nice background jobs (run them with lower priority)
setopt check_jobs # yell at me if I try to exit zsh with jobs running
unsetopt notify # notify me of background job status immediately
# Prompting
# Scripts and Functions
setopt octal_zeroes # output octal numbers starting with a 0 instead of 8#
setopt c_bases # output hex numbers with 0x rather than 16#
setopt multios # allows redirection to multiple i/o streams; ie,
# echo "foo" > file1 > file2 | cat
# Zle - ZSH Line Editor (the thing that takes in your text and runs the shell)
setopt beep # zsh will beep when it's mad at me
################################################################################
# ZSH PARAMS + environment vars -- see man zshparam for full descriptions
# * if you're interested in zsh scripting, man zshparam
# tells you how parameters and arrays work in zsh scripts
# * this only contains the params and environment variables that should NOT be
# used by noninteractive shells. Environmental variables that are global
# go in zshenv
# * CAPITAL means that the parameter will store one value; lowercase means that
# the parameter is an array
# * Many of the below parameters are commented out because the defaults are
# good and we don't want to mess with them.
################################################################################
# Directory Stack
DIRSTACKSIZE=40 # max size of the directory stack. Good for
# truncating dirstack when it might grow very large
# (ie, when auto_pushd is on)
# History File
HISTFILE=~/.zsh-histfile # Save shell history into .zsh-histfile so we don't
# lose history (up arrow) when closing the shell
HISTSIZE=10000 # the number of lines to read from history file at
# startup. The only reason to have this larger than
# SAVEHIST is as a buffer for saving duplicated
# history events
SAVEHIST=10000 # the number of lines to save to history at logout
# Completion
fignore=(.o .c~ .old .pro) # ignores these file types when doing file completion
# The same as the zstyle.
# Shell Prompt
# * PROMPT is PS1, the primary prompt string, which is printed before the
# command is read.
# * PS2 is printed when the shell needs more info. Ie, if I type
# echo $(( 1 + 1 <enter>
# then the shell needs me to close my parentheses. By default, it will say
# which shell constructs or quotation marks need to be closed.
# * PS3 is for select loops.
# * PS4 is for execution trace.
# * See http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html for details
# on prompt expansion.
# PROMPT='%B%n@%m%b[%*]%U%~%u%# ' # <b>name@server</b>[time]<u>path</u>$
# # (ends with # in su mode).
# PROMPT='%B%n@%m%b[%*]%U%~%u%# ' # <b>name@server</b>[time]<u>path</u>$
# # (ends with # in su mode).
# Modified from
# http://stackoverflow.com/questions/689765/how-can-i-change-the-color-of-my-prompt-in-zsh-different-from-normal-text
autoload -U colors && colors # Let me use colors rather than character codes
# name@server time path %
# Respectively, they are green, cyan, blue, and red. Thus, all of the
# information is colored differently so that I can easily tell them apart, and
# everything is a soft color except the path, which is the only piece of
# information that I usually care about.
# PROMPT="%{$fg[green]%}%n%{$reset_color%}@%{$fg[cyan]%}%m %{$fg[blue]%}%* %{$fg[red]%}%~ %{$reset_color%}%# "
# PROMPT2=
# PROMPT3=
# PROMPT4=
# Display
# COLUMNS=80 # Number of columns for printing lists and line
# editor
# LINES=40 # like COLUMNS
# LISTMAX=0 # The number of matches to display without
# prompting. 0 means it only asks if it would
# go offscreen.
# Terminal Title
# If I'm using an xterm terminal, then I will display
# username@hostname: directory
# if I'm just running zsh, and I will display
# username@hostname (command): directory
# if I'm running another command (like vim).
case $TERM in
xterm*)
precmd () { print -Pn "\e]0;%n@%m: %~\a"}
preexec () { print -Pn "\e]0;%n@%m ($1): %~\a" }
;;
esac
# TODO: Make ls use the same color scheme as zsh.
# * For a description of how the LS_COLORS environment variable works, check out
# http://hintsforums.macworld.com/archive/index.php/t-46719.html
# * To see the ZSH colors, check out the Colored completion listings section of
# man zshmodules
# LS_COLORS=
# Help
# not used internally; just sets MANPATH
# manpath=($X11HOME/man /usr/man /usr/lang/man /usr/local/man)
# export MANPATH # path to look for man pages.
# export HELPDIR=/usr/local/lib/zsh/help # directory for run-help function to
# find docs
# Locale
# * Locale sets what your output should look like for pretty much everything.
# For instance, do you use commas or dots for numbers? do you use dollars or
# euros? Do you use only ascii or can you use UTF-8? English or Spanish?
# * The OS probably sets this to the correct value by default, so don't mess
# with this unless you are getting weird output.
# * If you're using putty, you'll also want to make sure that putty's
# window->translation is set to UTF-8.
# * LC_ALL sets the locale for everything.
# * LANG sets the locale for anything not set by an LC_something field
# * There are specific LC_ fields if you have a different locale for currency
# than for time, for instance. Check out man zshparam for the full list.
# export LC_ALL=en_US.UTF-8 # use US English encoded in UTF-8 as the
# default character encoding locale.
# Mail
# mailpath=(/var/spool/mail/$USERNAME) # array of files to check for mail.
# MAILCHECK=60 # Check for new mail every minute
# Paths
# cdpath=(.. ~ ~/src ~/zsh) # Search path for the cd command
# path=() # array to search for commands (binaries
# to run). Can use PATH instead.
# adds ~/bin to the end of path. Note
PATH=$PATH:~/bin # the use of the colon as a delimiter.
# Watch for Friends
# LOGCHECK=300 # check each 5min for friend login/logout
# WATCHFMT='%n %a %l from %m at %t.' # format of login/logout reports. See
# man zshparam for what this means.
# watch=(notme) # watch for everybody but me
# watch=( $(<~/.friends) ) # watch for people in .friends file
################################################################################
# ALIASES
################################################################################
alias mv='nocorrect mv' # no spelling correction on mv
alias cp='nocorrect cp' # no spelling correction on cp
alias mkdir='nocorrect mkdir' # no spelling correction on mkdir
# alias j=jobs
# alias pu=pushd
# alias po=popd
# alias d='dirs -v'
# alias h=history
# alias sudo='sudo ' # Normally, only the first word in a command is
# checked for aliases. A trailing space makes it
# check the next word. So, sudo works with
# aliases now. However, this causes other issues.
#alias grep='grep -P --color' # use Perl style regular expressions and colorize
alias chmud=chmod # chmud is a typo for chmod
# uname gives the name of the OS. Macs, which are BSD based, use -G rather than
# --color=auto. This lets us make ls pretty regardless of the OS. from
# http://superuser.com/questions/243338/how-should-i-automatically-change-my-zshrc-for-different-os
case `uname` in
Darwin) # Mac
alias ls='ls -FG'
;;
Linux)
alias ls='ls --color=auto'
;;
esac
alias dir=lsl
alias lsd='ls -d *(-/DN)' # list directories
alias lsh='ls -ld .*' # list hidden
alias :q='exit' # quit out of the shell like from vim
alias :Q='exit'
alias gdba='gdb --args' # call GDB with args automatically set
alias asdf='setxkbmap -model pc104 -layout us -variant dvorak' # asdf->dvorak
alias aoeu='setxkbmap -model pc104 -layout us' # aoeu->qwerty
#alias diff='diff -bBr' # ignore whitespace. ignore blank lines.
# recursively compare directories
alias hglu='hg log -r 0:' # hg log up. upside down. That way, even with
# many revisions, the most recent one is visible
alias sizeof='du -csh' # disk usage. Calculate the total; show only a
# summary and don't recursively print; print size
# in human readable format rather than in bytes
alias processes='echo "did you mean ps?"'
# Sleep so that hitting enter won't wake the screen. Then, turn off the screen
alias off='sleep 0.5 && xset dpms force off'
# if vim is installed, we probably never want to use vi
if [ `command -v vim` ]; then
alias vi=vim
fi
# if the editor is set to vim, then sudo vi should probably be sudo -e, which
# will read the vimrc even if sudo sets the $HOME variable to /root
# We can't do this with a normal alias because multiword aliases don't work: see
# http://superuser.com/questions/105375/bash-spaces-in-alias-name
sudo() {
# If my editor is vim and the first argument in my sudo command is vi or vim
if [[ $EDITOR == "vim" && ( $1 == "vim" || $1 == "vi" ) ]]; then
# $@ takes every argument. ${@[2,-1]} takes every argument starting with 2
# (array slices in ZSH work similar to Python, so -1 represents the last
# element). We want to turn "sudo vim foo bar baz" into "sudoedit foo bar
# baz", so going from 2 to the end is what we want.
command sudoedit "${@[2,-1]}"
else
# Otherwise, just do the sudo command normally
command sudo "$@"
fi
}
# Global aliases -- These do not have to be at the beginning of the command line
# That means that if you have these aliased characters anywhere, they will be
# replaced by zsh.
# alias -g M='|more'
# alias -g H='|head'
# alias -g T='|tail'
# Suffix Aliases -- run the command whenever the alias is a suffix
# From http://grml.org/zsh/zsh-lovers.html
# alias -s tex=vim #if I type foobar.tex, it will run the command
#vim foobar.tex
################################################################################
# KEYBINDINGS
# * Check out man zshzle for more information on key bindings and on the ZSH
# Line Editor.
# * bindkey -s in-string out-string
# when you type in-string, the line editor gets out-string
# * bindkey [-R] in-string command
# when you type in-string, command is run. -R means that in-string is
# treated as a range.
# * the man page lists plenty of escape sequences that you can run
# * you can use zle and vared for more advanced stuff. You can also develop
# your own widgets that mess with the line editor.
# * ZKBD also provides some nice functionality to check out.
# See http://zshwiki.org/home/zle/bindkeys
# * TODO: customize as desired
################################################################################
# CUSTOMIZE(shell-text-editor)
# Note: I type in vim, but I still prefer emacs style for the ZSH line editor.
# Usually, when I'm not in vim, I don't expect modal editing.
bindkey -e # emacs keymap
# bindkey -v # vim insert keymap
# bindkey -a # vim command keymap
# bindkey '^X^Z' universal-argument ' ' magic-space
# bindkey '^X^A' vi-find-prev-char-skip
# bindkey '^Xa' _expand_alias
# bindkey '^Z' accept-and-hold
# bindkey -s '\M-/' \\\\
# bindkey -s '\M-=' \|
# See http://zshwiki.org/home/zle/bindkeys
# We make a ZKBD compatible key hash, which we can use for binding special keys
# We don't need to do this for most keys because they work by default.
typeset -A key
key[PageUp]=${terminfo[kpp]}
key[PageDown]=${terminfo[knp]}
# Page Up and Page Down should go to the next and previous words
[[ -n "${key[PageUp]}" ]] && bindkey "${key[PageUp]}" vi-backward-blank-word
[[ -n "${key[PageDown]}" ]] && bindkey "${key[PageDown]}" vi-forward-blank-word
# Ctrl + Left and Right should do the same. terminfo doesn't know about control
# sequences, so we have to do this manually.
# TODO: is there a way to do this that's portable?
bindkey '[1;5D' vi-backward-blank-word
bindkey '[1;5C' vi-forward-blank-word
bindkey ' ' magic-space # also do history expansion on space
bindkey '^I' complete-word # complete on tab, leave expansion to _expand
################################################################################
# FUNCTIONS, EXTERNAL MODULES: SETUP
################################################################################
# Shell functions
setenv() { typeset -x "${1}${1:+=}${(@)argv[2,$#]}" } # csh compatibility
freload() { while (( $# )); do; unfunction $1; autoload -U $1; shift; done }
# Where to look for autoloaded function definitions
fpath=($fpath ~/.zfunc)
# Autoload all shell functions from all directories in $fpath (following
# symlinks) that have the executable bit on (the executable bit is not
# necessary, but gives you an easy way to stop the autoloading of a
# particular shell function). $fpath should not be empty for this to work.
for func in $^fpath/*(N-.x:t); autoload $func
# automatically remove duplicates from these arrays
typeset -U path cdpath fpath manpath
# Autoload zsh modules when they are referenced
# zmodload -a zsh/stat stat
# zmodload -a zsh/zpty zpty
# zmodload -a zsh/zprof zprof
# zmodload -ap zsh/mapfile mapfile
# within a script, $0 refers to the directory of the path of the script.
# dirname $0 will get the directory of the script.
#ZSHRC_DIR="$( dirname "$0" )"
ZSHRC_DIR=~/
# Use extra commands for hg and git
# we assume that the files will be in the same directory as .zshrc
# TODO: only source if found
#source $ZSHRC_DIR/.hg-commands-for-bash.bashrc
#source $ZSHRC_DIR/.git-commands-for-bash.bashrc
# Utility function to make random passwords
# from http://www.cyberciti.biz/faq/linux-random-password-generator/
genpasswd() {
local len=$1
if [[ $len == "" ]]; then
len=16
fi
tr -dc A-Za-z0-9_ < /dev/urandom | head -c ${len} | xargs
}
# Utility function to open the specified port
openport() {
echo sudo iptables -A INPUT -p tcp --dport $1 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport $1 -j ACCEPT
}
################################################################################
# From Ubuntu .bashrc
# TODO: move this into its own file
################################################################################
# if the command-not-found package is installed, use it
if [ -x /usr/lib/command-not-found -o -x /usr/share/command-not-found ]; then
function command_not_found_handler {
# check because c-n-f could've been removed in the meantime
if [ -x /usr/lib/command-not-found ]; then
/usr/bin/python /usr/lib/command-not-found -- $1
return $?
elif [ -x /usr/share/command-not-found ]; then
/usr/bin/python /usr/share/command-not-found -- $1
return $?
else
return 127
fi
}
fi
################################################################################
# SHELL COMMANDS TO RUN - these lines will be executed by zsh as if typed at
# the prompt. If you can't find the man page for a given command, that's
# probably because it's built in to the shell. In that case, you'll need to
# check out man zshbuiltins
################################################################################
# If messages are enabled with mesg y, then other people can message you using,
# for example, echo "Hey, Sam" | write samking would write "Hey, Sam" to my
# screen. This will work as a primitive chat feature. However, it also messes
# up your screen, so we disable it here.
mesg n
# Processes have resource limits, such as the number of file descriptors or the
# stack size. running unlimit with no arguments sets the resource limit for
# all resources to the hard limit. If you use -h, the hard limit is removed.
# if you use -s, the shell limit is removed.
# Check the description of limit in man zshbuiltins for a description of all
# resources that can be limited.
# It can be useful to use limits to prevent a buggy process from opening every
# file on the system or using all available memory with infinite recursion.
# You might want to unlimit everything because it's more annoying to have a
# program crash after running for an hour because it ran out of stack space than
# to run low on memory and manually kill a process. On the other hand, it is a
# good practice in general not to allow every program to use a ton of stack
# (especially in a multithreaded environment, for instance).
# unlimit
# Manually set the limits that we want
# limit stack 8192
# limit core 0
# umask says what permissions files have when they're created (ie, using touch
# or mkdir). If you use symbolic umask such as
# umask -S u=rw,g=r,o=r
# then you specify what IS allowed. In this example, the user can read and
# write, and group and other can read. Noone can execute.
# When you use octal notation such as
# umask 022
# then you specify what is not allowed. In this case, the group and others
# CANNOT write to newly created files by default.
# If you only want yourself to be able to do anything, you can
# umask 077
# to make it so that noone else has any permissions.
# Either way, your umask will mask against 666, which means that noone will
# have execute permission by default.
umask 022
################################################################################
# TEMPORARY - Commands used for a class or a summer that is not intrinsic to
# the overall functioning of the shell
################################################################################
################################################################################
# Customization by James Nam
# Git prompt (https://github.com/olivierverdier/zsh-git-prompt)
################################################################################
source ~/.dotfiles/zsh-git-prompt/zshrc.sh
PROMPT='%{$fg[yellow]%}%* %{$fg[red]%}%~%{$reset_color%}$(git_super_status) %# '
# GIT_PROMPT_EXECUTABLE="haskell"
################################################################################
# jenv setup (generated)
################################################################################
if [ -x "$(command -v jenv)" ]; then
eval export PATH="/Users/nchang/.jenv/shims:${PATH}"
export JENV_SHELL=zsh
export JENV_LOADED=1
unset JAVA_HOME
source '/usr/local/Cellar/jenv/0.5.4/libexec/libexec/../completions/jenv.zsh'
jenv rehash 2>/dev/null
jenv refresh-plugins
jenv() {
typeset command
command="$1"
if [ "$#" -gt 0 ]; then
shift
fi
case "$command" in
enable-plugin|rehash|shell|shell-options)
eval `jenv "sh-$command" "$@"`;;
*)
command jenv "$command" "$@";;
esac
}
fi
# auto ls after cd
function cd() {
builtin cd "$*" && ls
}
# Nick first add: some ITools aliases
alias grep='grep -In --color=auto'
alias fn='find . -name'
alias hlog='git log --date-order --all --graph --format="%C(green)%h %Creset%C(yellow)%an%Creset %C(blue bold)%ar%Creset %C(red bold)%d%Creset %s"'
alias xlog='git log --date-order --graph --format="%C(green)%h %Creset%C(yellow)%an%Creset %C(blue bold)%ar%Creset %C(red bold)%d%Creset %s"'
alias ~s='find . -name \*\~'
alias ~sr='find . -name \*\~ -delete'
alias gradle='./gradlew --parallel --daemon --configure-on-demand'
alias scpash="scp -o ProxyCommand='nc -x localhost:9098 %h %p' "
alias sftpash="sftp -o ProxyCommand='nc -x localhost:9098 %h %p' "
alias scpcrash="scp -o ProxyCommand='nc -x localhost:9099 %h %p' "
alias scpkeps="scp -o ProxyCommand='nc -x localhost:9101 %h %p' "
alias sftpcrash="sftp -o ProxyCommand='nc -x localhost:9099 %h %p' "
devReset() {
dev stop
dev rm -fv
dev up
}
command -v slslog > /dev/null && eval "$(slslog _completion --prog slslog)"
export GITHUB_TOKEN='4f47c70e14baf432ae5703ce0078503af6d84e7c'
# make a zsh alias for the git directory
git=/Volumes/git
echo ~git 2>&1 > /dev/null
export JAVA_1_6_HOME='/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home'
export JAVA_1_8_HOME='/Users/nchang/.gradle/caches/jdks/macosx/jdk1.8.0_212'
git_prune () {
git fetch --prune --all
git branch -vv | grep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn} ": gone" | awk '{print $1}' | xargs git branch -D
}
export PATH="/usr/local/opt/openjdk/bin:$PATH"