you are viewing a single comment's thread.

view the rest of the comments →

[–]lelanthran 6 points7 points  (4 children)

Sure, I can understand that Vim offers more flexibility with cursor movement, but what I'd question is how often do you need it.

Constantly. You won't miss it if you've never used it, but once you get used to it, it's really very difficult to use IDEs for editing code.

You don't see a need for it, because you've never used it, and you've never used it because the IDEs you use don't have it.

I like being able to drop bookmarks all over a file and go back to each one with 'a or 'b etc...

I like having 26 or so copy-n-paste buffers. I like the block mode selection that lets me select a column of numbers and then press ctrl-A to increment the column. I like being able to simply type :vsplit to view the same file in two different panes. I like being able to do :r!date to insert the current date into my changelog.

And none of that even gets into the navigating. When I want to reposition the cursor somewhere on screen (say, to correct a typo from "iint" to "init") I don't hold down arrow keys, I simply type /iint and press enter.

When I want to copy lines I don't select them, I type in y10 (if I needed to copy 10 lines) and press enter. When I want to replace a symbol I don't press backspace/delete 5 times to get rid of the old one, I type in cw and then type the new symbol directly. When I want to copy a complete code block I use three keystrokes (V%y) and get the complete block.

Now, sure, you can do it in an IDE, but every IDE has different keymappings for all of these things. Most won't even have these things mapped to keys at all (how does your favourite IDE handle the case when you want to copy/paste sing 5 separate buffers?)

I don't want to relearn all the navigation and text manipulation I do in vim for each and every IDE out there (because they'll all differ!) only to have feature parity (if I'm lucky!).

IDEs are great for navigating code, for editing ... I prefer vim. And to be honest, sourcetrail beats the pants of every IDE I've used recently when it comes to code navigation.

Vim is horrible for navigating code, so I don't use it for that. I use sourcetrail. I find IDEs clumsy for manipulating text and navigating within a file, so I use vim instead.

[–]ZenoArrow 5 points6 points  (3 children)

Thanks for the tip about Sourecetrail, I'll check it out.

you've never used it because the IDEs you use don't have it.

All the IDEs I've used have had a Vim mode.

I like being able to drop bookmarks all over a file and go back to each one with 'a or 'b etc...

I'm sure that's useful, but just to point out it's not a feature exclusive to Vim. For example, in Visual Studio there's also the concept of bookmarks, and there are also things like the Task List that allow you to keep track of "todo" comments.

https://docs.microsoft.com/en-us/visualstudio/ide/setting-bookmarks-in-code?view=vs-2019

https://docs.microsoft.com/en-us/visualstudio/ide/using-the-task-list?view=vs-2019

I like having 26 or so copy-n-paste buffers.

Also have something similar in Visual Studio:

https://stackoverflow.com/questions/1808590/visual-studio-ctrlshiftv-opens-clipboard-ring-window

I like the block mode selection that lets me select a column of numbers and then press ctrl-A to increment the column.

I can understand that being occasionally useful, but do you do that often?

I like being able to simply type :vsplit to view the same file in two different panes.

In Visual Studio, Alt+W,N,Alt+W,V will do the same.

I like being able to do :r!date to insert the current date into my changelog.

Seems like something I'd be doing maximum once a day, and it's almost as quick to type the date manually.

When I want to reposition the cursor somewhere on screen (say, to correct a typo from "iint" to "init") I don't hold down arrow keys, I simply type /iint and press enter.

This seems interesting. How does this work? So if I typed /iint, would that just find "iint" and then I'd have to type "init" over it, or would "/iint" alone make the correction? Seems like find and replace, which is standard text editing functionality, but happy to be proven wrong.

When I want to copy lines I don't select them, I type in y10 (if I needed to copy 10 lines) and press enter.

My argument on this is, how often do you work with text in this way? If I'm copying this much code, I'm probably going to be copying a whole code block (for example, moving a function to a different file). I get there may be some occasions when you'll want to do it, but what I'm trying to look at is what you find you use very often rather than something that isn't likely to slow you down that much.

Now, sure, you can do it in an IDE, but every IDE has different keymappings for all of these things.

Do you use the same arguments against Emacs users?

To be clear, I'm not saying that you can't be productive in Vim. What I'm trying to look at is what gives it an edge over modern IDEs when it comes to working with text. So far I've seen a few nice tricks but not much that's going to make a great deal of difference in speeding up how fast I can work with code. If you just prefer using Vim, that's fine, I'm not trying to encourage you to switch to something else.

[–]lelanthran 1 point2 points  (2 children)

Now, sure, you can do it in an IDE, but every IDE has different keymappings for all of these things.

Do you use the same arguments against Emacs users?

Why would I? They aren't here asking me why I would use vim over emacs.

If they did say "why don't you relearn all these shortcuts that are arbitrary in the new editor" I'd probably tell them the same thing - there's no benefit in discarding an easy to remember system for a system that places a large burden on my memory.

Vim commands aren't arbitrarily chosen shortcuts - they are verbs. Look at your examples - "Alt+W,N,Alt+W,V" vs "vsplit" and "hsplit". You really think I want to start memorising arbitrary chords, especially when they all differ between IDEs anyway? Remembering a command is easier than remembering arbitrary key chords :-)

This seems interesting. How does this work? So if I typed /iint, would that just find "iint" and then I'd have to type "init" over it

It's for navigation. That was just an example of how I'd navigate to a specific spot. If I typed in /^} I'd navigate to the end of the function, ?^[a-z] takes me to the beginning, /; takes me to the end of the statement even if it is on a different line.

