Vim Tips Wiki
(keep html tags tip, and nice job with the discuss column - looks great!)
Line 289: Line 289:
 
--[[User:Fritzophrenic|Fritzophrenic]] 15:52, 9 January 2008 (UTC)
 
--[[User:Fritzophrenic|Fritzophrenic]] 15:52, 9 January 2008 (UTC)
 
----
 
----
  +
Good idea (to create a suitable category). I agree with your point that a tip with nothing but a regex is pretty useless and irritating. I added your "Advanced Regex" or "Regular Expressions" category to my local todo file and intend looking at it further. You can do it now if you like, but I was going to think a bit more about what tips would go in which of these. The "Regular Expressions" doesn't quite sound right because such a category should probably be about explaining regexs in some detail. So I favour "Advanced Regex" but was going to look for some more examples before implementing it. --[[User:JohnBeckett|JohnBeckett]] 03:36, 10 January 2008 (UTC)
   
 
==[[Check your syntax files for configurable options]]==
 
==[[Check your syntax files for configurable options]]==

Revision as of 03:36, 10 January 2008

New tips June to December 2007

For each proposed new tip:

  • Is it worth keeping as a separate tip?
  • Should it be merged into an existing tip? Which?
  • If it should be kept, is it ready for release? Which points need fixing? Should it be renamed?

Please edit this page (not the talk page) in the appropriate section below the following table.
Alternatively, comments can be posted on the mailing list.

Proposed new tip Link Current consensus
$ instead of 4 discuss Keep
Automatic Commenting of Preprocessor Directives in C discuss Keep
Automatically Update Copyright Notice in Files discuss Keep
Automatically add ifndef ... to a C header file discuss -
Automatically create and update cscope database discuss -
Automatically fitting a quickfix window height discuss -
Changing all HTML tags to lowercase discuss Keep
Check your syntax files for configurable options discuss Keep
Create patch for currently editing file discuss -
Decrease chances of file corruption in case of computer crash discuss -
Displaying the current Vim environment discuss -
Dosini folding discuss -
Easy Buffer Switching Without a Plugin discuss -
Exchanging adjacent words discuss -
Fast jump to next variable on the same line (php programmers ) discuss -
Fix errors that relate to reading or creating files in the temp or tmp environment on an MS Windows PC discuss -
Format javadoc discuss -
Formatting paragraphs in LaTeX: an "environment-aware gqap" discuss -
Get the most out of the latest Vim Editor with Hacking Vim! discuss -
Hide dos lineends discuss -
Icomplete discuss -
Improved Hex editing discuss -
In line copy and paste to system clipboard discuss -
Increase/decrease fontsize using a map ala FireFox discuss -
Keep your vimrc file clean discuss Keep
Key maps using the Alt modifier discuss -
Learn to do it by hand! discuss -
Make MRU plugin open files in tabs discuss -
Making CapsLock work in Vim discuss -
Map cut copy and paste to Windows defaults discuss -
Mapping keys in Vim - Tutorial (Part 1) discuss -
Mapping keys in Vim - Tutorial (Part 2) discuss -
Mkdir on edit if needed discuss -
Open Filename with "gf" discuss Delete
Search and replace in all buffers discuss -
Search keywords in c function discuss -
Search keywords in c++ function discuss -
Set gvim window size discuss -
Set options or named registers with let discuss -
Short help for PHP functions inside of Vim discuss -
Show parts of line that make it longer than 80 chars discuss Keep
Swap LHS and RHS of an Assignment statement discuss -
Swap file "..."already exists! - so diff it discuss -
To switch back to normal mode automatically after inaction discuss -
Use :next to search for files in the current directory discuss -
Version Control for Vimfiles discuss Keep
Vim Doclet discuss -
Vim On Vista discuss Probably delete
Word frequency statistics for a file discuss -
X11-clipboard support in terminal discuss -

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

General comments (not for a specific tip)

$ instead of 4

Simple tip with a simple mapping. It's useful and adaptable enough to be not TOO bad, though. It does need to be fixed - the imap given will just insert some text - but other than that, I'd probably keep it.

--Fritzophrenic 15:29, 8 January 2008 (UTC)


