4 ms·
No galaxy brain here ;) I generally don't use counts. If I want to go down a few lines, I don't count the number of lines and use 4j or whatever, I instead use
by curriculum 5y ago
No galaxy brain here ;)
I generally don't use counts. If I want to go down a few lines, I don't count the number of lines and use 4j or whatever, I instead use / to search for the exact place I want to move to. This feels more natural and preserves the jump-list, so I can ctrl-o back to where I was.
Same if I want to delete a few words. I don't count how many I want to delete and do 4daw, instead I do daw and press . until I've deleted everything I want gone.
And I make heavy use of text objects when available. If I want to move to the next function, I use the keybinding for that instead of searching or counting lines.
- vulcan01 5y agoInstead of counting, you can use :set relativenumber (vim/neovim builtin) to quickly see how far away lines are. (see https://jeffkreeftmeijer.com/vim-number/ https://jeffkreeftmeijer.com/vim-number/)
- curriculum 5y agoIn my opinion the real downside of using <count>j and <count>k to move isn't the counting part, it's the fact that <count>k isn't a jump. That means it doesn't go into the jump list.
- tjdevries 5y agoYou can do something like this: ``` " Does: " For wrapped lines, does gj/gk " For large jumps, adds a spot on the jump list function! tj#jump_direction(letter) let jump_count = v:count if jump_count == 0 call execute(printf('normal! g%s', a:letter)) return endif if jump_count > 5 call execute("normal! m'") endif call execute(printf('normal! %d%s', jump_count, a:letter)) endfunction ``` and map j and k to this
- nobleach 5y agoI tried to get into that for awhile. I tend to look at the line number where I want to jump, and do <number>gg instead. It has the benefit of allowing me to look at a file and get an idea of what's on lines 400 through 425 (for example).
- bombela 5y agoTry the plugin easy motion. It changed my life.
- Jenk 5y ago+1 easy motion makes the default jump-by-search feel really clunky. Typically it is mapped to double-tap leader then object, and it will then highlight those objects with a short-code to jump right to it. Examples: \\w -> will highlight all words after \\b -> all words before \\e -> ends of words after \\ge -> ends of words before \\fe -> all occurences of the char 'e' after \\Fe -> 'e' before \\se -> 'e' in both directions \\j -> lines after \\k -> lines before etc. but can even use it with traditional search: \\n -> will highlight all search-matches found by a previous "/" or "?" search after current pos. \\N -> will highlight all search-matches before. mega useful.
- dundarious 5y agoFor me, learning about . was what made learning many of (neo)vim’s motions and text objects worthwhile. I use . constantly.
- anon946 5y agoI just use a fixed count, like 5j5j5j or whatever to get me close, then jjj or whatever.
- unrealhoang 5y agoI use ctrl + u/d to scroll up and down half screen to get near where I want to go.