Difference between revisions of "Passing Vim's arguments via :edit command"

From Vifm Wiki
Jump to: navigation, search
(Initial version of the page)
 
m (small grammar fixes)
 
Line 1: Line 1:
You can pass arbitrary of Vim's arguments to <code>:edit</code> command.  For example, the
+
You can pass arbitrary Vim arguments to <code>:edit</code> command.  For example, the
 
following command opens Vim with buffer named <code>script</code> and <code>'filetype'</code> set
 
following command opens Vim with buffer named <code>script</code> and <code>'filetype'</code> set
 
to <code>sh</code>:
 
to <code>sh</code>:
Line 7: Line 7:
 
</source>
 
</source>
  
For convenience one can define a command to start editing files in Vim forcing desired value of <code>'filetype'</code>:
+
For convenience one can define a command to start editing files in Vim forcing the desired value of <code>'filetype'</code>:
  
 
<source lang="vim">
 
<source lang="vim">

Latest revision as of 03:46, 25 July 2014

You can pass arbitrary Vim arguments to :edit command. For example, the following command opens Vim with buffer named script and 'filetype' set to sh:

:edit +set\ filetype=sh script

For convenience one can define a command to start editing files in Vim forcing the desired value of 'filetype':

:command new :edit +set\ filetype=%a

And use it like:

:new sh script

which is equal to the first command.