> My guess is that you want a pair of autocmds
>
> [...] like (untested)
>
> autocmd BufWritePre *.py %s/^\( \{8}\)\+/\=substitute(submatch(0), repeat(' ', 8), repeat(' ', 4), 'g')
>
> autocmd BufWritePost *.py %s/^\( \{4}\)\+/\=substitute(submatch(0), repeat(' ', 4), repeat(' ', 8), 'g')
>
> [...] The 2nd one might be simply replaced with
>
> autocmd BufWritePre *.py u
s/Pre/Post/
But, it seems to me it'd be better to keep it explicit, so that it
doesn't interact poorly with other BufWrite* autocmds that other plugins
might use.
Also, you should add:
/e
to the end of each autocmd, for the unusual case that no lines in the
.py file are indented. (If you just started a new file, for example.)
Other than that, it seems to work for me on some simple files.
--
Best,
Ben
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
No comments:
Post a Comment