Keep this. It's cute. Have you got enough time to fix the imap? --JohnBeckett 02:14, 9 January 2008 (UTC)


Automatic Commenting of Preprocessor Directives in C

Very clever and well-commented function - the author can be proud. It could prove very useful, and illustrates some clever things you can do with the :s command used inside a function. I'm a little worried that it may not be very adaptable to other ideas, and that the illustration of Vim concepts may be hidden by the script, but I'd keep this one. It is not overly complex, and the code is well-explained enough through comments that people may be able to glean some new ideas out of it as well as using it as-is for a useful tool.

--Fritzophrenic 15:29, 8 January 2008 (UTC)


Keep this. I have to note that I hate the kind of superfluous comments created by the tip! However, it's a big world and I know some like them, particularly on long ifdef/endif. --JohnBeckett 02:14, 9 January 2008 (UTC)

Automatically Update Copyright Notice in Files

Disclaimer: I submitted this tip.

I like this tip a lot and it has proved very useful to me. It does a good job highlighting use of the :g and :s commands, strftime function, BufWritePre autocmd event, and use of an option's value in an if statement (&modified, to be exact). Unlike other complex regular expression example tips, this tip explains in detail exactly what each part of the regex does.

However, I can see why somebody might not like it, because it is fairly complex, probably not very commonly needed, and there are already similar tips:

This tip should probably be merged into one of these, because it does do a much better job explaining the regex, and I really like the use of the :g command.

--Fritzophrenic 19:19, 7 January 2008 (UTC)


Keep this. Merge 97 and 890, but don't merge this with them (result would be too complex). Include a link "See also" (not "See Also") in each.

--JohnBeckett 02:14, 9 January 2008 (UTC)


Automatically add ifndef ... to a C header file

More explanation for the implementation needs to be given, but assuming it works, this tip could be very useful. It looks fairly simple, using mostly basic commands, so explaining it shouldn't be difficult. As noted on the tip, however, a better thing to do would probably be to merge it into VimTip514.

--Fritzophrenic 15:29, 8 January 2008 (UTC)


Let's be brutal and delete this. Add its content (which I haven't checked) to VimTip514. BTW this tip is not "automatic" - you have to press a key (a good thing IMHO). --JohnBeckett 02:14, 9 January 2008 (UTC)


Automatically create and update cscope database

Keep this. Haven't checked it, but it has history and looks good. --JohnBeckett 02:40, 9 January 2008 (UTC)


Automatically fitting a quickfix window height

Keep this. I edited the tip to put Fritzophrenics' arguments in (min,max) order. Change if you like. --JohnBeckett 02:40, 9 January 2008 (UTC)


Changing all HTML tags to lowercase

This tip lists 2 complex regexes with no explanation that are simple enough to be written from scratch when needed. I think this tip is an excellent example of a useful application of the substitute command, but I don't think it teaches anything new. I remember seeing the exact same sort of thing in another tip, used as an example to illustrate a point, though I can't remember where I saw it, and it converted to uppercase rather than lowercase.

I recommend deleting this one.

--Fritzophrenic 19:19, 7 January 2008 (UTC)


I think you underestimate your regex ability. I imagine there are many Vimmers who would struggle to reproduce this tip, and since it does something that at least sounds useful, I'm inclined to keep it. I totally agree that the tip is horrible with no explanation. However, we've got plenty of mystery tips, so I would just add a todo to this, and hope that one day I could get someone from vim_use to add a brief explanation. --JohnBeckett 02:14, 9 January 2008 (UTC)


Hmm...I've taken a closer look. The first regex is (in my opinion) overly complex for what it accomplishes, but still fairly simple. This is where I stopped looking the first time - my mistake, because the second one is where things get interesting. It is complex enough that I had to try it out to convince myself that it actually works (which it does, although the description is slightly misleading). I can certainly see your point...it would probably take me some time to reproduce these, and they use some advanced concepts that many Vimmers would not think to use or even know how to use. If these concepts were brought to the foreground of the tip, I'd probably like it better.

So, here's my take:

