123 points · by grey-area · 9y ago · 90 comments
That's how I feel when I work with someone editing text files without Vim.
Once again I'll recommend Vim Adventures[1]. It's fun enough even my 8-yr-old daughter wanted to play/learn. You learn a few keys at a time; no big deal. Meanwhile, install Vim emulation in your current text editor. Slowly you'll learn keys. Your desire for knowledge will increase, and you'll start picking up the ideas mentioned in the article. Within a few months you'll be flying and wonder how you ever coded without it.
The key is making it a natural thing, not forcing yourself to "learn Vim". At least for me, those approaches failed due to the short-term productivity decrease.
This makes vimtutor look like pong.
Occasionally there were conflicts or problems caused by plugins, and then I just troubleshot those and uninstalled or disabled plugins until I found the culprit. No big deal.
Whenever I use another computer that just has vanilla vim installed, without my own .vimrc on hand, I just touch ~/.vimrc and away I go. I just try not to spend too much time on such systems before loading up my own .vimrc. Again, not a big deal.
I really don't get people who deliberately cripple themselves by using fewer plugins or features than were maximally useful.
On the other hand, I was never a big fan of giant plugins that make a lot of choices for you. I like to make my own choices as much as possible, and know why and how these choices are made. So the plugins I install tend to be very specific plugins that are good at one particular thing that I feel vanilla vim is lacking.
At one point in the past, I did have a bunch of plugins (nerdtree, fugitive, surround, nerdcommenter, etc, etc) but they weren't that great (I guess because vim's scripting facilities and UI isn't optimal for writing complex IDE-like features) and were always conflicting or otherwise a hassle.
These days I get by with vanilla vim with a conservative vimrc and I don't consider my productivity crippled. The only plugins I miss are surround.vim and a commenting plugin.
If you like to try any plugins, sure go ahead but I don't think it's a good idea for someone new to vim.
When I install my own .vimrc on another computer, I just copy my whole ~/.vim directory over with it, and that's really all it takes to migrate. Easy.
As for plugin conflicts, I've found them to be pretty rare, and when they happen they've been easy enough to troubleshoot and then I just disable the incompatible plugin, if I can't find some other fix. The occasional incompatible plugin is no reason to avoid plugins as a whole.
Incidentally, surround.vim and commentary.vim are also why I wouldn't want to live without plugins. Everything else is expendable.
I always prefer using tags files to do code navigation instead of browsing files. With `:set wildmenu` (enabled in sensible.vim), using `:tabnew :edit :split` etc from command mode is also quite nice. For browsing, the default netrw is decent or I use ranger in another window.
What I could really use is a fuzzy finding plugin, I've heard Ctrl-P is nice but I haven't tried it.
This isn't always enough for folks, who fall back to YCM or others.
Or did you mean use Vim bindings in IntelliJ?
Some of the worst D'oh moments I've had came from before I added tab completion to my .vimrc, because it almost completely eliminated errors that my typos introduced.
The visual feedback makes it easier to pick up (for me), and also makes building up complicated sequences of actions very easy. Multi-selection ties into that as well - a common workflow for me when editing is to select an object (a-a or a-i), split it by some regex into multiple selections (s), then perform my changes on those selections.
I've also started playing with VSCode and have found it great as well. It's the first time in a number of years I've played with anything other than vim.
Once I have either a plan or comprehension of a program, I move at lightspeed, and typing becomes a small proportion of software production time. When editing an unknown codebase, it becomes even more imperative to have comprehension + plan before making an edit.
Also, since its my ability to comprehend and plan that is so strained, I'm not sympathetic to Vim's lack of anything like intellisense, or cross-file grammar and type awareness + autocomplete.
Typing may be a small part, but there's no reason not to make that part efficient.
> Vim is a small language for editing text that ships with a small user interface.
Pardon my ignorance, but are the two separable? Could someone write a GUI interface that uses the vim text editing language underneath? I know of gvim, but this seems to be just vim with a menu bar.
It would be great to be able to use VIM key movement as drop-in replacement for any text field OS wide but the VIM interface (the command line) plays an important role in the UI and I don't see how it could be swept aside without losing some VIM core functionality: EG how do you :%s///gi without the overlay command line ?
https://github.com/neovim/neovim/wiki/Plugin-UI-architecture
Each dojo trains you on a few related set of vim actions.
Practice one dojo at a time and try to use it during your regular editing. Once you have incorporated it into your existing workflow, move to the next dojo.
I've got some resources for learning Vim on http://www.verticalsysadmin.com/vi.htm
Also, use vim-plug [3] with few plugin like ctrlp, nerdtree, nerdcommenter and vim-simple-complete [4].)
[1] https://github.com/tpope/vim-sensible
[2] https://github.com/maxboisvert/vim-simple-defaults
[3] https://github.com/junegunn/vim-plug
[4] https://github.com/maxboisvert/vim-simple-complete
I am the author of [2] and [4].
I read things like this occasionally and still don't really get why? Why is the learning curve worth it?
> Easiest way to think of it is to think of how frustrating it is watching someone do everything with a mouse, not knowing any shortcuts. Clicking File -> Exit instead of the window's X. Or deleting a whole line of text just to change one word. Not knowing Ctrl-X/C/V.
Vim(and I guess emacs) are another layer on top of that.
I have had to do a little with Visual Studio in the past, and I feel like you spend more time learning the IDE than you do learning to code. I think I will stick with Atom and leave Vim, Emacs et al to the full timers!
Suppose you want to move a few lines of code from one function to another in a regular GUI text editor. If you select these lines with a mouse you need to be careful about exactly where you click to start highlighting and where you end highlighting. Do you start from the beginning of the first line or from the end of the previous line? Do you include the new line at the end? (Can you even?) Then, when you paste, where do you paste? Do you just put the cursor on the line you want to paste before and paste? Or do you put the cursor at the end of the line you want to paste after, hit enter and then paste? Oops, you did it wrong and now this the first line isn't indented at all, or now you have two lines of code on one line.
After a while you figure out where you need start and end the selection, and where you need to paste, but it's still easy to mess up.
This isn't an issue in vim. Using Visual Line mode selecting and pasting is super simple. 'V' to enter visual line mode, 'j' and 'k' to highlight everything you want (and 'o' to switch which end of block you're moving!), 'y' to yank (copy) or 'd' to delete. Then put the cursor _anywhere on the line_ that you want to paste after and hit 'p'.
The ease of use is one thing, but I also think it makes more sense to have an entire line be a fundamental unit. When you're editing code, you're usually moving codes around or editing single lines. I rarely copy and paste just one part of a line to another, and I think in most cases it's easier to just paste the line and change the parts I don't want.
Then, Vim automation (like doing a search/replace) seems more straightforward
It's also useful when vim is all you have (remote systems or if your X server became borked)
But Atom is fine and you shouldn't worry about it
some people don't care about those things, some people do.
However I did give vim a try eventually and use it now exclusively, but the reason I like it is comfort. Navigating around and doing operations is sooo much more comfortable now that I don't have to use a mouse or repeated key presses, plus all the many helpful shortcuts it has.
So it has keyboard shortcuts, and I guess I could add those to another editor...
Is it one of those things you just have to take someones word for it, have a go with it and see?
For example, in another editor you might have ctrl-K to delete a line (dd in vim) , but what about deleting 4 lines? in vim, it's 4dd.
Or you might want to delete from the start of a block to the end... The motion for block in vim is %, so to delete a block, you'd do "d%". Similarly, deletion to the end of the line is d$
In visual block mode (ctrl-v) you can select a bunch of text and apply an action (eg. a simple replace, which would be :s/foo/bar) on only that text.
Even if you just learn a bit at the surface, the free composability of motions with actions makes even classic vi (which doesn't even support arrow keys for moving around) extremely comfortable to use, and most of the time you don't need to twist your hands into uncomfortable chords involving multiple modifier keys.
There are different paradigms in development environments, Unix+a text editor is one. There are also those like Emacs, Acme, and usual IDEs. One has to choose which is better for their use. Say if you're a Mac or iOS dev maybe XCode is better for you, but if you're writing C, Perl, Python, etc., Unix & Vi is a nice environment. If you're doing Lisp, Emacs is the best environment out there (though Emacs and Vim are extensible, so they have some tooling for all the languages out there).
The latter is rather subjective. I love vim for small projects, which, being a grad student, is most of what I write. However, I prefer IDE's for large projects with multiple files and hierarchies.
One thing I have noticed however is, that once you are good at the vim keyboard shortcut "language" (as someone described it above), you tend to use other features in the editor a lot less. And if you don't use the features, you might as well just use vim neat.
My focus was on portability, I switch systems alot, I don't know how practical carrying all these plugins around is but have not given vundle a try yet.
I have to say that working with VIM feels like a weekly/monthly epiphany's. I will discover something new that can be incorporated into my workflow and can't believe what I'd been missing all along.
Xah Lee created one for emacs. Has anyone given it a try?
This is not a problem when editing existing files.
Also I think some keyboard shortcuts are not comfortable on an AZERTY keyboard layout.
Also people often duplicate Esc to the "jk" combination. I personally use ^L instead, but for no particular reason.
On AZERTY keyboards, the nastiest shortcut for me is ^[ ("jump to tag", which is ctrl-AltGr-5). I simply remapped it to F2. A second one is ` (backtick, altGr-7), which I remapped to ' (tick). I did not move tick somewhere else, it wasn't useful enough to me to bother doing it.
See :map and :noremap for how to do these things.
Agreed. That's why I switched to the US international layout. Took me only one week to train my fingers. And it's not that hard when I have to use someone else's computer (somehow I didn't forget the azerty layout :D).
Another site with good general advice is https://www.vi-improved.org/