-- Leo's gemini proxy

-- Connecting to blog.schmidhuberj.de:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

Does vim have an issue with movement?

Posted on 2022-11-09


Probably all [neo]vim (in the following just abbreviated to vim) users know that hjkl is superior to the arrow-keys, but it seems like many vim users are still not satisfied with these and other methods of movement present in vim. That is why some of them created plugins like easymotion to jump to anywhere on the currently visible window with just two keys pressed. There exist many tools that provide such functionality, here are some of them:


vim-easymotion

leap.nvim

vim-sneak

hop.nvim

sj.nvim

portal.nvim


As you may notice from their star-count, these tools are pretty popular amongst vim-users. Does this suggest that the vim-movements should be improved?


My Background


I personally use vim for pretty much everything I write. This is mostly code for some of my projects, some notes in my Zettelkasten but also general writing like this article. I have tried some of the listed plugins myself and must say I don't really have a use for them. Every time I configure one of them, I test it out a few times, find it pretty cool and then completely forget I even have it in my configuration as I never use them. In my projects, I don't have a situation that often where the thing I want to go is visible in the current window, my destination is mostly outside of the current window, either above, below or in a separate buffer or file.


To reach my destination, I pretty much only use standard vim-movement.


My Alternatives


Search


I mostly use the search-functionality (called by using / in normal-mode) to reach my destination. This works as I often want to go to some function I defined or variable I used. As I mostly know the exact name of the function I am searching for, this method is pretty fast in my experience. Even if I don't exactly know what I am searching for, searching for some keywords is often also successful. It also works for close-range searches.


Markers


If I know that I will need to return to some point I currently am at, I just use vim markers (set with m<letter> and jump to with '<letter>). This provides a fast way to search for some information (e.g. how have I done this somewhere) and instantly returning where I was, it does not matter if that was in a different line, file (only for upper-case letters) or even different vim-instance (also only upper-case letter).


Just hjkl


If I am not certain what I am looking for, e.g. if I forgot some function name, I just use j or k (if I know it is farther away, sometimes page-up and page-down) to scroll around. This works very well in code as parts of a line (e.g. variable names) of code already suggest what the surrounding lines are all about. I therefore just can use key-repeat to scroll through a file pretty quickly. Once I found the line I was searching for, jumping by word (using w) is also pretty efficient as lines in code are often not that long.


Conclusion


I personally don't think such plugins are really needed. Don't get me wrong, I am sure many people find these plugins essential to their vim-experience, but for my use-cases, they are mostly useless. I prefer other methods of movement.


Recommended watch


As most blog posts, here is a small section about something I recently enjoyed. This time it is actually unrelated to the content of this post and is in video-form.


Linux on smartphones in 2022 - Mobile Gnome Shell + postmarketOS on a OnePlus 6 (YouTube)


I must honestly say I am really impressed what GNOME has done with its shell, this UI is capable of even beating any Android-experience I ever had (other parts will still need major work). Too sad that the PinePhone is too weak for it.



Return to home

-- Response ended

-- Page fetched on Mon May 13 05:07:47 2024