I don't like tips that simply post a clever regex or script, with no real explanation. I especially don't like such tips when the problem solved by the regex or script is a simple one that doesn't really need a complicated solution, or if the problem is a very specific one. This particular tip is probably useful to many people, and the problem solved is much more complicated than it first appears, so after a more complete look I actually kind of like it. I can certainly see the value in keeping it, especially when the regular expressions are explained, simplified, and improved (as they will be - this is a wiki!), but this and other similar tips have the potential to become VERY widespread. I can't count the number of times I've written a complex regular expression to accomplish a complicated task. But, the true value isn't the final regex, it's knowing how to write it. So, what if we create a category to contain tips such as this one that are primarily just examples of complicated regular expressions? It would be a place to go to look for specific pre-solved problems, a place to browse a bunch of examples of advanced concepts to spark your own ideas, and a place for people like me to shuffle new tips off to so that we don't immediately cry "delete!" for a tip that many would see value in. We have a "searching" category, but I think this category is better used for very general tips about searching, perhaps with specific illustrative examples. I think that an "Advanced Regex" category or a "Regular Expressions" category would be a good place for tips like this one, that give regular expressions for a very specific purpose, probably constructed over a long period of time and tweaked again and again, intended for later reuse.

--Fritzophrenic 15:52, 9 January 2008 (UTC)


Good idea (to create a suitable category). I agree with your point that a tip with nothing but a regex is pretty useless and irritating. I added your "Advanced Regex" or "Regular Expressions" category to my local todo file and intend looking at it further. You can do it now if you like, but I was going to think a bit more about what tips would go in which of these. The "Regular Expressions" doesn't quite sound right because such a category should probably be about explaining regexs in some detail. So I favour "Advanced Regex" but was going to look for some more examples before implementing it. --JohnBeckett 03:36, 10 January 2008 (UTC)

Check your syntax files for configurable options

Disclaimer: this a tip I submitted!

I wrote this tip when I learned about it from the unrelated Auto-fold Perl subs tip. Somebody wrote a complex function for doing syntax folding of Perl scripts, which (although clever) is completely unnecessary because the functionality is built-in already. It just happens to be disabled by default, and the author (and myself) did not realize that it was there, because they did not first check the syntax file for configurable options!

--Fritzophrenic 19:19, 7 January 2008 (UTC)


Keep this. --JohnBeckett 02:14, 9 January 2008 (UTC)


Create patch for currently editing file

Probably keep. --JohnBeckett 02:40, 9 January 2008 (UTC)


Decrease chances of file corruption in case of computer crash

Keep. Needs a comment about the OS, but if Yakov thinks it's ok, I would keep it (but what a hack!). --JohnBeckett 02:40, 9 January 2008 (UTC)


Displaying the current Vim environment

Keep. This was discussed on vim_use. --JohnBeckett 02:40, 9 January 2008 (UTC)


Dosini folding

Flag to fix later (add explanation or delete). --JohnBeckett 02:40, 9 January 2008 (UTC)


Easy Buffer Switching Without a Plugin

Dodgy. Surely there's a better way of doing this? I've forgotten the name of what I use, but it's better than this. --JohnBeckett 02:40, 9 January 2008 (UTC)

Exchanging adjacent words

Let's keep this. Delete most of the comments. Add "See also" to/from VimTip47. --JohnBeckett 02:40, 9 January 2008 (UTC)


Fast jump to next variable on the same line (php programmers )

Probably keep. Maybe rename to "Fast jump to next PHP variable on the same line". --JohnBeckett 02:40, 9 January 2008 (UTC)


Fix errors that relate to reading or creating files in the temp or tmp environment on an MS Windows PC

Flag to fix later (add explanation or delete). --JohnBeckett 02:40, 9 January 2008 (UTC)


Format javadoc

This was originally not a tip, but a request for help. I know the usual policy would be to delete this, but I made a comment that almost fixes the problem brought up. If somebody can fix up my general method, it might make a good tip.

--Fritzophrenic 19:19, 7 January 2008 (UTC)


I think there's too much work required to fix this, and would be inclined to terminate it. Perhaps, with the large number of new tips we are currently trying to sort out, we need a way to flag a tip as "not yet ready to be made a full tip; may delete if it's not fixed before May 2008". Then we could apply that to this tip, move on, and satisfy us both. --JohnBeckett 02:14, 9 January 2008 (UTC)


