/_dotfiles

some useful .dotfiles

Primary LanguageShell

_dotflies 2.1.0

Magical Basic dotfiles for linuz && zsh.

Preview

System requirements:

For now only tested on archlinux/manjaro/Parrot security, cygwin and termux shells. But probably on other distros too.

Required packages:

Optional deps:

Installation:

via curl

curl -s -L "https://git.io/fNdqS" | zsh

This environment variables controls all things:

  • DOTDIR controls where to store dotfiles. (default - ~/.dotfiles)
  • DOTFILES_REPO controls where to fetch dotfiles repo. (default - github:$USER/_dotfiles)

Advanced Usage:

Start terminal -> tsr (aka restore (create/attach) tmux default session) -> You are ready!

This tools setup works almost perfectly for me as daily terminal abuser, git nerd and js/ruby (mostly, but not limited to) full stack web developer and security specialist. Feel free to add your own zsh scripts, just put whem into ~/.dotfiles/local/ dir. Useful for per machine configuration (env variables, credentials, hardware hacks, etc ...).

Features:

  • zsh is shell of choice.
  • tmux is multiplexor of choice. Mouse is on by default but tmux is configured to be mousless as possible.
  • Easy navigation via AUTO_CD zsh option && integrated wd. Wow, so much speed!
  • Alias all the things! (Over ~165 aliases for linux, git and other tools, see this for full reference)
  • Colorize all the things! Most usual terminal stuff (grep/ls/git/etc...) is colorized by default.
  • Mouse is aweful, so keybind as much as possible (see this for full reference).
  • Abuse zsh autocomplete as much as possible. Wow, so less typing, so much fun stuff (I mean, eh, productivity)!
  • Usefull toolbox of shell functions for any kind of common problems.
  • Smart defaults, full customization.

Keybindings:

ZSH

zsh uses emacs keybindings by default with addition of following:

  • [Ctrl+Left/Right Arrow] - Move backward/forward by word.
  • [Home/End] - Move to beginning/end of line.
  • [Ctrl+W] - Delete word backward.
  • [ESC+W] - Delete from cursor backward
  • [ESC+Q] - Cut line and insert it as next command.
  • [ESC+R] - Reload zsh config.
  • [Up/Down] - Search history backward/forward.

tmux

tmux is configured to enter copy mode by mouse scrolling.

  • [Ctrl+B] - Send prefix.
  • [Shift+Down] - New window with current path.
  • [Shift+Left/Right] - Select previous/next window.
  • [Prefix, 1-9] - Select 1-9 window.
  • [Ctrl+Shift+Left/Right] - Move current window back/forward.
  • [Alt+Direction] - Select pane in direction.
  • [Prefix, |] - Split panes horizontaly (with current path).
  • [Prefix, -] - Split panes verticaly (with current path).

Aliases

* means global.

Generic Linux stuff:

  • [...] - Cd 2 dirs back.
  • [....] - Cd 3 dirs back.
  • [G]* - | grep.
  • [L]* - less.
  • [duh] - du -h (Disc usage, huminized).
  • [duhs] - du -sh (Disc usage, hummanized, summarize).
  • [wcl] - wc -l (How many sweet aliases I have? alias | wcl).
  • [ll] ls -lAhF (ls all as list for humans).
  • [nuke] - rm -rf( 🌇 ).
  • [sa] - alias | grep (search aliases with ez)

Ruby/Rails stuff:

  • [b] - bundle(r).

  • [bu] - bundle update --conservative.

  • [be] - bundle exec.

  • [cov] - Show coverage in default browser simplecov gem.

  • [r] - rbenv. (Because one ruby just isn't enought!)

  • [ri] - rbenv install.

  • [rl] - rbenv versions.

  • [rlk] - rbenv install --list

  • [rd!] - rbenv uninstall.

  • [ru] - rbenv local.

  • [ru!] - rbenv global.

  • [rs] - rails server.

  • [rc] - rails console.

  • [rr] - rails routes.

  • [rdm] - rails db:migrate. (Keep your DB up to date)

  • [rgm] - rails generate migration.

  • [rgi] - gem install.

  • [rgl] - gem list.

  • [rtc] - rails tmp:cache:clear && rs.

  • [prconf] - ved ~/.pryrc.

  • [prh] - ved ~/.pry_history.

  • [tt] - bundle exec rspec.

  • [dbup] - rake db:create db:migrate db:seed.

  • [dbup!] - rake db:drop db:create db:migrate db:seed.

  • [localize GEM_NAME] - replace GEM_NAME with local copy ($LOCALIZED_GEM_PREFIX(default: ~/projects/)).

  • [delocalize GEM_NAME] - return localized GEM_NAME to normal remote fetching.

Git stuff:

  • [mt]* - master (your know, THAT branch).
  • [h1,h2,..,h10]* - HEAD~1-10, Allows to quickly dig up to 10 levels of commits from HEAD.
  • [hd]* - HEAD (Where is my head)
  • [ga] - git add (you know, adds your stuff to index).
  • [gaa] - git add .; git status -s (add all changed stuff, show stuff in staging area)
  • [gae] - git add -e (when simple git add just isn't enough).
  • [gb] - git --no-pager branch (I'm groot!).
  • [gbc] - git branch -c.
  • [gbc!] - git branch -C.
  • [gbl] - gb -l (Show me my roots!).
  • [gbm] - git branch -m.
  • [gbm!] - git branch -M.
  • [gbr] - git branch -.
  • [gbr!] - git branch -D.
  • [gbum] - git branch --no-merged=master.
  • [gc] - git checkout.
  • [gcb] - git checkout -b.
  • [gcf] - git_checkout_feature.
  • [gcl] - Clones repo and cd's into it.
  • [gcm] - git commit -m.
  • [gcma] - git commit -am.
  • [gcmt] - git checkout master.
  • [gcp] - git cherry-pick. (:cherries:)
  • [gct] - git checkout --track.
  • [gd] - git diff --color.
  • [gdc] - git diff --color --cached HEAD.
  • [gf] - git fetch.
  • [gfix] - git add . ; git commit --amend.
  • [glog] - Pretty git logs.
  • [gpush] - Push current branch to origin.
  • [gpush!] - Same as above but with force.
  • [grb] - git rebase. (Use with care)
  • [grba] - git rebase --abort.
  • [grbc] - git rebase --continue.
  • [grbi] - git rebase -i.
  • [grbs] - git rebase --skip.
  • [gref] - git pull -r origin master.
  • [grl] - git reflog. (In case of REAL emergency)
  • [grm] - git remote.
  • [grma] - git remote add.
  • [grmd] - git remote remove.
  • [grmr] - git remote rename.
  • [grmu] - git remote get-url.
  • [grmu!] - git remote set-url.
  • [grmv] - git remote -v.
  • [grt] - git reset.
  • [grt!] - git reset --hard
  • [gsa] - git stash apply.
  • [gsl] - git stash list.
  • [gsd] - git stash drop.
  • [gss] - git stash save -u.
  • [gsh] - git show.
  • [gst] - git status -s.
  • [gwip] - Add all files to index and commit them with temp name. Usefull for fast branch switching.

Archlinux stuff (pacman):

  • [pacl] - pacman -Q <package_name>. (Get stuff in)
  • [pacl!] - pacman -Qent - Show all explicitly installed packages.
  • [pacr] - sudo pacman -R <package_name>. (Get 💩 out)
  • [pacs] - pacman -Qo . Search for package owns a file at .

Systemd stuff:

  • [sc] - sudo systemctl (to ctrl 'em all!).
  • [scdn] - sudo systemctl stop (Just die).
  • [scdn!] - sudo systemctl disable. (...and stay dead).
  • [scr] - sudo systemctl restart. (rebirth!)
  • [scs] - sudo systemctl status. (sup?)
  • [scup] - sudo systemctl start. (Rise and shine)
  • [scup!] - sudo systemctl enable. (...and stay up)

Tmux Stuff:

  • [tconf] - ed ~/.tmux.conf (open tmux config file in editor)
  • [tref] - tmux source-file ~/.tmux.conf.
  • [tsr] - restore.

WD stuff:

  • [wp] - wd (aka warp directory).
  • [wpa] - wd add (add current dir as waypoint named )
  • [wpl] - wd list (lists all known waypoints)
  • [wpr] - wd rm (remove waypoint named )

zsh stuff

  • [zref] - source ~/.zshrc.
  • [zref!] - source ~/.zshrc; clear.
  • [zha] - archivates current history file for ZSH.

ssh stuff

  • [ssg] - generate new 4096 RSA keypair.
  • [ssc] - copy open key to clipboard.
  • [sscp] - ssh-copy-id

Variables

This environment variables controls most customizable apps. To take effect just place them under in init.zsh file under you $DOTDIR.

  • $EDITOR - terminal text editor (default: nano).
  • $VISUAL - GUI text editor (default: atom).
  • $BROWSER - GUI web browser (default: firefox)
  • $GIT_EDITOR - (default: nano)

Functions

  • callable $1 - Is $1 is available on my mashine?
  • peek - Smart FS lookup utility.
  • serve - File serve from current directory using ruby.