Closed kiryph closed 9 years ago
Hi, Thank you very much for the lists.
Regarding swapping environments. The short answer is no.
But in theory it is feasible.
The following code block handles the xml matches.
https://github.com/mjbrownie/swapit/blob/master/plugin/swapit.vim#L289-L316
It would be possible to hack the search patterns from '< foo >' to '\begin{foo}' but the code as is cant take in arbitrary delimiters.
Note this code is using matchit.vim which is often bundled in as standard I think.
Thanks for your feedback.
The Latex-suite plugin already offers with <Shift><F5>
to change a surrounding environment by entering the name of the new one. I was wondering if this could even more simplified with your plugin.
However, I prefer lightweight plugins. So I wouldn't be in favour of extending your plugin, except your xml code would have been easy to adapt for it. Other plugins such as https://github.com/AndrewRadev/switch.vim could be used for this.
No problems. It's always good to see the plugin being used :)
I wouldn't recommend adding this feature to the swapit plugin either. I'm happy it just has some filetype awareness.
As far as creating a lightweight solution to your specific problem. It doesn't sound too far removed from another block tag manipulation plugin I wrote which could be a guide. (you would need code to change the tag rather than delete them). It's very handy for django templates and It's better all round as it is using searchpair rather than relying on matchit.
https://github.com/mjbrownie/delete-surround-html/blob/master/after/ftplugin/html/delete_surround_html.vim (only ~100 lines to make sense of)
but it sounds like something the latex suite is handling.
Can your 'delete-surround-html' plugin delegate ds
commands to surround.vim if the third letter is not considered in 'delete-surround-html'?
yeah that plugin only remaps 'dsh' and 'dsd' so ds(..anything else) will be passed through as is standard with all vim mappings.
Can you add following SwapLists for tex. 'tex_swapit.vim':
Is it possible to change environments:
to
having something like
SwapListEnv lists itemize enumerate description