vim
🔗Quote/unquote words:
ciw'Ctrl+r"'
or
ciw '' Esc p
p
paste after the cursor, P
will paste before the cursor.
🔗Search matches (gn with the dot command)
Suppose that we have a document containing several occurrences of the word
‘Normal’ and we’d like to change each occurrence to ‘Visual’. We can run /Normal
to search for the word ‘Normal’, then type cgnVisual<Esc>
to change the next
match to the word ‘Visual’ and by pressing .
it will change the next match.
No need to use n.
(http://vimcasts.org/episodes/operating-on-search-matches-using-gn/)
🔗Habit breaking
Moving your Vim cursor around using the arrow keys is a bad habit, and like many bad habits it’s a difficult one to break! Putting these lines into your vimrc can help:
nnoremap <up> <nop>
nnoremap <down> <nop>
nnoremap <left> <nop>
nnoremap <right> <nop>
inoremap <up> <nop>
inoremap <down> <nop>
inoremap <left> <nop>
inoremap <right> <nop>
This snippet causes each of the arrow keys to execute no operation, or in other words: it disables them.
🔗Traversing test in insert mode
While in insert mode, use Ctrl-O
to go to normal mode for just one command
CTRL-o h move cursor left
CTRL-o l move cursor right
CTRL-o j move cursor down
CTRL-o k move cursor up
CTRL-w delete word to the left of cursor
CTRL-o D delete everything to the right of cursor
CTRL-u delete everything to the left of cursor
CTRL-h backspace/delete
CTRL-j insert newline (easier than reaching for the return key)
CTRL-t indent current line
CTRL-d un-indent current line
🔗vim + tmux layout
Screen shot while playing with immortal
![vim screen shot](/img/Screen Shot 2016-08-21 at 02.18.15.png)
No Axis