Vim Tips Wiki

New tips January 2008

This page is an archive listing tips created in January 2008. Please do not edit this page because discussion has finished. If you have any comments, edit the appropriate tip page.

Alternatively, comments can be posted on the mailing list.

Proposed new tip Decision
Find in files within Vim Keep
Folding of find locate tar-tf output Keep
Generate accessor and setter methods from variable names Keep

Please add your comment (sign with --~~~~) below the appropriate heading. Use ---- between comments.

General comments (not for a specific tip)[]

Find in files within Vim[]

I really like this tip (well, I submitted it...) and think we should keep it. I created this tip because there was not an existing tip that highlights vimgrep. I've been using Vim for almost a year, and had no idea that there was an easy, integrated "find in files" feature. I had been opening a command prompt (in Windows) and using findstr...which is nowhere near as powerful as vimgrep. There are a couple tips that could use a "see also" with this tip, but the tip is good enough to stay right now. There is a nice conceptual/tutorial-type introduction, then it goes into some more advanced, more specific mappings and other techniques for getting even more out of this powerful command.

--Fritzophrenic 22:29, 13 February 2008 (UTC)

Agreed. We'll keep this. I see in the comments that I wrote "1234 and 1392 are misguided and should be deleted". If you have a thought on that, you might add it to the comments in Find in files within Vim. --JohnBeckett 00:54, 14 February 2008 (UTC)

I've thought a little...I'll get around to it eventually. I'm a bit busy with non-wiki stuff at the moment!

--Fritzophrenic 17:40, 20 February 2008 (UTC)

Folding of find locate tar-tf output[]

I actually have no idea what this tip is trying to do. It needs a lot of work to make it introduction explaining the problem it is solving, how to use the output, etc. I could probably figure out what it is all about, but don't feel like taking the time to do so (especially since I don't really use Unix regularly).

It does look like it might be useful, so...fix and keep? Dodgy? Come back to it later?

--Fritzophrenic 22:29, 13 February 2008 (UTC)

I believe that the tip is to use Vim with a particular script to view the output from certain commands (Vim reads from stdin). Apparently, with the Unix commands mentioned, the output would be nicely folded. I think we can assume it works and keep it, possibly with a little more explanation. --JohnBeckett 00:54, 14 February 2008 (UTC)

I've added a todo and think tip is good to keep. --JohnBeckett 02:20, 20 February 2008 (UTC)

Generate accessor and setter methods from variable names[]

A while ago, we deleted a tip about mapping :s commands to take some string and create a PayPal button in a webpage, or something of that nature. I never saw that tip. However, I think that this tip is of similar nature. It is an obvious application of a :s command to surround some text with some other text. I think the concept is a good one to have a tip about, but we don't need to keep every tip about every possible application of the concept.

That being said, this tip could be made useful. I think this is a fairly common problem that people have, although I don't know of very many that would approach the solution this way (type the variable name, press a key, and watch it transform). It could be more useful if some logic was added to replace with different text depending on what the filetype is. It would be cool also if you could place your cursor on the declaration of the variable, and press a key to insert the accessor/setter method elsewhere.

I guess I am fairly indifferent about this one. I've given my reasons for getting rid of it, but if somebody else finds this useful, keeping it is perfectly fine.

--Fritzophrenic 22:29, 13 February 2008 (UTC)

For the record, the tip we previously deleted can be seen at

I'm sympathetic to your point of view: This tip just has an impenetrable regex to do yet another substitute. However, it looks potentially useful, so I'm inclined to keep it. Your improvements would be great, but unlikely to be achieved any time soon. --JohnBeckett 00:54, 14 February 2008 (UTC)

The tip reads coherently and a reader can quickly work out if they are interested. I'm inclined to not add a todo because we could easily find something to improve on every page, and the resulting todo list would be useless. While the improvements suggested by Fritzophrenic would be great, they would greatly add to the complexity. In practice, a user is likely to be working with one language for a period, and can adapt the regex for other scenarios if wanted. So I say to keep tip as is. --JohnBeckett 02:20, 20 February 2008 (UTC)