Skip to content

Latest commit

 

History

History
136 lines (99 loc) · 4.85 KB

ZSH.md

File metadata and controls

136 lines (99 loc) · 4.85 KB

Zsh

You may put your custom settings into ~/.bash_extra.

Default settings

  • All settings are stored in .zshrc.
  • “Oh My ZSH!” is already built–in.
  • Vim is default editor.
  • Custom Zsh theme “Spaceship” with git status, nvm, venv and other.
  • Aliases may to be sudo’ed.
  • rm avoid stupidity. Аutomatically -I instead of -i, because it less intrusive than -i, while still giving protection against most mistakes.
  • And many other.

Projects tree

I suggest you to organize your project tree as follows:

Projects
├── _Forks          - here must be your forks
├── _Playground     - your playground for trying something
└── _Repo           - your repositories

Aliases

Aliases are the most important in dotfiles which can make your work fast and enjoyable. See code in zsh/aliases.zsh.

Easiest navigation

  • ..cd ..
  • ...cd ../..
  • ....cd ../../..
  • .....cd ../../../..
  • ~cd ~
  • -cd -

More aliases in oh-my-zsh Cheatsheet.

Folders shortcuts

  • drcd ~/Dropbox
  • dlcd ~/Downloads
  • dtcd ~/Desktop
  • pjcd ~/Projects
  • pjrcd ~/Projects/_Repos
  • pjfcd ~/Projects/_Forks
  • plcd ~/Projects/_Playground/

Commands Shortcuts

  • e$EDITOR
  • +xchmod +x
  • x+chmod +x
  • llls -alF
  • lals -A
  • lls -CF

Open

  • open <FILE> — Open file from terminal.
  • o <FILE> — Open file from terminal.
  • oo — Open current folder.

Clipboard tools

  • xcopyxclip -selection clipboard
  • xpastexclip -selection clipboard -o

Color conversion

  • hex2hsl <[#]dead00> [alpha] - Convert #hex color to HSL/HSLA. #dead00hsl(47,99%,44%).
  • hex2rgb <[#]dead00> [alpha] - Convert #hex color to RGB/RGBA. #dead00rgb(222,173,0).

Virtual Environment

  • venv - Activate virtual environment.
  • venv-stop - Deactivate virtual environment.
  • venv-initvenv-init3
  • venv-init2 - Initialize virtual environment with Python 2.
  • venv-init3 - Initialize virtual environment with Python 3.

Django

  • djmpython manage.py
  • djspython manage.py runserver
  • djm3python3 manage.py
  • djs3python3 manage.py runserver

Misc

  • update — Get Ubuntu Updates, and update npm and its installed packages.
  • alert — Throw alert notify message. Add an alert alias for long running commands. Use like so: sleep 10; alert.
  • myip — My IP address.
  • password — Generate random password, copies it into clipboard and outputs it to terminal.
  • path — Show $PATH in readable view.
  • dotfiles — Update dotfiles.
  • getpage — Download web page with all assets.
  • get — Download file with original filename.
  • battery — Battery status.
  • spaceship — Update the “Spaceship” theme.

Plugins

As default installed these plugins: git node npm nvm sudo web-search. These plugins add a lot of useful thing. Here are my favorites:

  • npmgnpm -g

  • npmSnpm i --save

  • npmDnpm i --save-dev

  • node-docs [SECTION] — Open the node api, for your current version, in your browser.

  • google [SEARCH_QUERY] — Search for [SEARCH_QUERY] on Google.

  • bing [SEARCH_QUERY] — Search for [SEARCH_QUERY] on Bing.

  • yahoo [SEARCH_QUERY] — Search for [SEARCH_QUERY] on Yahoo.

  • duckduckgo [SEARCH_QUERY] — Search for [SEARCH_QUERY] on DuckDuckGo.

  • Tab ESC twice — Puts sudo in front of the current command, or the last one if the command line is empty.

Bin

Some functions that will make your life easier. See code in bin/.

  • gz <FILE> — Get gzipped file size.
  • n <PROGRAM> — Runs given command using binary in node_modules/.bin of the current project.
  • server [PORT] — Start an HTTP server from a directory, optionally specifying the port (default: 8000).
  • extract <FILE> — Extract archives of various types. Supports types: tar.bz2, tar.gz, tar.xz, tar, tbz2, tgz, bz2, rar, gz, zi. , Z.
  • zsh_stats — Get zsh usage stats.
  • git-changelog — Generate changelog based on git commits.
  • git-fork <original-author> — Add remote upsteam.
  • git-upstream [branch] — Sync branch with upstream.
  • osx-shadow [-r|--rm] <original.png> [result.png] — Add (or remove) OSX-like shadow to image.
  • nyan — Print nyan cat.