Permalink
Browse files

Format helpful tips.

  • Loading branch information...
1 parent 1c49ff8 commit 605dc9950671076b567e95cc582ff06ebe92effd @gabebw committed Oct 2, 2012
Showing with 104 additions and 112 deletions.
  1. +2 −1 helpful-tips/{osx → osx.md}
  2. 0 helpful-tips/{vim → vim.txt}
  3. +0 −111 helpful-tips/zsh
  4. +102 −0 helpful-tips/zsh.md
View
3 helpful-tips/osx → helpful-tips/osx.md
@@ -1,2 +1,3 @@
How do I get a copy-and-pasteable version of my Macbook's serial number?
-ioreg -l | grep IOPlatformSerialNumber
+
+ ioreg -l | grep IOPlatformSerialNumber
View
0 helpful-tips/vim → helpful-tips/vim.txt
File renamed without changes.
View
111 helpful-tips/zsh
@@ -1,111 +0,0 @@
-How do I change my shell to ZSH?
-chsh -s /bin/zsh
-
-Where can I find awesome 'zshrc's?
-http://dotfiles.org/.zshrc (and check out the rest of the site too)
-
-Search backward through history: Ctrl-R
-
-Modify the most recent command: r search=replace
- i.e., $ mkdir my_dir
- $ r mkdir=cd # this runs "cd my_dir"
-
-Open an editor ($EDITOR) to edit the last command: fc
-
-Print an ASCII calendar: cal or ncal
-
-hashing: hash -d HASH=directory, then "cd ~HASH"
-- Do not use ~ in the directory, either. Use /Users/gabe/.
-- more info: http://michael-prokop.at/blog/2008/12/01/mikas-advent-calendar-day-1/
-
-How do I unset a function?
-unfunction <function-name>
-
-How do I do a named hexdump, with "nul" instead of hexdump -C's "0"?
-od -a (and check out `man od`)
-
-How do I re-initialize my PATH, so that newly-installed programs show up for autocomplete?
-`export PATH=$PATH`, or as a function: function reinitialize { export
- PATH=$PATH }.
- You can also use an alias, though I'd recommend against it: `alias
- reinitialize="export PATH=$PATH". The alias will be expanded when you source
- the file with the alias, but in this case that doesn't matter since you want
- to set it to that same value anyway. Of course, if you've modified your
- path since that source time, then the alias will remove those modifications.
- *** Long story short: go with the function. ***
-
-## COMPLETION
-How do I make compinit (autoload compinit && compinit) find the directory where I store my completion scripts?
-compinit searches the $fpath array of directories. Simply add your directory via:
- fpath=(/my/completion/directory $fpath)
-
-How do I complete $cmd_1 like $cmd_2?
-`compdef viw=which` completes the "viw" command like "which"
-
-## zstyle
-How do I delete all zstyle settings?
-zstyle -d
-For more on style: http://zsh.sourceforge.net/Doc/Release/zsh_21.html#SEC182
-
-## OPTIONS (setopt/unsetopt)
-correct: correct commands
-correctall: correct commmands AND arguments
-hist_reduce_blanks: Removes meaningless whitespace in previous commands, so
- "echo 'asdf 1234' " shows up as "echo 'asdf 1234'" when you press <UP> to
- go back in history
-setopt hist_ignore_all_dups: don't store repeated commands
-setopt autocd: type a directory name to cd to it, no need to type out "cd"
-setopt prompt_subst: allow commands in prompt, so you can do
- PS1="%{my_function%}" and it'll work.
-
-## ZSH Variables
-SAVEHIST: The maximum number of history events to save in the history file.
-HISTSIZE: The maximum number of events stored in the internal history list. If
- you use the HIST_EXPIRE_DUPS_FIRST option, setting this value larger than
- the SAVEHIST size will give you the difference as a cushion for saving
- duplicated history events. (i.e., SAVEHIST will then be the number of unique
- events to save)
-
-## VCS info (mostly git)
-# this is helpful: http://kriener.org/articles/2009/06/04/zsh-prompt-magic
-First: autoload -Uz vcs_info
-# zstyle settings
-# http://zsh.sourceforge.net/Doc/Release/User-Contributions.html#SEC273
-# :vcs_info:<vcs-string>:<user-context>:<repo-root-name>
-# <vcs-string>: one of: git, svn, cvs, etc.
-# <user-context>: a freely configurable string, assignable by the user as
-# the first argument to vcs_info.
-# <repo-root-name>: the name of a repository in which you want a style to
-# match. So, if you want a setting specific to
-# /usr/src/zsh, with that being a cvs checkout, you can
-# set <repo-root-name> to zsh to make it so.
-## set formats:
-# In normal formats and actionformats:
-# %s - vcs in use (git, svn, etc)
-# %b - info about current branch
-# %a -
-# %b - branchname
-# %u - unstagedstr (see below)
-# %c - stagedstr (see below)
-# %a - action (e.g. rebase-i) [only makes sense in actionformats]
-# %R - base dir of repository
-# %r - repository name. If %R is /foo/bar/repoXY, %r is repoXY.
-# %S - path in the repository. If $PWD is /foo/bar/reposXY/beer/tasty,
-# %S is "beer/tasty".
-# - you probably want %R/%S -> "~/repo/subdir"
-# In branchformat:
-# %b - the branch name
-# %r - the current revision number
-## colors as %F{n}: (advantage of not needing %{...%}
-# 1: red (%F{1})
-# 2: green
-# 3: yellow
-# 4: blue
-# 5: purple
-# 6: cyan
-# 7: gray
-# 8: black
-# %f: reset color
-
-How do I enable specific VCSes?
-zstyle ':vcs_info:*' enable git hg # disables all other VCSes
View
102 helpful-tips/zsh.md
@@ -0,0 +1,102 @@
+How do I change my shell to ZSH?
+
+ chsh -s /bin/zsh
+
+Where can I find awesome 'zshrc's?
+
+http://dotfiles.org/.zshrc (and check out the rest of the site too)
+
+Search backward through history: Ctrl-R
+
+Modify the most recent command:
+
+ r search=replace
+ # example
+ $ mkdir my_dir
+ $ r mkdir=cd # this runs "cd my_dir"
+
+Open an editor ($EDITOR) to edit the last command:
+
+ fc
+
+Print an ASCII calendar:
+
+ cal # or ncal
+
+hashing: hash -d HASH=directory, then "cd ~HASH"
+- Do not use ~ in the directory, either. Use /Users/gabe/.
+- more info: http://michael-prokop.at/blog/2008/12/01/mikas-advent-calendar-day-1/
+
+How do I unset a function?
+
+ unfunction <function-name>
+
+How do I do a named hexdump, with "nul" instead of hexdump -C's "0"?
+
+ # Also: man od
+ od -a
+
+How do I re-initialize my PATH, so that newly-installed programs show up for autocomplete?
+
+ export PATH=$PATH
+ # as a function
+ function reinitialize { export PATH=$PATH }
+
+
+You can also use an alias, though I'd recommend against it: `alias
+reinitialize="export PATH=$PATH"`. The alias will be expanded when you source
+the file with the alias, but in this case that doesn't matter since you want
+to set it to that same value anyway. Of course, if you've modified your
+path since that source time, then the alias will remove those modifications.
+Long story short: go with the function.
+
+## Completion
+How do I make compinit (`autoload compinit && compinit`) find the directory where I store my completion scripts?
+compinit searches the $fpath array of directories. Simply add your directory via:
+
+ fpath=(/my/completion/directory $fpath)
+
+How do I complete $cmd_1 like $cmd_2?
+
+ # complete `g` like `git`
+ compdef g=git
+
+## zstyle
+
+How do I delete all zstyle settings?
+
+ zstyle -d
+
+For more on style, see [the ZSH docs](http://zsh.sourceforge.net/Doc/Release/zsh_21.html#SEC182).
+
+## Options
+
+Use via e.g. `setopt correct` or `unsetopt correct`
+
+`correct`: correct commands
+`correctall`: correct commmands AND arguments
+`hist_reduce_blanks`: Removes meaningless whitespace in previous commands, so
+ `echo 'asdf 1234' ` shows up as `echo 'asdf 1234'` when you press <UP> to
+ go back in history
+`hist_ignore_all_dups`: don't store repeated commands
+`autocd`: type a directory name to cd to it, no need to type out "cd"
+`prompt_subst`: allow commands in prompt, so you can do
+ PS1="%{my_function%}" and it'll work.
+
+## ZSH Variables
+
+`SAVEHIST`: The maximum number of history events to save in the history file.
+`HISTSIZE`: The maximum number of events stored in the internal history list. If
+ you use the HIST_EXPIRE_DUPS_FIRST option, setting this value larger than
+ the SAVEHIST size will give you the difference as a cushion for saving
+ duplicated history events. (i.e., SAVEHIST will then be the number of unique
+ events to save)
+
+## VCS info (mostly git)
+
+First do `autoload -Uz vcs_info`.
+
+Try these articles:
+
+* http://zsh.sourceforge.net/Doc/Release/User-Contributions.html#Version-Control-Information
+* http://kriener.org/articles/2009/06/04/zsh-prompt-magic

0 comments on commit 605dc99

Please sign in to comment.