Vim Tips Wiki
We recommend that you log in before editing. This will allow other users to leave you a message about your edit, and will let you track edits via your Watchlist. Creating an account is quick and free.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 32: Line 32:
 
This can be useful if you work on a project with very strict policies against needless changes to files, or which specifically require no EOL on the final line.
 
This can be useful if you work on a project with very strict policies against needless changes to files, or which specifically require no EOL on the final line.
   
===[[VimTip1643|January 2011]]===
+
===[[VimTip1585|October 2010]]===
  +
Vim recognizes three file formats (unix, dos, mac) that determine what line ending characters (LF, CRLF, CR) are removed from each line when a file is read, or are added to each line when a file is written. A file format problem can display ^M characters, or can prevent scripts from running correctly.
The ability to undo mistakes and redo them if you change your mind is a basic feature of any advanced editing program. Vim expands on this, keeping track of ''every'' change made in one or more "undo branches", so that you can return to any state your buffer was in even after undoing those changes and making different changes. Vim 7.3 adds the "persistent undo" feature, which saves this undo tree between editing sessions to make it even more powerful.
 
   
Our [[VimTip1643|featured tip]] will introduce you to Vim's undo tree, and even show you some plugins that make it simple to use.
+
Our [[VimTip1585|featured tip]] shows how to remove unwanted ^M characters, and explains how to convert from one file format to another.
  +
  +
===[[VimTip671|September 2010]]===
  +
Inserting a line break (newline) before or after each occurrence of specified text is easy.
  +
  +
Our [[VimTip671|featured tip]] shows how to insert newlines using a simple substitute command. It also presents a small script that defines a command to make the job even easier. The script has an explanation that may be helpful for anyone wanting to see how Vim scripts work.
  +
  +
===[[VimTip759|August 2010]]===
  +
After pasting text, you may want to select that text so you can perform another operation. For example, you may want to indent the pasted text, or to perform a substitute within it.
  +
  +
Our [[VimTip759|featured tip]] introduces the <tt>`[</tt> and <tt>`]</tt> marks, and shows a simple mapping that allows you to select the text that was last changed, or the text that was just pasted.
  +
  +
===[[VimTip1361|July 2010]]===
  +
Auto commenting is a handy feature, but it can be frustrating to press <tt>o</tt> to open a new line after a comment, then find the comment string inserted at the start of what you hoped would be a blank line.
  +
  +
Our [[VimTip1361|featured tip]] shows how to disable all auto commenting, or how to disable auto commenting only for <tt>//</tt>-style single-line comments in C/C++ files.
  +
  +
===[[VimTip1561|June 2010]]===
  +
Syntax highlighting is a very useful feature of Vim, and there are many syntax files distributed with Vim to highlight keywords and more, for example, when editing a C or a Python program.
  +
  +
But what if you need syntax highlighting for files you edit, yet there is no standard syntax file? Our [[VimTip1561|featured tip]] is a tutorial showing how to create your own syntax files.
  +
  +
===[[VimTip194|May 2010]]===
  +
Have you ever wanted to insert the same text in the same position in multiple lines? That is easy with visual block mode: press <tt>I</tt> to have text inserted on each line in the selection. If the block visual selection used <tt>$</tt> to select end-of-line, you can also press <tt>A</tt> to have the same text appended to each line.
  +
  +
Our [[VimTip194|featured tip]] has the details. It also shows how to use the substitute command to insert or append text.
  +
  +
===[[VimTip1630|April 2010]]===
  +
We all know what a tab page is – each tab holds a different file. Actually, Vim tabs are ''not'' like that. Instead, tab pages in Vim offer much more flexibility, and provide many features that are unavailable with standard editors.
  +
  +
Our [[VimTip1630|featured tip]] discusses ideas for how to make the most of tab pages in Vim: one tab can show windows for files you are currently working on, while other tabs display ''diffs'', or ''x-ray'' or ''folded'' views, and more.
  +
  +
===[[VimTip1530|March 2010]]===
  +
We have lots of good information on [[searching]]. One special requirement, when writing a program, is to limit the scope of what you search, such as by searching only within the current function, or only within the current code block.
  +
  +
Our [[VimTip1530|featured tip]] provides a script so you can easily search within a specified scope in program languages such as C and C++ that use braces (<tt>{...}</tt>) to delimit blocks.
  +
  +
===[[VimTip1549|February 2010]]===
  +
On Windows systems, Vim can easily run an external program asynchronously without irritating "Press Enter" messages. You can run a GUI program with a command like <tt>:!start&nbsp;calc</tt>, and you can run a console-mode program with a command like <tt>:!start&nbsp;cmd&nbsp;/c&nbsp;myapp.exe&nbsp;&amp;&nbsp;pause</tt>. Both examples run the program but immediately return to Vim, allowing you to continue editing while the invoked program runs.
  +
  +
It is also possible use this method with Vim's {{help|prefix=no|clientserver}} features to run a program (like grep) for a long period without interrupting your editing, and notify Vim to take action (like loading the search results) when the program has finished. Our [[VimTip1549|featured tip]] has the details.
  +
  +
===[[VimTip1613|January 2010]]===
  +
You may need to view or edit a binary file. You can do that without leaving home because Vim provides the <tt>xxd</tt> utility to read a dump of a binary file, or to edit the dump then save it in binary form.
  +
  +
[[VimTip1613|Hex dump]] introduces <tt>xxd</tt>, and shows a handy feature to insert the hex equivalent of a binary file into C source code.
   
 
==Previous years==
 
==Previous years==
*[[/2010|2010 ''Featured tips'']]
 
 
*[[/2009|2009 ''Featured tips'']]
 
*[[/2009|2009 ''Featured tips'']]
 
*[[/2008|2008 ''Featured tips'']]
 
*[[/2008|2008 ''Featured tips'']]
Please note that all contributions to the Vim Tips Wiki are considered to be released under the CC-BY-SA
Cancel Editing help (opens in new window)

Template used on this page: