Vim Tips Wiki

Editing

Capture ex command output

1
  • The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit. If you are undoing an edit that is …
Latest revision Your text
Line 25: Line 25:
 
Now, register 'a' will have the output of the "set all" ex command. You can paste this into a Vim buffer, using <code>"ap</code>.
 
Now, register 'a' will have the output of the "set all" ex command. You can paste this into a Vim buffer, using <code>"ap</code>.
   
You can also write a Vim function to do the above. Since you probably don't want your command output to mess up your carefully constructed window layout, this function will pipe the output of a command into a new tab, allowing you to simply close the tab when done. If you don't like [[using tab pages]], or you don't have tab support because you didn't compile with it or your Vim version is less than 7.0, you could modify this function to use a new split window instead:
+
You can also write a Vim function to do the above. Since you probably don't want your command output to mess up your carefully constructed window layout, this function will pipe the output of a command into a new tab, allowing you to simply close the tab when done. If you don't like [[Introduction to using tab pages|using tabs]], or you don't have tab support because you didn't compile with it or your Vim version is less than 7.0, you could modify this function to use a new split window instead:
 
<pre>
 
<pre>
 
function! TabMessage(cmd)
 
function! TabMessage(cmd)
  Loading editor
Below are some commonly used wiki markup codes. Simply click on what you want to use and it will appear in the edit box above.

View this template