How to work with vim and tracks containing a "+"
I have a MATLAB project with multiple folder names starting with +
(packages). When I try to open them with vim from the command line like
vim +mytools/extrema.m
I am getting the error
E492: Not an editor command mytools/extrema.m
This also happens when I try to load these files from vim using :e
. On use, :Explore
I can navigate to a folder and open files there without issue.
Is there a way to configure vim to handle these paths?
Note: In this case, I cannot rename the folder, since MATLAB packages must start with a sign +
.
source to share
You can get out of the + sign like this:
vim -- +mytools/extrema.m
:e \+mytools/extrema.m
--
indicates the end of options; otherwise +
interpreted as an option for cursor positioning. The second method should complete after completing character input :e \+
. (Note that :e +<TAB>
does not comply with tabs, as :edit
can optionally take [++opt]
and [+cmd]
as arguments.)
See man vim
and for more details :help edit
.
Update : try
:arga +mytools/extrema.m
:argu 1
This method should definitely allow you to tab from an open Vim session after typing characters :arga +
.
:arga[dd]
adds its arguments to the argument list and :argu[ment]
edits the [count] argument in the argument list. The argument list can be displayed using :ar[gs]
with the current argument in parentheses.
The reason this method works is because it :argadd
doesn't accept standard syntax like [++opt] [+cmd]
, not :edit
.
For details see :help arglist
.
source to share