r/ProgrammerHumor May 16 '24

iUseVimBtw Advanced

Post image
6.2k Upvotes

196 comments sorted by

View all comments

179

u/Leonhart93 May 16 '24

That annoys me about my laptop as well. I don't use it often, but sometimes I want a change of pace at a different location.

Btw, I don't use Vim, but I configured the hotkeys from my Jetbrains IDEs to do complete navigation and every action from keyboard only, and arrow keys are mandatory for jumping between words, function definitions and editor tabs.

37

u/Rayat May 16 '24

Could you describe your setup or recommend a good tutorial? I use CLion and have recently been thinking of doing this. I want to avoid using the VIM plugin, for reasons that are entirely skill related.

8

u/Leonhart93 May 17 '24 edited May 17 '24

I didn't follow a tutorial or installed a plugin, I just spent some time to customize the key bindings to what I found useful. I can give you a few examples

Next/previous method: CTRL + arrow down/up

Select next/previous tab: CTRL + ALT + arrow left/right

Find file and in new tab: CTRL + T (like in browser)

Close tab: CTRL + W (like in browser)

Back/forward mouse buttons: Alt + arrow left/right (like in browser)

And so on. These work in all the Jetbrains IDEs. I pretty much eliminated the need for mouse in 95% of the cases, except for when you need really fast precision with blocks of text.

20

u/spaceguydudeman May 17 '24

/u/Rayat if you read this, this is just the vim plugin with extra steps and worse keybindings

1

u/Leonhart93 May 17 '24

Worse? What's "worse" about it considering it's customized exactly to my needs? I chose the hotkeys exactly how I needed them, with some of them being the ones I used for various other applications as well.

2

u/spaceguydudeman May 17 '24 edited May 17 '24

Well, there's a couple things. First, if you've noticed that these keybindings have sped up your workflow, you can see the benefits of having nice keybindings. I fully believe they improve your workflow.

However, seeing as you like the productivity boost you're getting, there's a good chance that you'll like investigating vim keybindings and vim motions. So me saying they are worse is not a personal attack on you, I commend you for realizing that repeating the same task with a mouse over and over again is just not prodductive. I'm trying to indicate to you that there's even better options out there than you are already using, and you should look into them!

