rspec - Why does vim "cancel out" the last two characters when running `%:8` in an external command? -
a simple work flow use when running rspec
test have been working on, in vim
, follows:
15: "my example test" 16: expect(1 == 1).to true 17: end
and run test, can do:
!rspec %:15
this runs rspec
external command. %
expands current filename, , :15
tells rspec
run test line 15
, rather tests in file.
this technique works fine under normal circumstances. however, if try run test on lines 80-89
strange happens:
84: "my other test" 85: expect(4 > 3).to false 86: end !rspec %:84
this runs command rspec [filename]4
- i.e. :8
characters disappear! (and "file not found" error.)
a workaround avoid problem press tab
after entering %
, expands %
full path name.
however, what's reason behind strange vim
behaviour? bug, or feature?
a different, related question led me finding answer this.
you can find answer, along more detail, running :help filename-modifiers
in vim
. here summary of key point:
the file name modifiers can used after
"%"
,"#"
,"#n"
,"<cfile>"
,"<sfile>"
,"<afile>"
or"<abuf>"
.
:8
converts path 8.3 short format (currently on ms-windows). act on of path existing path.
8
numerical filename-modifier. if wish disable feature entirely, can compile vim
without +modify_fname
feature.
Comments
Post a Comment