http://github.com/javiacei/developing-in-a-black-hole http://github.com/javiacei/dotfiles
Vim, Vi IMproved, is a power open-source text editor
- Awesome documentation (:help)
- Huge community
- Extensible, customizable and portable
- Normal
esc
- Visual
v
- Insert
i
- Command-line
:!
- Movement keys:
h
,j
,k
,l
- Forward, back:
w
,b
- Move multiplier
<number><movement>
- Go to the beginning of current line
0
and to the end$
- Go to the beginning of the file
gg
and to the endG
- Go to line
:<linea>
# Example
from django.db import models
class Vehicle(models.Model):
mma = models.DecimalField(max_digits=10, decimal_places=2, null=True)
length = models.DecimalField(max_digits=10, decimal_places=2, null=True)
model = models.CharField(max_length=200, null=True, blank=True)
- Insert at the end of the current line
A
- Add a new line below
o
and aboveO
- Change text
c + <movement>
- Copy
y + <movement>
and pastep
- Delete
d + <movement>
- Undo
u
and redoc-r
- Autocomplete
c-n
- Repeat the last executed command
.
# Example
from django.db import models
class Vehicle(models.Model):
mma = models.DecimalField(max_digits=10, decimal_places=2, null=True)
length = models.DecimalField(max_digits=10, decimal_places=2, null=True)
model = models.CharField(max_length=200, null=True, blank=True)
- Search inside current line
f<character>
(forward),F<character>
(back) - Search inside current file
/
- Search selected word
*
- Search and replace
:%s/<search>/<replace>
# Example
from django.db import models
class Vehicle(models.Model):
mma = models.DecimalField(max_digits=10, decimal_places=2, null=True)
length = models.DecimalField(max_digits=10, decimal_places=2, null=True)
model = models.CharField(max_length=200, null=True, blank=True)
- In visual mode
v
- Block selection
c-v
# Example
from django.db import models
class Incident(models.Model):
INCIDENT_ACTIONS = (
(ASSIGN_DRIVER, 'Assign driver'),
(UNASSIGN_DRIVER, 'Unassign driver'),
(UPLOAD_CARGO_MANIFEST, 'Upload cargo manifest'),
(DELETE_CARGO_MANIFEST, 'Delete cargo manifest'),
)
action = models.CharField(max_length=30, choices=INCIDENT_ACTIONS, default=ACTION_OTHER)
- Create a new macro
q + <macro register>
- Apply macro
@ + <macro>
# Example
from django.db import models
class Incident(models.Model):
INCIDENT_ACTIONS = (
(ASSIGN_DRIVER, 'Assign driver'),
(UNASSIGN_DRIVER, 'Unassign driver'),
(UPLOAD_CARGO_MANIFEST, 'Upload cargo manifest'),
(DELETE_CARGO_MANIFEST, 'Delete cargo manifest'),
)
action = models.CharField(max_length=30, choices=INCIDENT_ACTIONS, default=ACTION_OTHER)
- Execute vim functions with
:
:write
, :w,:quit
,:q
,:edit
,:e
- Execute command line
:!
- Horizontal
:split
:sp
and vertical:vsplit
:vsp
panels - Tabs
:tabe
. Navigate withgt
andGt
- vundle
- nerdtree
- ctrlp
- ack
- vim-tmux-navigator
- vim-snippets
- vim-flake8
- vim-numbertoggle
- Learn to speak Vim (see resources)
- Create your own configuration
- Search and try plugins, but ...
- Install those you are going to use
- Keep calm and be patient
tmux is a client-server terminal multiplexer that lets you switch between several programs in one terminal.
- Create windows
<leader> + c
- Rename windows
<leader> + ,
- Navigate between windows
<leader> + w
,<leader> + number
- Create horizontal
<leader> + -
and vertical<leader> + |
panels - Resize panel
<leader> + L
and<leader> + H
- Remove panel
<leader> + x
- Zoom panel
<leader> + z
- Navigation
<leader> + q
and like vim usingvim-tmux-navigator
- Enter in navigation mode
<leader> + [
- Same vim commands to navigate
- Search
/
and navigate between searchesn
yN
- Panels syncronization
<leader> + :
and set property:setw synchronize-panes
- Create a named session in detached mode
tmux new-session -s pair -d
- Connect to a named session
tmux attach-session -t pair
- Change tmux leader to
c-a
mappingcaps lock
key tocontrol
- Configure your own tmux in
~/.tmux.conf
- Use and configure vim-tmux-navigator
Command line HTTP client to make interaction with web services as human-friendly as possible
- Command
http
to make requests - JSON highlighting
- Provide query params
==
- JSON by default
=
,:=
,@=
- Set headers
Header:Value
- Sessions
Using curl ...
curl -X POST
-H "Accept: application/json"
-H "Content-type: application/json"
-d '{"grant_type":"password","client_id":"<client_id>","username":"","password":""}' \
curl
-H "Accept: application/json"
-H "Content-type: application/json"
-H "Authorization: Bearer " \
http POST grant_type=password client_id=<client_id> username= password= http "authorization: Bearer " (and with --session= to save the session)
jq is a command line JSON processor
- Simple syntax
- JSON highlighting
- Lots of pipe filters
jq '(.results | limit(3;.[]) | [.origin, .destination] | join(" -> "))'
Francisco Javier Aceituno [email protected] http://github.com/javiacei
Software Engineer in OnTruck
We will move 1.000.000 trucks with python, join us! [email protected]