Formatting paragraphs in LaTeX: an "environment-aware gqap"

Get the most out of the latest Vim Editor with Hacking Vim!

Hide dos lineends

Icomplete

Improved Hex editing

In line copy and paste to system clipboard

Increase/decrease fontsize using a map ala FireFox

Keep your vimrc file clean

I like this tip a lot. I didn't write it, but I could have! It gives good advice about keeping your settings for your vimrc file in places that make sense, making your changes modular, and keeping your vimrc nice and uncluttered.

Keep it!

--Fritzophrenic 19:19, 7 January 2008 (UTC)


Keep this. --JohnBeckett 02:14, 9 January 2008 (UTC)


Key maps using the Alt modifier

Learn to do it by hand!

Make MRU plugin open files in tabs

Making CapsLock work in Vim

Map cut copy and paste to Windows defaults

Mapping keys in Vim - Tutorial (Part 1)

Mapping keys in Vim - Tutorial (Part 2)

Mkdir on edit if needed

Open Filename with "gf"

This tip needs to be removed. First of all, there are already 2 tips (marked as duplicate on this tip) which highlight the same functionality. Secondly, it accomplishes with a mapping something already built-in to Vim. Third, it overrides a common function with this mapping.

Let's get rid of this one.

--Fritzophrenic 19:19, 7 January 2008 (UTC)


Agreed. Delete this. --JohnBeckett 02:14, 9 January 2008 (UTC)


Search and replace in all buffers

Search keywords in c function

Search keywords in c++ function

Set gvim window size

Set options or named registers with let

Short help for PHP functions inside of Vim

Show parts of line that make it longer than 80 chars

Disclaimer: I heavily edited this tip at one point (though I had forgotten this until I checked the page history).

This tip is a great example of fixing a common problem as well as highlighting an uncommon Vim command. I may have been over-zealous in my editing, so somebody may want to restore some of the previous content, but I'd say KEEP THIS TIP!

--Fritzophrenic 19:19, 7 January 2008 (UTC)


Keep this. --JohnBeckett 02:14, 9 January 2008 (UTC)


Swap LHS and RHS of an Assignment statement

Swap file "..."already exists! - so diff it

To switch back to normal mode automatically after inaction

Use :next to search for files in the current directory

Version Control for Vimfiles

This tip is a good idea, and something I hadn't thought of even though it may be obvious to some. But, it doesn't really have much to do with Vim. I'd keep it, but wouldn't be heartbroken to see it go.

--Fritzophrenic 19:19, 7 January 2008 (UTC)


Keep this (although I agree that it would be no loss to see it go). --JohnBeckett 02:14, 9 January 2008 (UTC)


Vim Doclet

Vim On Vista

I have Vim installed on Vista, and it seems to be working fine with none of the hacking this tip suggests. It may be useful for others (I certainly wouldn't want to figure all of that stuff out) but someone needs to find out:

  1. Is this tip needed? Does this problem actually happen on a regular basis?
  2. Does this tip work?
  3. Is there a better way? Preferably a simpler one?

--Fritzophrenic 19:19, 7 January 2008 (UTC)


I'm a bit worried about this tip. It starts by explaining that some unknown problem occurred, and then lists the fairly extreme steps taken to recover. My worry is that the tip could be interpreted as advice that should be followed by general Vista users. I know the first para is intended so readers should not reach that conclusion, but it would be an understandable mistake.

In fact, it's not clear if the author ever established what the problem was, or which of the listed steps were necessary. In these kind of confusing one-off situations, it's not clear to me that the steps taken by one person are of much value to general readers, unless some explanation is provided (a particular problem was noted, and its cause was found to be X, and because of reason Y, the workaround was Z). Pretty well all of the steps look dangerous to me, starting with the source chosen to download Vim.

Also, George Reilly just confirmed Fritzophrenic's point that installing Vim on Vista does not require any of the steps in the tip. See the vim_use archive.

--JohnBeckett 09:36, 8 January 2008 (UTC)


If no one supports this tip soon, I'm inclined to delete it. --JohnBeckett 02:14, 9 January 2008 (UTC)


Word frequency statistics for a file

X11-clipboard support in terminal