Vim Tips Wiki

New tips February 2009

This page is an archive listing tips created in February 2009. 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 Link Current consensus
Associate vimprojects file with vim discuss Merged to VimTip934
Auto tags by project.vim discuss Keep
Default filetype discuss Merged to VimTip130
Delete C Function discuss Merged to VimTip1130
Quickfix and doxygen discuss Keep
Remap CapsLock or other keys without reboot in Windows discuss Merged to VimTip75
Sticky shift-enter (way to avoid Esc) discuss Merged to VimTip285
User input from a script discuss Keep
Using Git from Vim discuss Keep
View text file in two columns discuss Keep

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

General comments (not for a specific tip)[]

Associate vimprojects file with vim[]

Merged to VimTip934 (I intend cleaning 934). JohnBeckett 08:51, 2 July 2009 (UTC)

Merge? I don't like the registry tips (for one thing, they inevitably will cause trouble on some systems). I don't see the point of this being a separate tip (it's really something to do with Windows), and I'll think about merging the "Using console utilities" section into the next tip, which is also on project.vim. JohnBeckett 11:29, 30 May 2009 (UTC)

I think this is a pretty good stand-alone tip, mainly because I wouldn't have thought of doing it, even though it is fairly obvious and potentially very useful. If we had a generic "using project.vim" tip maybe we could merge, but I don't think we do. That being said, I mostly agree; registry tips always make me nervous. How about we create an "editing the registry is dangerous" template that we can add to all the registry tips (including the one I'm working on) with text similar to that which I just added to this tip?

Fritzophrenic: Re what you're working on: I'm planning to merge 1037 to 934, then cut out some of the stuff that's unlikely to have wide appeal (i.e. omit setting an association so you can use Explorer to double-click a .vim file to invoke Vim to execute the script), and possibly renaming the tip (not sure to what). Then merge this tip into 934 (so 934 will be about file associations to open Vim session files and Project plugin files). I'm trying to make sense of some of the weird (and unexplained) registry settings in 934 and 1037, and think I might just omit everything except how to create a file association. While thinking about this, I see that it will have quite a lot of overlap with what you are doing. That's not a problem ... I'm just alerting you to what I hope to do in the next couple of days. JohnBeckett 07:41, 25 June 2009 (UTC)

Regarding the planned merge, it's not that easy to see what your intent is (or what sort of title it could have). After thinking about it a little, it would be kind of neat to have a "Useful non-obvious Windows file associations" tip (with a better title) that can do things like automatically run a Vim script, launch a session, or open a project file. Depending on the title and flavor of the tip, we might even merge in Associate files with no extension to Vim under Windows, but I think VimTip1003 is a better place for that one (if we want to merge it at all). Let me know if this is not the sort of thing you had in mind.

When doing the merge, I would actually dispense with all the registry stuff. The ftype and assoc commands work perfectly well to accomplish the file associations, and are much less scary to use/safer to recommend. The other registry stuff appears to be messing with the "open with" menu, adding descriptions of each filetype created, and in this new tip, to set the icon to display for files of the filetype (which I think Windows will do for you anyway). To top it all off, to the best of my knowledge all three of these tips do it wrong! They use the "edit" action, which is usually chosen by right-clicking on the file and choosing "Edit" from the context menu. I think it is the case that "Edit" is done on a double-click if no "Open" action is defined, but I would find it very unintuitive if I chose "Edit" from a context menu to run a script. I think we should include the registry method of setting up an "Edit" action (to open the file in Vim, of course) in VimTip1003 and just link to it from the merged tip. I can see the use of automatically running a Vim script when I double-click, but I don't want to lose the ability to look at the script by choosing "Edit" instead.

Regarding my recent drafted tip, I think (since most users probably don't need to worry about user-specific file associations) that we can just use ftype and assoc in most of our tips, so we can avoid messing with the registry directly where possible. We can move my draft for user-specific file associations to a real tip and link it in the "see also" or in the text of each file associations tip in case it is needed. I know that when I see "merge this registry file..." as the main content of a tip, I tend to move on, especially if each entry is not explained.

In the end, we'll have three tips: a generic everyday file associations tip, a user-specific file associations tip, and an uncommon/fancy/non-obvious file associations tip resulting from your merge.

--Fritzophrenic 15:04, 25 June 2009 (UTC)

I've had a slight change of heart. I think I'll merge my user-specific file associations draft into our existing file associations tip and make that one our generic "here's how to create a file association" tip. From that tip, we should link the special-use file associations tip resulting from the merge of this new tip, as well as others like our open in tabs tip. I will merge Associate files with no extension to Vim under Windows into VimTip1003 as well, since it is a clarification of the general method in a corner case, not anything new. Sound good?

--Fritzophrenic 14:24, 26 June 2009 (UTC)

Auto tags by project.vim[]

Keep I haven't studied this, but it seems good. JohnBeckett 11:29, 30 May 2009 (UTC)

Default filetype[]

Merged to VimTip130 I renamed 130 to make it more general. It can be our "using filetypes" tip. JohnBeckett 04:37, 24 June 2009 (UTC)

Merge to 1606 Filetype.vim. There must be a better way to do this? Can someone check it. I think the result should go in 1606. JohnBeckett 11:29, 30 May 2009 (UTC)

Agreed. Though Filetype.vim says it is about the filetype.vim file itself...don't we have a generic "using filetypes in Vim" tip? --Fritzophrenic 14:49, 22 June 2009 (UTC)

Delete C Function[]

Merged to VimTip1130 (which I will generalise). JohnBeckett 10:37, 23 June 2009 (UTC)

Merge to somewhere in a tip on editing source code. I'll think about where later. JohnBeckett 11:29, 30 May 2009 (UTC)

Agreed, I don't find this tip very useful by itself. I can't think of anywhere to merge it to though. Do we need a new "merge this tip somewhere" category/template? --Fritzophrenic 14:49, 22 June 2009 (UTC)

Quickfix and doxygen[]

Keep JohnBeckett 05:22, 21 June 2009 (UTC)

Try to merge to a compiler tip? The only tip dealing with doxygen is 653 Continuing doxygen comments. If can't think of anything better, perhaps merge this new tip to 653 and rename it to something more general like "Working with doxygen files"? JohnBeckett 11:29, 30 May 2009 (UTC)

My vote is actually to keep both of these tips, separately. Doxygen is not a filetype by itself, it's an external program that processes specially formatted C comments, similar to javadoc but with much more information included in the report. I've used it a couple times, it's really nice. I think that it only works with C code, so we can probably put it in Category:C, possibly in a new subcategory. --Fritzophrenic 02:18, 31 May 2009 (UTC)

Remap CapsLock or other keys without reboot in Windows[]

Merged to 75 Map caps lock to escape in Windows. JohnBeckett 11:29, 30 May 2009 (UTC)

Sticky shift-enter (way to avoid Esc)[]

Merged to 285 Avoid the escape key. I have done a lot of work lately to merge all the exotic "avoid escape" tips, and I don't want a new separate tip however interesting. This new material (by Benatkin from Ben Atkin's blog) is a great idea, although the author later blogged that he stopped using the mapping because it was hard to accept the inconsistency of how Shift-Enter worked. I have reworked it and merged into 285. JohnBeckett 07:49, 2 June 2009 (UTC)

User input from a script[]

Keep I have rewritten the tip with an example, and made it more general. Some tips use input(), but none explain it. JohnBeckett 11:29, 30 May 2009 (UTC)

Using Git from Vim[]

Keep We have nothing on git or VCSCommand; perhaps expand later. JohnBeckett 11:29, 30 May 2009 (UTC)

View text file in two columns[]

Keep I have fixed this by merging solutions and cleaning. JohnBeckett 11:29, 30 May 2009 (UTC)