As always, I am unimpressed by “vim tricks” that vim people always boast about. And I am yet to see a single real use case where vim is faster than good old basic keyboard shortcuts (that includes cmd-d)
As always, I am unimpressed by “vim tricks” that vim people always boast about. And I am yet to see a single real use case where vim is faster than good old basic keyboard shortcuts (that includes cmd-d)
It’s just that it’s tempting to find the “perfect” combo when performing complex tasks, and that takes time and mental energy even if you don’t realize this. Small time admittedly, but still present and cumulative.
That said, your attitude toward use of an editor is bizarre. If you want to use vscode, use it. If not, don't.
If you are trying to convince the world that your choice is the best, and anyone who disagrees is wrong, well, good luck with that.
The limitation of non-modal editing is that you only have arrows and modifiers whereas you can have a whole vocabulary /language for yourself with modal.
Also define “smooth flow”. I my experience pair programming, by the time you are starting you command after choosing among all possibilities, I have already performed the change with VSCode.
5dd
But as long as you are including preparation keystrokes, how may keystrokes would it be to get to a particular line in vscode? I guarantee it will be a lot more than vim. There are countless ways to navigate to a position in a buffer.
The reason why it’s faster is that it’s a lower level task: I can just visually go where I want without even having to read contents or even line numbers, just based on text shape, don’t even have to think about it, it’s just muscle reflex.
I don’t have to (consciously or not) plan a strategy choosing the best way among 5 different ways each time I want to select text. And no, this never becomes a true reflex. If it does then it’s just because you always choose the same strategy. You always have this part of your brain that has to think about vim tricks, and believe me, we can see that from the outside.
>Also define “smooth flow”. I my experience pair programming, by the time you are starting you command after choosing among all possibilities, I have already performed the change with VSCode.
There's really not much thought involved. If you can imagine yourself using keyboard shortcuts, it's probably pretty similar. In a simple example, you don't think "I gotta hold ctrl, press c, release c, and then release ctrl", you just think "I'm going to copy this". I think you have the idea that vim is really complicated and its users must be bogged down and thinking more. At worst I would say it's probably the same as what you have now, unless you count very early stages where you actually just don't know your way around too well. When you're situated and experienced, it's not ever slower in my experience. On the contrary I feel a bit disabled when I have to edit in something without vim keys. It's not like I can't jump around with home/end and select text with ctrl-shift-arrows and whatnot, but it doesn't feel as fast or comfortable or natural to me.
I feel like I’m far from a vim “power user”, but people regularly comment on how quickly I edit text and code when I’m doing a screenshare. It becomes second nature in short order, so I’m never thinking about some multi-step process to before an edit; I just “do it”.
As for the “5dd” example… there are multiple ways to do things. For me, that would likely be:
* navigate to the first or last line of the block
* <shift+V> to start a selection of whole lines.
* navigate to the other extreme
* <D>
So you get an easy way to repeat actions. You can make this into a macro easily if needed.
Then, most importantly in my opinion, you keep your hands in the normal typing position. The command key is awkward for me to reach and hurts my hands.
But outside of that, the problem with standard editors is that none of your keyboard shortcuts compose together. You have special shortcuts for deleting lines vs deleting individual words. No shortcut for copying objects to your clipboard. No shortcuts for "get me what's within these parens". You can't move between panes with consistent keybindings, because most editors represent code panes vs directory panes differently.
Vim lets you think of editing and navigating your code in terms of verbs and objects, and treats everything consistently. Take the "w" object, that's "word". Now I can move around by word by mashing "w", I can delete with "dw", change with "cw", yank to clipboard with "yw". The "." command lets me repeat, so I can do things like "dw..." and delete more easily. Some plugins add more objects, like being able to refer to surrounded text (e.g., in parentheses.) They compose with all the verbs you already know, so now I can delete inside parens, surround with parens, replace text within parens, copy in parens, etc.
Vim compared to standard text editors is like functional vs imperative programming. It works best for code, because editing code is not like writing prose. You're manipulating a syntax tree.
Meanwhile, keyboard shortcuts on a Mac do compose: arrow=Move, shift-arrow=Select, arrow=a character at a time (or vertically, a line), shift-arrow=a word at a time (or vertically a paragraph) cmd-arrow=the whole line (or vertically the whole file).
Also cmd-d has immense powers when you know how to use it.
And finally let me mention that syntax-aware editing is overrated when you use a linter/formatter because regular indentation and normal shortcuts work flawlessly already.
Last but not least: these shortcuts work system wide! So we don’t have to reimplement every possible software within my text editor so I can use these shortcuts.
> syntax-aware editing is overrated when you use a linter/formatter
Not quite what I'm talking about actually. Going back to the theme of "code as syntax tree", when editing code you'll often find yourself needing to do things like "ah I should hoist the code in this paren block into its own variable." Vim lets me operate on that syntax level, which feels more reliable to me than using the mouse to carefully select text. I just tell it to delete in parens (which automatically pulls it into a register that I can paste from), move to a new line, paste with "p". When I edit code it's less about individual characters and more about moving blocks of logic around, which is super important for refactoring safely. I end up making fewer mistakes with vim.
I chose the "delete 5 lines" example because it was simple; the person I replied to said they weren't familiar with vim, and I didn't know how familiar they were with editors and code in general.
I think that perhaps you jumped to the incorrect conclusion about that part of my comment. I didn't impugn or insult visual studio code, nor try to insinuate that vim is better. In fact, I use vscode every work day for my devops day job, alongside Emacs for my org-mode documents, and vim for remote editing.
For counting lines, in vim I generally don't do that. If I have, say, a couple hundred lines to delete then I use something like 50dd a couple of times. Once I'm close to the end of what I wanted to delete, I just use dd followed by . to repeat that dd.
There's more than enough space in the world for multiple text editors! It doesn't really have to be a competition.