How to add space between parenthesis and quotes on save
问题 I would like to add have VIM automatically add space between parenthesis and " / ' to match jquery style guidelines: http://contribute.jquery.org/style-guide/js/. This could be on save or by triggering a custom command. Ideally it would also add spaces before variable names but not functions or objects literal. What would be the best way to go about this? 回答1: To insert spaces on saves, use an autocommand : au BufWrite *.js silent! %s/\m(\@<=["']/ \0/g | silent! %s/\m["'])\@=/\0 /g au