On 11/03/11 11:40, Benjamin R. Haskell wrote:
On Thu, 3 Nov 2011, Tim Chase wrote:
[...] 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/

Doh, that's what I get for copy-n-pasting the Pre to the Post the first time and then pasting again for the "u" version.

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.

Ah, the products of actually testing. So yes, Jose, incorporate Ben's suggestions.

-tim


--
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

Reply via email to