Vim Tips Wiki
Advertisement

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 Current consensus
$ instead of 4 -
Automatic Commenting of Preprocessor Directives in C -
Automatically Update Copyright Notice in Files -
Automatically add ifndef ... to a C header file -
Automatically create and update cscope database -
Automatically fitting a quickfix window height -
Changing all HTML tags to lowercase -
Check your syntax files for configurable options -
Create patch for currently editing file -
Decrease chances of file corruption in case of computer crash -
Displaying the current Vim environment -
Dosini folding -
Easy Buffer Switching Without a Plugin -
Exchanging adjacent words -
Fast jump to next variable on the same line (php programmers ) -
Fix errors that relate to reading or creating files in the temp or tmp environment on an MS Windows PC -
Format javadoc -
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 -
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" -
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 -
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 -
Vim Doclet -
Vim On Vista -
Word frequency statistics for a file -
X11-clipboard support in terminal -

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

General comments (not for a specific tip)

$ instead of 4

Automatic Commenting of Preprocessor Directives in C

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)


Automatically add ifndef ... to a C header file

Automatically create and update cscope database

Automatically fitting a quickfix window height

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)


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)


Create patch for currently editing file

Decrease chances of file corruption in case of computer crash

Displaying the current Vim environment

Dosini folding

Easy Buffer Switching Without a Plugin

Exchanging adjacent words

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

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

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)


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)


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)


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)


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)


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)


Word frequency statistics for a file

X11-clipboard support in terminal


Advertisement