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 47: Line 47:
   
 
Note that <code>:redir</code> can use a variable instead of a register, as shown above.
 
Note that <code>:redir</code> can use a variable instead of a register, as shown above.
 
Note also that <code>:redir</code> will capture silenced messages as well. While this won't be problematic with most builtin commands that echo stuff that we are interested in, this is quite problematic when we execute a sequence of several commands. Since version 7.4-2008, Vim provides an <code>execute()</code> function that'll simplify things and avoid side-effects.
 
   
 
==References==
 
==References==
 
*{{help|:redir}}
 
*{{help|:redir}}
*{{help|execute()}}
 
   
 
==Related scripts==
 
==Related scripts==
  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