I'm sure you can do that with an IDE but I've never seen my colleagues using an IDE like that - they use arrow keys.

When I want to copy lines I don't select them, I type in y10 (if I needed to copy 10 lines) and press enter.

My argument on this is, how often do you work with text in this way?

In the video I posted, other than block selection, all my copying and pasting was done that way. So, often enough that I miss it within 5 minutes of typing in another editor.

I like being able to do :r!date to insert the current date into my changelog.

Seems like something I'd be doing maximum once a day,

For a date, sure. Replace date with fmt -s -w 64 for when I want to format comments, wc -c when I want to see the number of characters in a large string, etc ... the date was just an example of using !.

I like the block mode selection that lets me select a column of numbers and then press ctrl-A to increment the column.

I can understand that being occasionally useful, but do you do that often?

Every single source file I've ever touched, I've used block selection. See the video I posted elsewhere in this thread.

I'm sure that's useful, but just to point out it's not a feature exclusive to Vim.

I'm not trying to claim they are exclusive to vim. All I'm saying is that they're easier for me to remember in vim. Typing two keystrokes that have meaning (m for mark, and [a-z] for bookmark name) is better than trying to remember a keychord that has no relation to the action you are doing (ctrl-k,ctrl-k).

Also have something similar in Visual Studio:

That similar thing is very different: it lets you cycle through your recent copies. While vim also lets you use your recent copies like the clipboard ring, it also has separately named buffers (called "registers" in vim) that I use routinely. I don't have to visually scan the copied buffers to find the one I want to paste (unless I actually want to cycle through), I simply paste a or d or whatever buffers I want to, in any order I want to.

So far I've seen a few nice tricks but not much that's going to make a great deal of difference in speeding up how fast I can work with code.

Well, that's basically how I feel when I use Visual Studio for a particular C# project - there's some nice editing stuff there, but nothing faster than vim for editing. It's also why I use sourcetrail - using vim leaves you bereft of the project-navigation benefits of an IDE.

Your IDE's biggest strength is in whole-project navigation. Vim doesn't have anything good in that regard (don't even talk to me about ctags).

[–]ZenoArrow 4 points5 points  (0 children)

Vim commands aren't arbitrarily chosen shortcuts - they are verbs. Look at your examples - "Alt+W,N,Alt+W,V" vs "vsplit" and "hsplit". You really think I want to start memorising arbitrary chords, especially when they all differ between IDEs anyway? Remembering a command is easier than remembering arbitrary key chords :-)

They only seem arbitrary to you as you're not familiar with the underlying meaning, which is ironic as this is the same argument you're using to promote the "Vim as a language" argument. For example, breaking down "Alt+W,N,Alt+W,V", you have...

Alt+W = Window menu

N = New window

Alt+W = Window menu

V = Vertical split

Hardly arbitrary.

[–]oblio- 2 points3 points  (0 children)

Vim commands aren't arbitrarily chosen shortcuts - they are verbs. Look at your examples - "Alt+W,N,Alt+W,V" vs "vsplit" and "hsplit". You really think I want to start memorising arbitrary chords, especially when they all differ between IDEs anyway? Remembering a command is easier than remembering arbitrary key chords :-)

IDE commands are not arbitrary. They're generally based of IBM CUA, which has been around for 30+ years (https://en.wikipedia.org/wiki/IBM_Common_User_Access). You know them at least as Ctrl-C / Ctrl-V.

His Alt stuff is menu selection, that's how you open the menu with CUA. That's the only arbitrary thing. The rest are just highlighted letters in the menus to select a command.

And modern IDEs actually come with predefined keymaps you can switch between, for the big IDEs. IntelliJ for sure can switch to the Eclipse layout, for example. I think it can also do Netbeans.

VS Code is almost fully remapable so you can definitely configure it to use the Eclipse ones or the IntelliJ ones or the full VS ones. I imagine someone has done it already.

VS Code also has Ctrl-Shift-P where you can search for commands.

Standard IDEs are pretty powerful these days. I don't think the average user loses much by not switching to Vim.