Passing Vim's arguments via :edit command
Jump to navigation
Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
You can pass arbitrary of Vim's 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 desired value of 'filetype'
:
:command new :edit +set\ filetype=%a
And use it like:
:new sh script
which is equal to the first command.