The same people using vim swear by using CLI only tools and by the time they've found the command they want to edit and run in their bash history, I've hit Ctrl+Shift+G, entered my commit message and hit Ctrl+Enter to push. In the time it takes them to switch modes, I've already run the command I wanted to run since many commands are a single hot key and others are on an MRU list.
For editing stuff on a live server, in those rare events when nano isn't available I've always gotten by knowing the bare minimum - how to insert text, write and quit. But I haven't encountered a server lacking nano in years.
Maybe I haven't seen the fastest vim user though. So I looked just now and found [0]. I chose to watch [1] and ~1:24 you can see a demonstration of the guy typing out a command, "Switch" to switch a code symbol from the "true" to "false"... I thought that was hilarious because he typed 6 characters (7 if you include ENTER) in order to save himself from typing 5 characters and I just couldn't watch anymore after that so I left, wondering how many man hours have been spent bike shedding in vim.
That said - I didn't have the patience to find anything showing somebody doing something in vim that can't be done faster in VS Code, Sublime, etc. - so maybe a vim fan can point me in the right direction?
[0] https://old.reddit.com/r/vim/comments/3k1b7n/fastest_vim_vid...
They are showing how it works, so as an example highlight/select manually a bit of text then manually run it to show it swapping the value. There's a few things to consider here:
- They are typing it out because the are demoing it and that's the name it's defined as in the code. Normally someone adding it would also add a key combo activation for it if they planned on using it often in that manner, and make it work on the word element under the cursor.
- Even if a key combo wasn't added, they could also use this while selecting a larger chunk of text to switch all occurrences of one thing the the opposite.
- The real usefulness for this is more likely in the case of some well formatted JSON, where you could start a macros, search for the next top level object, they search for a specific key in that object you know is the next occurr nice of a search term, then go to nth item, then run switch (maybe even typing it out). Then stop the macro. You can then rerun that macro with 1 (or at most a few) key presses the number of times you want, to perform those complex actions a defined number of times.
As needed, vim is like an extensible interactive sed command. That doesn't mean I never use vim, but being able to do something similar to the text manipulations I do with sed while withing the file to confirm it worked right and undo if needed is sometimes useful.
Could the JSON example above have been done with a dedicated tool? Sure. But it gets more complex for dedicated tools if the JSON is embedded in something else, and the important idea is not JSON editing, but that vim gives you a toolset that works just as well for XML or source or plain text, as the primitives it works with generally map well to how we use text.
And this is instant cred when one is new to a project, and have to log in and fix something on a random serber out in the cloud.
Vi is something of a litmus test.
First you learn how to enter text and move around a bit.
Next you learn some more advanced features to move and edit more effectively.
Then you learn that vim actually functions at different levels, characters, words, lines, and paragraphs, and learn ways to work on those items specifically.
You learn that complex macros are built in and can easily be recorded and applied as needed.
Finally (maybe?) you learn that all this combines into its own little programming language made to work on documents, and you can use this to quickly do amazing things.
But here's the thing, even if you stop only partway into it, you've still learned how to edit files in an editor that will be on every Unix machine you encounter, even if that version may not have all the bells and whistles.
It's an extremely powerful and ubiquitous tool. Even if you don't use it as a primary editor, there are benefits to knowing how to use it with a moderate proficiency, so many people do.