News for hackers. Stuff that matters.
Re:To Master Vim, Use It Like Language by thesteamboat on Thursday October 01, 2015 @11:07PM (#10316483)
Aiming to combat "you don't know what you don't know", here's a list of things to consider. How comfortable are you with:

* find/replace/regexes

* registers and macros

* vim settings (spell, list, highlight, number, wrap)

* the plugin ecosystem

* editing multiple files simultaneously (splits, buffers, moving between them)

* folds

Anyone else want to chime in with stuff I've either forgotten or don't know I don't know?

Re:To Master Vim, Use It Like Language by uxcn on Thursday October 01, 2015 @11:54PM (#10316644)
Marks (non-global, global), the quickfix list, tabs, vimscript, python bindings, there's a lot.

Vimcasts (http://vimcasts.org/) has some good tutorials. Vimgolf (http://vimgolf.com/) also has some good exercises.

Re:To Master Vim, Use It Like Language by thesteamboat on Friday October 02, 2015 @12:19AM (#10316709)
Oh neat! I didn't know about global marks before.
Re:To Master Vim, Use It Like Language by uxcn on Friday October 02, 2015 @12:36AM (#10316753)
Capital letters and numbers are global, lowercase is buffer local. There are also dynamic marks that vim sets which you can use instead of manually navigating or setting marks. For example, g'. will go to the position of the last change. You can use :help marks to get a lot more info.
Re:To Master Vim, Use It Like Language by mangamadaiyan on Friday October 02, 2015 @01:30AM (#10316885)
Slightly tangential, I also found "Your problem with Vim is that you don't grok Vi" a good source of things to learn from. While it starts off sounding like a rant, it isn't - I think it actually manages to convey a fair bit of the philosophy :)

HN thread: https://news.ycombinator.com/item?id=2911930

Re:To Master Vim, Use It Like Language by markmontymark on Friday October 02, 2015 @12:36AM (#10316754)
Ag support and ctrl-p

https://github.com/rking/ag.vim https://github.com/kien/ctrlp.vim

Save me so much time opening files and finding matches+open-at-match

Re:To Master Vim, Use It Like Language by tankm0de on Friday October 02, 2015 @01:13AM (#10316834)
the active fork of ctrl-p https://github.com/ctrlpvim/ctrlp.vim
Re:To Master Vim, Use It Like Language by loaaa on Friday October 02, 2015 @01:16PM (#10319857)
+1 ctrl-p, my favorite vim plugin
Re:To Master Vim, Use It Like Language by DoggettCK on Friday October 02, 2015 @12:19AM (#10316710)
Opening a new buffer. Figured I'd try :new, and wound up getting good at splits. Still don't know how to just open up a new, blank buffer in the window I'm in without specifying a filename to :e.
Re:To Master Vim, Use It Like Language by mangamadaiyan on Friday October 02, 2015 @12:27AM (#10316731)
If you don't mind getting your hands dirty with a little vimscript, you can set the buftype to nofile, and open a "scratch buffer" of sorts.
Re:To Master Vim, Use It Like Language by snorge on Friday October 02, 2015 @12:28AM (#10316737)
:enew
Re:To Master Vim, Use It Like Language by mangamadaiyan on Friday October 02, 2015 @12:46AM (#10316779)
Thanks :) I'd completely forgotten about enew.
Re:To Master Vim, Use It Like Language by DoggettCK on Friday October 02, 2015 @10:04PM (#10322326)
Just what I needed. Thanks!
Re:To Master Vim, Use It Like Language by base698 on Thursday October 01, 2015 @11:24PM (#10316559)
I asked on /r/vim about "Who uses folds?" Didn't get any takers. I always forget they exist and haven't used them in my workflow yet.

Tag files would be another good one.

Re:To Master Vim, Use It Like Language by mdup on Friday October 02, 2015 @03:13AM (#10317132)
I use them all the time (I've switched them on by default in .vimrc) while editing C++ code. Extremely, extremely helpful to get the structure of a file at a glance. For example, if a 400-line file has about 10 functions in it, you can fold all "zM" and instantly you see only the function signatures, while the bodies are folded.

How to enable it: use "set foldmethod=syntax" (with C++) or "set foldmethod=indent" (with JS, where "syntax" doesn't work for me). Also, I use "set foldminlines=0" so that 1-line paragraphs get closed as well (it looks more consistent).

How to use it: close all folds "zM" (I remember it because the M is shaped like it's all folded on itself). Open all folds "zR". Open one fold "zo", close one fold "zc". Open one fold recursively "zO", close one fold recursively "zC".

By the way, I almost never use manual folds, so "zf" is almost useless to me.

Re:To Master Vim, Use It Like Language by dnr on Friday October 02, 2015 @12:03AM (#10316682)
I use folds for one specific thing: I have a general "notes" file for home and for work, which is a big outline where I put anything I'm thinking about or working on. I usually don't delete stuff, so the file grows over time. I make a fold for each top-level item (~project or subproject) and sometimes nested folds if things get too big. I always use fdm=marker. The automatic fold methods are too confusing.

Everyone uses tag files, in some sense, when they use :help :)

Re:To Master Vim, Use It Like Language by revscat on Thursday October 01, 2015 @11:54PM (#10316647)
I don't use folds that often, but when I do they are be extremely helpful. When you run across that block of code that's way longer than it should be, and need to collapse it so you can see the context around it, folds can be very useful. Also for taking care of long comment blocks.

So while I agree with you in that they aren't a part of my typical workflow, they are a piece of vim that I'm glad I familiarized myself with.

Re:To Master Vim, Use It Like Language by alarge on Friday October 02, 2015 @01:43PM (#10320056)
I couldn't live without folds. Whether I'm in C++, Java, Go, Ruby, or a custom ASCII report I've written, I use them extensively. I add fold tags around every method/function implementation, and sometimes an additional one around around groups of them (e.g., classes). I generally set foldlevel to 0, so most files I enter have a few intro lines and then N folds, so that even large (1000+ lines) source files fit into a single page or two. I almost never use searches or tags to find declarations, since I can usually navigate to them directly with a single keystroke.

FWIW, I map <Space> to za, so that I can unfold/refold quickly. I also map - to zx to quickly fold up a file I may have drilled some holes in.

Re:To Master Vim, Use It Like Language by lemonberry on Friday October 02, 2015 @12:53AM (#10316792)
I use them for learning a library or framework. I'll fold all of the functions, methods, etc. in a file and and then unfold to dig deeper. I work on a 13" mba so it helps with the lack of vertical screenspace.
Re:To Master Vim, Use It Like Language by dghf on Friday October 02, 2015 @03:21AM (#10317150)
I still don't fully understand how folds work (e.g., how can I get them in my JavaScript files by default?), and thus I find them difficult to work with, but when I can get them to work, I'm very glad of them. They make navigating round a large file much easier.
Re:To Master Vim, Use It Like Language by colordrops on Thursday October 01, 2015 @11:53PM (#10316641)
I use them. They don't help as much with new development, but when editing a large pre-existing code base it makes perusing the contents of a file much easier. It's like getting a table of contents for free if your code is cleanly organized.
Re:To Master Vim, Use It Like Language by ijaaz on Tuesday October 13, 2015 @08:30PM (#10384361)
Ugh. I still haven't truly mastered buffers/splits. It's all because I'm too comfortable with tmux :(