Using argdo with set with vim

1.4k views Asked by At

I'm attempting to run the command "set tabstop=4" and then "retab" on multiple files.

I have gotten to point of getting my arglist like so

args ~/workspace/**/*.java

and I can see this work well when I'm just viewing the files using the args command. Now when I'm trying to run the "set tabstop=4" command on it, I'm just not able to get the correct combination of this. Ive tried

argdo "set tabstop=4" 

and then

argdo "update" 

but it never seems to apply the updates and I'm sure there are updates since I can go to one of the files individually and run the command and it changes the file. I've tried different combinations like

argdo execute "set tabstop=4"

and it just never seems to do anything. Any help would be appreciated!

1

There are 1 answers

6
Ingo Karkat On BEST ANSWER

The syntax of :argdo (as per the :help) is

:argdo[!] {cmd}

No quoting is involved. To execute multiple commands in one go, just separate them with |:

:argdo set tabstop=4 | retab | update