4 ms·
> single keystroke could move the cursor halfway across the file to exactly the right spot. sorry what is this? exaggeration?
by swyx 9mo ago
> single keystroke could move the cursor halfway across the file to exactly the right spot.
sorry what is this? exaggeration?
- astrobe_ 9mo agoNope! "G" moves the cursor to the end of the file. Very useful. Inferior editors have ctrl-end or alt-end, but with Vim, 90% of your lazy fingers stay on the home row!
- Izkata 9mo agoAlso H, M, and L for high/middle/low of the lines currently visible on the screen.
- deleted 9mo ago[deleted]
- massysett 9mo agoThen there’s Emacs, where Meta - > takes three fingers!
- schemathings 9mo agoI find myself using '' as a builtin bookmark to go back to my previous spot when I use G, like gg=G'' to apply code formatting for the whole file then return to my spot.
- GrowingSideways 9mo agoYes, it's exaggeration. Modal editing cannot read your mind.
- tuan 9mo agoI can see how that could work depends on the setup and the context. For example: People might use `. to jump to the last edit, or to a mark they set manually. Or simply `ciq` to edit inside the next quote without any manual cursor movements. I see people use plugin like harpoon to jump to their favorite location quickly. If you don't know about such setup, seeing people type <leader>1 to jump not just within a file, but across files, seems magical.
- Izkata 9mo agoCapital letters for marks work across files without plugins.
- TonyStr 9mo agoDont forget `*` and `#`. Idk if other editors have this now, but before learning vim, I used to ctrl+shift+arrow_keys to select a word, ctrl+c, ctrl+f, ctrl+v, Enter in order to move around in code. Discovering `*` and `#` in vim was mindblowing
- lelanthran 9mo ago>> single keystroke could move the cursor halfway across the file to exactly the right spot. > sorry what is this? exaggeration? It is indeed. I need two keystrokes to move from an arbitrary positions in an arbitrarily long file to the exact spot I need to be. I use it all the time, in fact. Multiple times an hour. It's muscle memory now for me, while reading/navigating code, to automatically do `ma` or `mb` etc. At some later point I realise "let me read the function definition again" and then I do `'a` or `'b`, etc.
- tuan 9mo agoif someone really want to have single keystroke, there's always F<number> key that they can map to their frequently used movements, such as last edit, next function, special marker (such as `m`), etc.
- slim 9mo agoThis can happen if you hit * when cursor is on say a function name. it gets you to the next occurance of that word. very useful