I execute a set of handy commands I need to do often on a standard type of file using the -c
(or equivalently, the +
) option from command line using vim. However, after an update to the remote system's OS, commands beyond the first one are interpreted as different file names and results in the first command being executed and multiple buffers being opened rather than multiple commands being executed on one file.
The command I use is vim -c ':11' -c ':norm wllv,dZZ' myfile
(go to line 11, move over a few characters, select the current position, and replace using a leader command, and then save and exit).
With the change on the remote system, this now results in two buffers being opened, one is wllv,dZZ
and the other is myfile
Vim also throws this error:
Error detected while processing command line:
E471: Argument required: :norm
Furthermore, if I try vim -c ":11" -c ":21" myfile
, both commands work and no extra buffer is opened, which indicates the error is perhaps somewhere with :norm
, but I'm not sure why as this was working just fine very recently.
Current version of vim is 7.4, in case that helps.
Any help restoring the old behavior or understanding where the issue is coming from would be greatly appreciated, thanks!
Added output from xxd
for a bash script containing only the vim command above:
0000000: 2321 202f 6269 6e2f 6261 7368 0a76 696d #! /bin/bash.vim
0000010: 202d 6320 273a 3131 2720 2d63 2027 3a6e -c ':11' -c ':n
0000020: 6f72 6d20 776c 6c76 2c64 5a5a 2720 6d79 orm wllv,dZZ' my
0000030: 6669 6c65 0a file.
Pseudocode version of the wrapper script:
if [ $LOGNAME == "root" ]; then
<some logic here for when it's run by root>
else
/usr/bin/vim $*
fi
ssh remotehost 'vim -c ":11" -c ":norm wllv,dZZ" myfile'
, in other words, put the whole remotevim
command inside single quotes and then use extra double quotes for the arguments to-c
? Not sure that's the exact invocation you need, but start there and experiment until you find the one that works...vim -c ":11" -c ":norm wllv,dZZ" myfile
bash test.sh
. If you get the same result dump it's bytes withxxd test.sh
, share it via pastebin or add it to your question here....that'll allow checking for any funky/unexpected characters (perhaps due to some over-the-wire encoding issue).