I have a user defined command in vim that does a chmod on the current file. Once that's done, reopen the current file for editing (with the newly updated properties) by issuing:


I'd like for the command to do this automatically. How do I do this?

command! PerforceOpen echo system('chmod u+w '.shellescape(substitute(resolve(expand('%:p')), '-debug', '', 'g')))

You can just append the command to your custom command:

command! PerforceOpen echo system(...) | edit!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.