Hello guys,
I'm writing a plugin (https://github.com/zardus/fuckpep8) that, when the file
is saved, retabs tabs to spaces (in BufWritePre), saves, then retabs spaces to
tabs (in BufWritePost). My first version of this had an annoyance where, after
every save, two new undo entries would be added (one for each conversion). I
addressed this by prepending the retabs with undojoin.
This would be a pretty nice solution, except that an undo like this still
"changes" almost every line in the file. The result is that when I hit undo,
the buffer scrolls all the way to the top, even though in the end, maybe only
one or two lines (whatever the edit that the conversions were undojoined with)
change.
I tried a workaround of doing a wundo before the first conversion and rundo
after the second, but the file changes during the write and vim isn't happy
about that. So I have a few questions:
1. Is there currently any sort of "smart undojoin" that'd jump to the first
*actually changed* line, and not to the top. If this doesn't exist, could
anyone give me a few pointers on where a patch might go for this?
or
2. Is there some way to have the undo stuff hash the contents in the buffer
(which are unchanged after the two conversions) instead of the contents in the
file on the disk?
Thanks for your help! I realize the plugin itself might be ideologically
offensive to some Python programmers here, but let's focus on the technical
perspective and not the ideological :-)
- Yan
--
--
You received this message from the "vim_dev" 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
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.