About Me

My photo
i'm a laugning jack-o'-lantern

Friday, January 30, 2015

This is my Lightning talk at work about 'oh-my-zsh'

Introduction

Icon
oh-my-zsh is an open source community driven zsh configuration which I find very useful. It allows to reduce time spent in iTerm doing some routine tasks. My configuration could be found here:https://github.com/Valiev/config/blob/master/.zshrc

Installation

# clone
yum install zsh -y
git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc

Themes

Lots of themes could be found here: https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ATM, this one is my favorite:
ZSH_THEME="wezm"

Plugins

Most of plugins could be found here: https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins

osx

WIki page https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins#osx, not working in yosemite : (

sublime

st FILENAME # open a specified file in Sublime Text
stt # open the current directory in Sublime Text
stt FOLDER # open current and FOLDER in Sublime Text

extract

Adds extract command, which works with almost all archives.
% x                                     
Usage: extract [-option] [file ...]
Options:
    -r, --remove    Remove archive.
Report bugs to <sorin.ionescu@gmail.com>
# x is alias for extract
% x *.zip

colorize

colorize output (via pygmentize)
colorize solo.rb
colorize solo.json
colorize bamboo.log

sprunge

% ls -la | sprunge
Using input from a pipe or STDIN redirection...
http://sprunge.us/CPNX
% sprunge solo.json
Running interactively, checking for arguments...
Arguments present...
Uploading the contents of solo.json...
http://sprunge.us/TSAM

jsontools

% cat solo.rb | is_json                                              
false
% cat solo.json | is_json                                            
true
% cat solo.json | pp_json                                            
{
    "memory": {
        "total"4048
    }
}

brew

Adds autocompletion to brew command
% brew in                   
info     -- information about a formula
install  -- install a formula
% brew install zsh-                                                                                  
zsh-completions               zsh-history-substring-search  zsh-lovers                    zsh-syntax-highlighting

zsh-syntax-highlighting

zsh-syntax-highlighting highlights command line. It was installed via brew above. Need to configure it in ~/.zshrc
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern cursor)

gem

Bring gem autocompletion to your terminal
% gem
build           -- Build a gem from a gemspec
cert            -- Manage RubyGems certificates and signing settings
check           -- Check a gem repository for added or missing files
cleanup         -- Clean up old versions of installed gems in the local repository
contents        -- Display the contents of the installed gems
dependency      -- Show the dependencies of an installed gem
environment     -- Display information about the RubyGems environment
fetch           -- Download a gem and place it in the current directory
generate_index  -- Generates the index files for a gem server directory
help            -- Provide help on the `gem` command
install         -- Install a gem into the local repository
list            -- Display gems whose name starts with STRING
lock            -- Generate a lockdown list of gems
mirror          -- Mirror all gem files (requires rubygems-mirror)
outdated        -- Display all gems that need updates
owner           -- Manage gem owners on RubyGems.org.
pristine        -- Restores installed gems to pristine condition from files located in the gem cache
push            -- Push a gem up to RubyGems.org
query           -- Query gem information in local or remote repositories
rdoc            -- Generates RDoc for pre-installed gems
search          -- Display all gems whose name contains STRING
server          -- Documentation and gem repository HTTP server
sources         -- Manage the sources and cache file RubyGems uses to search for gems
specification   -- Display gem specification (in yaml)
stale           -- List gems along with access times
uninstall       -- Uninstall gems from the local repository
unpack          -- Unpack an installed gem to the current directory
update          -- Update installed gems to the latest version
which           -- Find the location of a library file you can require
yank            -- Remove a specific gem version release from RubyGems.org
% gem uninstall knife-b       
knife-block  knife-bulk

lol

lol - brings lulz to your zsh. Examples could be found here: https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/lol/lol.plugin.zsh
# Some aliases
alias wtf='dmesg'
alias onoz='cat /var/log/errors.log'
alias rtfm='man'
alias :3='echo'
alias visible='echo'
alias invisible='cat'
alias moar='more'
alias tldr='less'
alias alwayz='tail -f'

dirhistory

ALT-Right / ALT-Left to go throught "cd" history and jump 

autojump

Enables autojump
% brew install autojump
% j ids                            
/Users/valiev/dev/work/cookbooks/ids
% j mat              
/Users/valiev/dev/work/cookbooks/mat
% j Chef                 
/Users/valiev/dev/work/Chef
% j Chef data            
/Users/valiev/dev/work/Chef/data_bags

git

Git command autocompletion
➜  chef-ci-helpers git:(master) ✗ git b
bisect  -- find the change that introduced a bug
blame   -- blame file lines on commits
branch  -- create and show branches

Branches autocompletion
➜  chef-ci-helpers git:(master) ✗ git checkout 1.8.
1.8.0  1.8.1  1.8.2  1.8.3  1.8.4

knife

knife command autocompletion
(1.0-stable)⚡ % knife environment                                                                                                                                                                                   
create     delete     edit       from file  list       show

Integration with existing configuration (autocompletion):
(1.0-stable)⚡ % knife environment show CT-IDS-                                                                                                                                                                      
CT-IDS-1   CT-IDS-13  CT-IDS-14  CT-IDS-2   CT-IDS-20  CT-IDS-21  CT-IDS-22  CT-IDS-23  CT-IDS-24  CT-IDS-3   CT-IDS-4   CT-IDS-6

sudo

My lovely plugin!  ESC twice: Puts sudo in front of the current command, or the last one if the command line is empty.

No comments: