One thing google can do that blows most peoples mind when I show them: Did you know vim supports time travel undo?<p>Sometimes you do some things then undo and redo trying to get back to a certain point in time. In vim you can step forward and back through all this by doing "g-" or "g+" to travel backwards or forwards in time. Or you can say ":earlier 50s" to go back to where you were 50 seconds ago.<p>Most editors treat undo as a linear thing, you undo and you redo. But once you undo and then do some things, it starts looking more like a tree than a line. It's not frequent, but sometimes I just need to say "I know what I had was what I wanted 5 minutes ago."
OP should consider using buffers: you can <i>:ls</i> to display the list of buffers (which I have mapped to <i>gl</i>) and then <i>:bn</i> (where <i>n</i> is a buffer number) to go to some specific buffer. Also, in the same fashion of <i>gt</i> and <i>gT</i> for tabs, I mapped <i>gb</i> to go to the next buffer, <i>gB</i> to the previous one, and <i>g space</i> to go to the last one. IIRC all these key bindings are unused by default. In my opinion tabs are more useful/interesting when you work with multiple windows layouts.<p><a href="https://github.com/pera/vim/blob/master/.vimrc" rel="nofollow">https://github.com/pera/vim/blob/master/.vimrc</a>
I use (Vim IMproved - not vi) vim all the time. I find it interesting to see what features other people tend to use in vim, there seems to be some minor differences in their workflows, but it's not clear who "wins" the productivity battle.<p>I only use a <i>very</i> small number of it's features:<p>* `:tabe` Create a new tab<p>* `:e .` Start browsing files in that tab<p>* `:w` Write the file<p>* `:q` Quit the file (`:q!`, seriously, please do quit the file)<p>* CTRIL+SHIFT+UP/DOWN To switch tab (doesn't reliably work on every machine)<p>* `/WORD` To search for something<p>* `:NUM` To go to a specific line<p>* `i` To insert<p>* SHIFT+V to select lines<p>* `d` To delete lines<p>* `x` To extract lines<p>* `y` To "yank" (copy) lines<p>* `p` To paste lines<p>>Here are a few things I wish I could do better:<p>I don't have a great memory, so memorizing more than what I use every day is a little too much. One thing that I'm working on remembering is the ability to replace strings (although I don't really like regex).<p>>Would I learn Vim again?<p>I'm yet to experience anything compelling enough to stray me away. The advanced features are there if I ever need them, but for the most part I am free to have a lightweight editor.
I know you said that you like maintaining a super minimal .vimrc, but fwiw there's a couple of plugins that really helped me with the workflow issues you mentioned struggling with:<p>> Jumping around in longer texts: I know the basics, like searching (/), jumping to a matching bracket (%) or jumping to specific lines (for line 10, type 10G), but I still could use symbols more often for navigation.<p>vim-sneak is real nice for this, and has turned into one of my most-used movement commands <a href="https://github.com/justinmk/vim-sneak" rel="nofollow">https://github.com/justinmk/vim-sneak</a><p>> Using visual mode for moving text around: Sometimes it can be quite complicated to type the right combination of letters to cut (delete) the text I want to move around. That's where visual mode (v) shines. It highlights the selected text. I should use it more often.<p>vim-move was a game changer for me <a href="https://github.com/matze/vim-move" rel="nofollow">https://github.com/matze/vim-move</a><p>> Tabs: I know how tabs work, but all the typing feels clunky. That's why I never extensively used them. Instead, I mostly use multiple terminal tabs or an IDE with Vim bindings for bigger projects.<p>This is worth a read: <a href="https://joshldavis.com/2014/04/05/vim-tab-madness-buffers-vs-tabs/" rel="nofollow">https://joshldavis.com/2014/04/05/vim-tab-madness-buffers-vs...</a>. Buffers + vim fzf is a really nice workflow <a href="https://github.com/junegunn/fzf.vim" rel="nofollow">https://github.com/junegunn/fzf.vim</a>
After using vim for a few years now, I noticed how I changed from thinking about text as characters to thinking about text as lines, which lets me create much cleaner code (independently from pretty printers).<p>When I selected code via mouse in the past, I selected it from character to character. In vim I tend to think line-wise so I can yank, paste, delete code per line which makes sense in many scenarios.
Surprised to see that he's gone back to an empty vimrc after years with high customization. To me customization is such a great part of vim that I can't imagine being without it. For instance, I have shortcuts to find and replace on visual selection. I also have at least 5 plugins in my vimrc that are absolutely necessary for my workflow. Pure vim is nice if you need to occasionally edit files, but if you use it as your prime editor its not enough without customization.
One built-in feature (not enabled by default) that I absolutely love is persistent undo. <i>Love</i> it.<p>Basically, undo trees can be persisted across vim sessions. Have a read via ":help undo-persistence".
One current problem I have with Vim is those linux distributions where someone - maybe the VPS vendor/hosting company - put in some mystery .vimrc file somewhere that makes the editor apparently more friendly for new users. So you copy and paste a line to your mysql config file, to restart the database service and find that nothing has changed. So then you edit the file again and discover that the mystery .vimrc file has added a '#' at the start of the line.<p>Another one that gets commonly messed with is the search. If you use '/' then you should expect the search to begin when you press the enter key, with the usual 'n' to go to the next match. But no, some mystery .vimrc file has made this more newbie friendly, so the search happens before pressing enter. Which is not what you want if standard, expected behaviour is expected.<p>For reasons of teamworking I have moved away from vim plugins in the IDE, for this I have had to buy a new keyboard. Normally I do not use a full keyboard as that number block on the right hand side has no value whatsoever to me. If I was right handed and did accounts then sure, that would be a handy feature, but the number pad is really just not helping for me, most of the time, particularly on a laptop where the numpad skews the keyboard off to the left hand side. I want the spacebar in the centre, not an inch or so off skewed to one side.<p>So my new discovery - the gaming keyboards that have the home/end and arrow keys but no number block - I think they are called 87 key keyboards. These are great if 'moving away from vim' as the 'home/end' keys make it easy to get to a start/end of a line. Under normal circumstances with vim there is no need for these extra keys, to add to the end of a line or the start is just a matter of using the right keystroke, just 'o' or 'a' is all that is needed with the magic that is vim.<p>Moving away from vim is quite dangerous, for a while you find programs breaking because there is a block of 'kkjjj' or an 'i' embedded in there somewhere!
The point in the article is that the Vim keyboard bindings are most useful. Most editors have an option or plugin for that. That's what I use mainly. For instance I use Visual Studio + Resharper + VsVim ( + AceJump + RelativeLineNumbers) as my main development enviroment. I also use webstorm configured in a similar fashion. Visual Studio and R# understands the code and how to manipulate code far better than anything in the Vim world does, but I use it in combo with Vim keyboard bindings and it becomes incredibly quick to do things.<p>I don't actually use Vim itself very much ( I still use it for various things, but its not my main editor ). Its nicest attribute is for quick editing tasks it loads quick and can load very large files.
Vim user here. One thing I rarely see discussed is the idea that vim is not about speed. It's about comfort.<p>Maybe hjkl is a little faster than arrow keys. I don't care. I just like doing my editing with less hand movement.<p>I'm sure that I could perform many operations faster with a mouse. Select text, drag it a little below. Probably faster than d}}p even. The point is, mouse is finicky and annoying. The context switch between typing and moving the mouse breaks flow. Aiming the pointer is hell, and even worse if the target is small or the mouse of low quality. Anyone who plays click-heavy video games (RTS, many MMOs, 4X) can probably understand the pain of dragging the cursor between two points and clicking repeatedly.<p>Vim is terrible. It takes a while to learn and when you've learned it well enough you're spoiled and everything else feels painful. Vim is the closest I can get with current technology to a neurally linked brain-controlled editor. It feels like the cursor obeys my thoughts, not the limits of my manual dexterity. The next step would be an editor actually wired to my brain where I just think what the text should look like.
One thing I noticed when working with people who are only familiar with IDEs for coding and GUIs for version control: they're helpless on remote servers. If they need to jump on a box and debug an issue live, they just can't do it. For me, using tmux + vim + git cli locally, my workflow remains exactly the same remotely.<p>Tools are nice, but don't let them make you weaker.
Tabs are great for organizing groups of related files. They are different from other editors that only let you have one file per tab.<p>With Vim you could split a tab with a frontend HTML and CSS file, and have a couple of backend files in another tab. Then `gt` or `gT` to switch between the groups.<p>If you use nerdtree, `t` opens a file in a new tab, so you don't need to type `:tabnew` often.
Nowadays, I prefer Kakoune ( <a href="http://kakoune.org/" rel="nofollow">http://kakoune.org/</a> ) to vim. Being based on selections rather than movements feels much nicer. It feels a bit like always being in a kind of visual mode. That said, there are the following caveats:<p>* Vim tends to be installed/available almost everywhere, Kakoune isn't<p>* Vim has a much bigger ecosystem<p>* There are some very advanced features hidden in vim that most people don't know about. If you depend on those, substituting vim with another editor can be hard.
> I don't use arrow keys to move around in text anymore but forced myself to use h, j, k, l. Many people say that this is faster. After trying this for a few years, I don't think that is true (at least for me). I now just stick to it out of habit.<p>Sounds like he's not a touch-typist.<p>And as a general note; learning and mastering vim can hardly be a pleasant activity for non touch-typists, or otherwise typing heroes.
I read an article a few years ago, the name of which escapes me. It was something like “Idiomatic Vim” or “Linguistic Vim”. I would love to find that article again, if anyone happens to know based on the sparse info I’ve just provided, I would greatly appreciate it.<p>One of the things I learned was that you can do things like yank to a character. In other words, if your cursor is at the beginning of “The quick brown fox jumped over the lazy dog” you can type ‘ytx’ (Yank To to the “x” next “x” character) and it’ll yank “The quick brown fo”. That’s really handy with code, I find.
All of the points in the "Some things I wish I could do better" section are the reason I use a regular memorization free-ish IDE.<p>Out of the box the things I want to do are easy (multiple files, manipulating structure of blocks of text, searching and manipulating information across my project simultaneously) and the things that aren't are rare (Add a dollar sign at the beginning of the next 13 lines).<p>I know how to use vim solely because it's necessary to edit files in a terminal.
Regarding tabs: I bound F2 to previous tab, F3 to next tab and F4 to new tab.
Besides highlighting the current line, I think this is my most important customisation.
Whenever vim comes up I see someone trying to sell the audience on some "amazing", obscure and rarely used feature that users of other editors should be jealous of... However, it seems to me that if anyone <i>actually wanted</i> those features then they'd be standard in other text editors and we'd have them already.<p>But what I find really hilarious is that whenever these features are mentioned I see people who have been using the thing for a decade say "I never knew that!" or they dicker about what the commands actually are.