Difference between revisions of "Vim Tips & Tricks"

From LinuxMCE
Jump to: navigation, search
(Writing code)
Line 1: Line 1:
 
<table width="100%"> <tr><td bgcolor="#FFCFCF">This page was written by Pluto and imported with their permission when LinuxMCE branched off in February, 2007.  In general any information should apply to LinuxMCE.  However, this page should be edited to reflect changes to LinuxMCE and remove old references to Pluto.</td></tr> </table>==Writing code==
 
<table width="100%"> <tr><td bgcolor="#FFCFCF">This page was written by Pluto and imported with their permission when LinuxMCE branched off in February, 2007.  In general any information should apply to LinuxMCE.  However, this page should be edited to reflect changes to LinuxMCE and remove old references to Pluto.</td></tr> </table>==Writing code==
 
+
;Ctrl+n or Ctrl+p : Autocomplete ;)
 
;]p : Just like p, but it automatically adjusts the indent level of the pasted code to match that of the code you paste into. Try it!
 
;]p : Just like p, but it automatically adjusts the indent level of the pasted code to match that of the code you paste into. Try it!
 
;% : Putting the cursor on a brace, bracket, or parenthese and pressing % will send the cursor to the matching brace, bracket, or parenthese. Great for fixing parse problems related to heavily nested blocks of code or logic.
 
;% : Putting the cursor on a brace, bracket, or parenthese and pressing % will send the cursor to the matching brace, bracket, or parenthese. Great for fixing parse problems related to heavily nested blocks of code or logic.

Revision as of 08:51, 18 April 2006

This page was written by Pluto and imported with their permission when LinuxMCE branched off in February, 2007. In general any information should apply to LinuxMCE. However, this page should be edited to reflect changes to LinuxMCE and remove old references to Pluto.
==Writing code==
Ctrl+n or Ctrl+p 
Autocomplete ;)
]p 
Just like p, but it automatically adjusts the indent level of the pasted code to match that of the code you paste into. Try it!
Putting the cursor on a brace, bracket, or parenthese and pressing % will send the cursor to the matching brace, bracket, or parenthese. Great for fixing parse problems related to heavily nested blocks of code or logic.
>> 
Indent the highlighted code. (See the earlier section about efficient text selection. If no text is selected, the current line is indented.)
<< 
Like >>, but un-indents.
gd 
Go to the definition (or declaration) of the function or variable under the cursor.
Go to the man page for the word currently under the cursor. (For instance, if your cursor is currently over the word sleep, you will see the man page for sleep displayed.)