unix is my ide

29
Unix is my IDE Tomáš Kramár, @tkramar

Upload: tkramar

Post on 15-Jan-2015

4.499 views

Category:

Technology


0 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Unix is my IDE

Unix is my IDETomáš Kramár, @tkramar

Page 2: Unix is my IDE
Page 3: Unix is my IDE
Page 4: Unix is my IDE

Integrated Development EnvironmentThe primary rationale for using an IDE is that it gathers all your tools in the same place, and you can use them in concert with roughly the same user interface paradigm, and without having to exert too much effort to make separate applications cooperate.

Page 5: Unix is my IDE

Using UNIX as IDE● Shell tips● ZSH● Moving around● Terminal multiplexor● Composing commands● Customizing applications

Page 6: Unix is my IDE

Shell tips

Page 7: Unix is my IDE

#1 I need to run a long command I ran previouslyWrong:● lookup the parameters and type it all again● <up> <up> <up> ....● grep .bash_history

Good:● <c-r>, start typing, <c-r> to scroll results

Page 8: Unix is my IDE

#2 Oops, I made a typoWrong● <left> <left> <backspace> <backspace> ....Good● <c-u> - deletes from cursor to the beginning● <c-k> - deletes from cursor to the end● <c-w> - deletes word before cursor● <c-a> - move to the beginning● <c-e> - move to the endBetter● use vi-mode

Page 9: Unix is my IDE

#3 I need to switch to a different applicatione.g., I am in vim and want to try something in irb

Wrong:● open new terminal window

Good● <c-z> to suspend● fg to resume

Page 10: Unix is my IDE

#4 I need to disconnect from remote machineWrong● Ok, I'll wait

Good● <c-z> to suspend● bg to run in background● disown to ignore SIGHUP

Page 11: Unix is my IDE

#5 I forgot sudoWrong● <up> <c-a> sudo <cr>

Good● sudo !!● !! is alias for last command

Better● Custom keybinding that inserts sudo

Page 12: Unix is my IDE

#6 I want to change this file's extensionWrong● cp /opt/nginx/conf/nginx.conf

/opt/nginx/conf/nginx.conf.bak

Good● cp /opt/nginx/conf/nginx.conf{,.bak}

Page 13: Unix is my IDE

#7 I want to exit the shellWrong● type 'exit'● click close button

Good● <c-d>

Page 14: Unix is my IDE

Keybindings work everywhere (readline).● mysql● psql● irb● ..● even browser's textarea

Page 15: Unix is my IDE

ZSH

Page 16: Unix is my IDE

Features● Autocompletion menu● Autocomplete everything

○ command line parameters○ remote servers○ remote filesystems○ context-sensitive completion (e.g., dvips, git)○ kill

● Fuzzy autocompletion● Globbing

○ ls **/*.txt

Page 17: Unix is my IDE

Moving around

Page 18: Unix is my IDE

Stupid tricks● autocomplete● "cd" (no args) back to home● "cd -" back to previous directory

Page 19: Unix is my IDE

Use the dirstack● dirs -v● pushd/popd

Or

● setopt auto_pushd● cd +3

Page 20: Unix is my IDE

Ranger● https://github.com/hut/ranger● OSX Finder \w vim keybindings● Integrates with shell easily

Page 21: Unix is my IDE

Terminal multiplexor

Page 22: Unix is my IDE

tmux● multiplexes several virtual terminals● sessions/windows● tile management

Page 23: Unix is my IDE

Composing commands

Page 24: Unix is my IDE

How do you identify your largest files?

Page 25: Unix is my IDE

How do you identify your largest files?

wc -l **/*.rb | tac | tail -n +2 | sort -n -r | head -10

Page 26: Unix is my IDE

Customizing applications

Page 27: Unix is my IDE

Embrace aliasesalias grep="grep --color=auto"alias lsa="ls -AahXBFov --color=auto --indicator-style=file-type --group-directories-first"

alias pacman="sudo pacman"

Application level aliases● git la

Page 28: Unix is my IDE

dotfiles● Most applications are configurable in plain

text○ .vimrc, .zshrc, .ranger, .rvm, .ssh ...○ Transfer between machines, backup, restore

Page 29: Unix is my IDE

Resources● http://dotfiles.github.com/● https://github.com/kremso/dotfiles

● https://github.com/robbyrussell/oh-my-zsh