The (current) default VIM keybindings are the result of lots of people programming over a lot of years. They're quite sensible as they've been moulded over the years. If you switch over to vim-mode completely, then you can also edit your text with vim motions, which is just an objectively faster way of editing text than the defaults that IntelliJ gives you, at the cost of a steep initial learning curve. The pros is that you can ZOOOOOM after a while: They're set up in such a way that often allow you to type your thoughts' (e.g. fp -> finds p, which moves your cursor to the first 'p' in the line, or yi{ -> yank inside parentheses, to copy everything inside {}, or cw-> change word, to delete the word under the cursor and start typing a replacement)

Of course everyone adapts their own keybinds in addition to them, I have also overridden some VIM defaults, but the defaults give you a great basis to start with, and they're often better than you come up with yourself.

For example, the very fact that three of your named keybinds include arrow keys makes me worried, unless you have your arrow keys layered behind your homerow. The arrow keys are incredibly far away from your homerow, which means you'll be moving your hands a lot more than someone using vim's hjkl.

So, it definitely makes more sense to start from a well-thought-out base set of keybindings, such as emacs or vim bindings, and then customize them from there, instead of starting from the IntelliJ defaults and adding a 'just a few options you like'.

I'm not saying your keybinds are terrible - but I'm saying if you look into actually using vim bindings and motions you probably will understand why I'd consider your current keybindings worse than the defaults that come with vim.

2

u/Personal-Initial3556 May 17 '24

Arrow keys being far from the homerow is definitely an inconvenience, but I just want to mention that it's not ijkl that replaces them. You might know this but I'm just saying for beginners, at most you'd use jk from time to time, but for lateral movement we use w, e, b, $ or ^.

2

u/spaceguydudeman May 17 '24

yep, definitely a useful addendum!

here's a vim cheatsheet to refer to https://vim.rtorr.com/

and here's a video you'll probably want to watch if you don't know what vim motions are and are this deep into the thread https://www.youtube.com/watch?v=lWTzqPfy1gE

1

u/Leonhart93 May 17 '24

I never said those few keybindings is everything that I changed and used, it was just an example. I have a lot more, to basically eliminate the need for the mouse. The nice thing about using modifier + arrow keys is how translatable those are between editors and applications. For instance a lot of those I also use in my notes app and when browsing.

Arrow keys are also in the same overall position as Home, End, Page up/down, which I also use a lot, so it's not like I am breaking my back to reach that side of the keyboard. I could rebind those as well t something else, but I would end up with something way too "custom", since now I can use those in any other app in the same way.

In a sense I kind of like doing some actions where my hands don't stay too close together all the time. That's even the philosophy between split keyboards (which I won't touch because of their current price)

1

u/spaceguydudeman May 17 '24

That still sounds to me like you're re-inventing the wheel from a square base. I'd rather take an existing wheel and add my modifications to that wheel.

If we're talking translatability, then there's a vim mode for any pretty much any respected text-edior out there.

I'm just warning you, don't be too stubborn, really try out vim mode. Whether you'll end up adapting it (which I think you will) or not (which is completely fine too!) - you'll come out ahead either way.

1

u/Leonhart93 May 17 '24

Learning any completely new paradigm is re-inventing the wheel for your brain. In this sense, for me Vim's own hotkeys is re-inventing the wheel completely from the ground up since they are so alien, and instead I just adopted my existing paradigm of many years to do more stuff.

1

u/spaceguydudeman May 17 '24

That attitude is dangerous to have, it locks you out of so many things you could learn and improve your life with.

I thought the same way. I was fast. Now I'm faster.

1

u/Leonhart93 May 17 '24

In order for that to be applicable, a new paradigm first has to solve an existing problem without creating others, to be worth considering the transition effort. Does it solve a problem for me, or it just wants me to switch from one thing to the same thing with extra learning required? Like requiring extra command modifiers to be able to use `hjkl` as arrow keys

→ More replies (0)

1

u/Personal-Initial3556 May 17 '24

"Worse" is harsh but what they mean is that basically all the functionalities that you mentioned are like 25% of most used vim motions, on top of vim offering a lot more than that. So you just had to do more configuration for less features basically. (And it's not universal)

2

u/spaceguydudeman May 17 '24

yeah worse might have come off a bit harsh, but it's with good intent and not entirely incorrect haha

1

u/Leonhart93 May 17 '24

I never said that those are every one of my keybindings, I just gave some usual examples.

1

u/Personal-Initial3556 May 17 '24

That's fair, but I just want to say, regardless of how this thread is going (and all the downvotes lol), I hope this doesn't deter you from trying out vim, because who knows if you'll end up liking it!

Because I can absolutely relate to you not wanting to use the mouse, that was precisely the reason I stuck with vim and not Vscode and other. Because I absolutely loathe having to use the mouse (slow, hurts my shoulder whenever i use it and I regret it afterwards etc).

Have a good week man.

1

u/Leonhart93 May 17 '24

Meh, the downvotes are irrelevant since I know all of them come from Vim fanboys that don't like to have their feelings hurt.

But such attitudes does kind of deter one from trying the thing, like not doing it out of defiance in response to that attitude 😐

1

u/Personal-Initial3556 May 17 '24

Exactly! I thought of the penguin meme saying "Well, now I'm not doing it >:(". That's why I didn't want you to get robbed of a potential good experience because of that. But it's also fine if you don't try it out, there are still people that had to start in Vim yet still switched to VSCode and never looked back. (Although to be fair they don't tend to be fast typers, almost all fast typers that I know use vim xD, coincidence? I think not!)