Vim - Putting arrows to use
codingfearlessly.com
codingfearlessly.com
The following made me considerably faster:
* Relative Line numbering (For Vim 7.3). G/gg stop being convenient for frequent line movement once your file goes beyond 100 lines. Doing math in your head to figure out if line 589 is 16 lines from 605 takes way too much effort. Append this[0] to your ~/.vimrc, and then CTRL-l will toggle relative/absolute line numbering. So in relative mode, you see a line is 20 up from your cursor, and 20k takes you there with no guessing or holding down keys.
[0]: https://gist.github.com/3418841
* Learn the following: f,F,t,T. Combine them with c and d.
* zz => make current line appear in middle of the screen.
* H,L,M
* w,W,b,B. Combine with numeric modifiers (5dW)
* CTRL-u, CTRL-d, CTRL-f, CTRL-b
* % for block highlighting. Works well with curly braces by default, you may need to pick up extra plugins for ruby/python.
* g; will cycle back to the last places you were in insert mode. g, will cycle forward.
set scrolloff=5
with which i always have 5 lines context below and above the cursor.
The main problem is how it replaces the letter I'm searching with another unrelated one, making all the matches practically unreadable. To me, at least.
set incsearch
and /foo
?bar
are more than enough for my needs.EasyMotion is not for searching, it's for moving the cursor deliberately to a place onscreen where you need to make an edit.
Searching is how I move to where I want.
It's a lot less confusing to me than EasyMotion's logic, it's consistent whether the word I want to jump to is visible or not and it's a native feature.
Well, I was curious when it was released so I've used it for a couple of weeks and found it horrible and confusing. Obviously many people like it so let's say it's a matter of taste.
Any ideas?
Also note: I am not a touch typist.
" up/down move between visual lines
" instead of actual lines when wrapped
imap <silent> <Down> <C-o>gj
imap <silent> <Up> <C-o>gk
nmap <silent> <Down> gj
nmap <silent> <Up> gk
(You could also map j/k to just do this if it's something you use often, but I prefer not to.)kj is rarely used in a word, and when it is it isn't a big deal.
inoremap kj <Esc>
(not to be misunderstood, i use mostly hjkl and ctrl-d and ctrl-u (half-screen up and down). and i find the mouse uncomfortable.)
Often switching mode to move around is just more effort than moving my hand a little, at least on the laptops I've used lately.
Well, technically it is. But don't think of it as one.
The hjkl keys are fine to use when in Vim, but the majority of other products (browsers, word processors, spreadsheets, etc) don't support them for movement. So I have a constant context-switch in my muscle memory when moving between these different applications.
On a Mac keyboard, I find arrow-key navigation with my pinky finger very efficient… only requiring the rest of my fingers to move from the home row when pressing right.
I'm not sure this would work for everyone… but for me, one set of muscle memory is superior to convincing my nervous system to context-switch.
Also I'm curious about this quote from OP:
I just might remap hjkl to split navigation,
because I use hjkl less and less, favoring
navigating in other ways. Sounds crazy, I know ;)
Can you elaborate on your habits that cause it?With arrows: <LEFT><LEFT>x<RIGHT>
Without arrows: <ESC>hix<ESC>lli
It also much depends on a keyboard design, the laptop-like often have arrows under ENTER and using them doesn't require hand movement.
(I'm assuming your situation is a typo while you're inserting a short string, rather than just defaulting to insert mode)
Now I've got my arrow keys mapped to Nop in all modes except I mapped my right key to autocomplete in insert mode, which has worked pretty well for the last 10 minutes. I'd really like to start using autocomplete more, so for me it's handier than text moving.
nnoremap ¬ <C-w>l
nnoremap ˙ <C-w>h
nnoremap ˚ <C-w>k
nnoremap ∆ <C-w>j
(Mac :P)