Novice programmers should probably not start with vim.
Novice programmers should probably not start with vim.
Vastly overhyped and overrated by Japanophiles, requires a lot of dedication and learning to use properly, and a hassle to use for day-to-day household tasks? Sounds about right, dohohoho.
(I'm kidding, I'm kidding...)
But VSCode (/JetBrains/etc) is more like a Internet-of-Things version of one of those meat-and-cheese-slicing machines they use in delis: needlessly oversized, optimised for producing stuff in large quantities with no attention to detail, and cannot be used correctly anyway because you can never be sure the next software update won't brick it or cause it up phone home all your information to the malware developer you got it from, because the S in IoT is for security.
Notepad, of course, is a rusty butter knife with suspicious-looking stains on it, while ed is a sharp piece of flint (with different suspicious-looking stains).
(Does
$ echo ' printf("Hello, World!\n");' >> hello.c
count as tearing up raw ingredients with your teeth? This metaphore kind of got away from me.)Get an IDE, I suggest JetBrains.
I use vim everyday day as I work on Linux systems copying code and writing scripts and things but it should not be your primary development tool, certainly not for novices.
edit: can you easily pipe the entire file through grep or awk, or insert the contents of the output of curl or jq?
I do that in terminal (I'm a heavy vim user)
vscode subs for vim, not for the CLI
What does this have to do with anything? If I felt the need to work this way, I absolutely could set up my Mac + any JetBrains IDE to do it, but to me it is an entirely unnecessary requirement.
> can you easily pipe the entire file through grep or awk, or insert the contents of the output of curl or jq?
Yes, and probably from within my IDE (if I cared to), which I probably won't do and don't need to because there exists other tools and plugins.
No but I don't want to because mice are a great invention that make lots of tasks faster. Why artificially limit yourself by banning a mouse? Do you really browse the web without a mouse?
> can you easily pipe the entire file through grep or awk, or insert the contents of the output of curl or jq?
Yes?
cat file | ...
curl ... | pbcopy
Anyway those are super rare tasks! Why would I pick an editor based on being able to do things I want to do a couple of times a month at the absolute most?Piping to CLI tools is easily done through Jetbrains macros.
Why do you think the mouse is slow?
Have you seen StarCraft players? They use the mouse and keyboard and perform an average of 200 actions per minute.
In fact, to select a certain piece of text, to get precisely to the end of what I want, the mouse is, most of the time, the fastest option.
I think the right idea is to use both, master them, and combine their strengths.
It's weird when I read threads like this and people treat using Vim as some kind of weird flex. It feels like I'm living on a different planet. Vim isn't a flex, it's a natural part of the broader Unix environment. It works seamlessly with Git, SSH, and the GNU ecosystem of bash, coreutils, gawk, gcc (which are all ubiquitous, too.) In such an environment, the more you learn about Vim, the more it pays off.
Why? Vim is ubiquitous, (relatively) lightweight, extensible with a lot of plugins available, and stable/predictable in its behavior. Its ubiquity and history ensures there is a huge body of documentation about it on the web. Unlike some other editors, it doesn't leave hidden "artifacts" all over the place, just one hidden swp file at a time which vanishes as soon as you save and exit the editor. This politeness is attractive because you don't have to deal with stale or interfering hidden statefulness.
Summary: Although you can edit quickly with Vim, and can keep getting faster the more you learn, it's not like I stick with Vim because "editing speed" is some metric that I really care about. And when assessing a candidate in an interview, it's not like I'm assessing them on their words-per-minute and tell them they need to switch to Vim to match our typing speed standards, lol. I use Vim, and I care about Vim, because it is polite and stable and integrates well with the broader Unix/GNU ecosystem I spend a lot of time working and playing in, and once you get muscle-memory for it, it feels really clunky to try using some other tool which doesn't have the same set of features.
I obviously don't see Vim as a flex. Maybe a misguided flex.
You could probably use VIM inside VSCode but the latter does not expose the necessary API. What you got instead is a very simplified version. Emacs does and evil-mode is a very good vim.
That sounds like a downside. Incremental editing with multiple cursors is so much better than e.g. regex based find/replace or long vim commands because you get immediate feedback. If you make a mistake you just undo. You don't have to start again from scratch.
With complex atomic editing operations it is painful to get them right because you only see the final output.
Atomicity of complex editing operations is not a desirable property.
Atomicity here has a linguistic meaning. You know the basic operations, and you compose them to express a more complex ones. Like d is delete, and w is one word to the right, dw means delete one word to the right. di” (delete in) is delete the characters inside the quotes and da” (delete around) also deletes the quotes too.
Once you got the hang of the languages, editing, inserting and selecting text becomes as easy as thinking.
N.B. Normal mode is the default mode, not insert mode
Use what you want, I don't care.
* Mark a position in the file, so I easily can jump back.
* Quick recording of a macro that to do the same type of edit multiple times (very handy when refactoring)
* regular expression search and replace, very easy to limit the scope.
* Easy to select, copy and paste lines or columns.
Everything without touching a mouse.
(Emacs user happily using Evil mode since 2011 or so)
My point is that in practice the number of situations where that is better than normal editing with multiple cursors is so few that it doesn't get close to the threshold of being worth committing to memory.
That gist is rather long and rambling so I only skimmed it, but it seems to list commands you can do in Vim rather than real life editing situations that they are especially good at.
Notepad++ has multiple cursors. Vim has "repeat last command", which is better.
By "repeat last command", I meant repeating a single command with ., which can do simple things like pasting a string, deleting something, toggling case, incrementing an integer, and probably more stuff I don't use. Then there are macros which can repeat multiple commands, and are actually not much harder to use than the dot.
Another thing I like about the repeating approach is that you don't have to find all the places beforehand. You can target some of them with a regex, then remember to do more of them with another regex, then the rest, one-by-one by hand.
I used to think that typing in multiple places at once was cool, but now I wouldn't go back. Not even if other editors are catching up. Are they, by the way? I remember Notepad++ could not do much more than insert the same string in multiple places at once, but I confess, I have never used VS Code, Sublime, Atom, or really anything that popped up while I was in the vim rabbit hole. Am I missing out?
It's not for me, thanks. I went back to Sublime Text and will only use vim in case of emergency, and only if I get paid for it.
I am not sure what "the legend" is supposed to mean, but at least nano has the keyboard shortcuts displayed at the bottom so you can't forget those.
Edit: Ahh yes, the other kind of legend. I was expecting some lore from the old days. I'm going to try some more coffee, but I suspect it won't help. Probably unsafe to drink it laughing at myself anyway.