Vim Tips Wiki
(Add September archive)
(Try removing summary of current FT (too much work to maintain))
Line 1: Line 1:
'''Please discuss proposals for new Featured Tips on the [[Vim_Tips_Wiki_talk:Featured_Tip|talk page]]. Comments on the current featured tip can be added below (be bold!), or can be added to the comments section at the end.'''
+
*'''Please discuss proposals for new Featured Tips on the [[Vim_Tips_Wiki_talk:Featured_Tip|talk page]].'''
  +
*'''The [[Main Page]] highlights the current featured tip.'''
  +
*'''Add comments on the current featured tip to the comments section on the current tip page.'''
 
----
 
----
   
 
==Now THAT's a Good Tip!==
 
==Now THAT's a Good Tip!==
 
While most of the tips on this wiki are very helpful, every now and then, you'll stumble on a tip that shines above all the rest. Such a tip is a tip that changes the way you do a basic task, a tip that you try immediately and then use all the time, a tip that makes Vim integrate SO much better with your setup, or a tip that you just ''wish'' somebody gave to you when you started using Vim. We here on the Vim Tips Wiki recognize this, and therefore will -- about once a month -- feature a new tip that we feel is among the best of the best. So keep an eye on this page for life-altering (or at least mildly interesting) tips to add to your ''repertoire''.
 
While most of the tips on this wiki are very helpful, every now and then, you'll stumble on a tip that shines above all the rest. Such a tip is a tip that changes the way you do a basic task, a tip that you try immediately and then use all the time, a tip that makes Vim integrate SO much better with your setup, or a tip that you just ''wish'' somebody gave to you when you started using Vim. We here on the Vim Tips Wiki recognize this, and therefore will -- about once a month -- feature a new tip that we feel is among the best of the best. So keep an eye on this page for life-altering (or at least mildly interesting) tips to add to your ''repertoire''.
 
==[[VimTip45|This month's feature]]==
 
The featured tip this time around is [[VimTip45|''Using command-line history'']].
 
 
This tip was first nominated by [[User:Fritzophrenic|Fritzophrenic]]. Thanks for finding this great tip!
 
 
===What's it about?===
 
Make sure you know how to use command and search history. Remember that Vim allows powerful editing commands – there's more to life than the primitive arrow, backspace and delete keys.
 
 
Now you can use all Vim's power in the command-line window to search, copy and edit previously-entered commands and searches.
 
 
See [[VimTip45|''Using command-line history'']] for details.
 
   
 
==Previously featured tips==
 
==Previously featured tips==

Revision as of 23:58, 30 September 2008

  • Please discuss proposals for new Featured Tips on the talk page.
  • The Main Page highlights the current featured tip.
  • Add comments on the current featured tip to the comments section on the current tip page.

Now THAT's a Good Tip!

While most of the tips on this wiki are very helpful, every now and then, you'll stumble on a tip that shines above all the rest. Such a tip is a tip that changes the way you do a basic task, a tip that you try immediately and then use all the time, a tip that makes Vim integrate SO much better with your setup, or a tip that you just wish somebody gave to you when you started using Vim. We here on the Vim Tips Wiki recognize this, and therefore will -- about once a month -- feature a new tip that we feel is among the best of the best. So keep an eye on this page for life-altering (or at least mildly interesting) tips to add to your repertoire.

Previously featured tips

This is an archive of the Featured tip section on the Main Page (started in February 2008). We won't feature these tips again – however, they remain great tips!

September 2008

Vim's command and search history are extremely helpful. Perhaps you use history, but are frustrated from editing the command line with the primitive arrow, backspace and delete keys.

Now you can smile while editing history with all Vim's power in the command-line window. Read how to easily copy some previously-entered commands so you can apply them while editing another file.

August 2008

It's easy to work with CSV files (comma-separated values), if you have the right tools! You can highlight all text in any column, navigate from cell to cell (up/down and left/right), search for text in a specific column, and more.

All you need is Vim and this month's hot tip! Be sure to check it out if you need to sort csv data by column, or if your brain needs some regex exercise. Marvel at the magic of matchadd() (Vim 7.1.040 and later), with fallback to :2match for earlier versions.

July 2008

Searching is simple: starting in normal mode, press / then type what you want to find, and press Enter. But in Vim there's always more to learn!

This month's featured tip improves your searching skills, starting with use of * to search for the current word, and continuing with more suggestions for successful searching. Remember to check the "see also" for more search tips.

June 2008

Folding is frequently used to provide an easy overview of a program or document. A folded section is displayed as a single line that can easily be expanded. When supported by a syntax file, it is usually best to use setlocal foldmethod=syntax.

This month's featured tip explains how to enhance syntax folding of Vim scripts by using syn region commands in an after/syntax/vim.vim file. The tip provides valuable information for advanced users who may want to add to, or override, syntax rules for any file type.

May 2008

Many Vim users prefer working with commands rather than complex key sequences, because commands can be remembered. A frequently-used command can be mapped to any key you like.

You can create user-defined commands, but each must start with an uppercase letter. So how do you replace a built-in command with a user-defined command? Here is a clever but simple technique to replace built-in commands, while avoiding accidental cabbrev expansions.

April 2008

Many text editors launch new files in tabs, rather than showing a separate window for each file. Here's how to make Vim behave that way under Microsoft Windows.

At command prompt, use ftype to define the open command to run gvim with the --remote-tab-silent option. Use assoc to define which file extensions will be associated with the ftype open command. You can specify the --servername option so files with one type open in one instance of Vim, while files of another type open in another. See tip 1440 Launch files in new tabs under Windows for details.

March 2008

We know how to use /pattern to search the current file for the regular expression pattern.

You can also use a command like :vimgrep pattern *.txt to search all .txt files in the current directory for pattern, or :vimgrep pattern **/*.txt to search in the current directory and all its subdirectories. Using forward slashes for the file path works on Unix-based and Windows systems.

Would you like to press a key to search for the current word in all files in and under the current directory? See tip 1543 Find in files within Vim for details.

February 2008

Visual selection is useful for operating on a selected area: v for characters, V for lines, Ctrl-V (Ctrl-Q on Windows) for a block. You can extend the selection with normal commands such as j to move down, or w to move by a word, or / to search. Marks are automatically defined that specify the start and end of the visual selection.

It's easy to search and replace within a visual selection – just type the normal :s/old/new/g command while in visual mode.

You can also search the area that was visually selected – press Esc to exit visual mode, and start the search with /\%V rather than /. See tip 438 Search and replace in a visual selection for details.

Comments

In February 2009, we will move the 2008 archive to a subpage, and put the January 2009 summary above.