Wednesday, August 1, 2012

Re: Split editor vertically to show code comments on the right

Hi Tony,

Thanks firstly for taking an interest in the question. I'm aware that others may prefer different coding styles and there are varying views on line lengths and wrapping. You'll note from my OP that I specifically don't want to spend so much time manually formatting long end-of-line comments - I want to write a plugin which will do it for me. So I'm grateful that you put such time as you did into your answer but I would argue that it misses the point of my original post.

I have, since posting to this list, been in touch with someone on the subject of vim plugins and he suggested that the following approach might work:

* Open an .asm file as a normal Vim buffer.
* Press a key to enter "yourplugin mode". An autocommand could do this for you whenever opening a file automatically.
* When you enter yourplugin mode, hide the actual .asm file buffer and create two new buffers, foo.asm__CODE and foo.asm__COMMENTS. These buffers will be entirely managed by your plugin.
* Your plugin will parse foo.asm and fill in these two new buffers appropriately. Assembly is pretty simple so I think you're going to get lucky here and not have to worry about actually *parsing* the ASM -- a simple regex will probably get the job done.
* When the user saves either of these buffers, both are "saved". The plugin parses their content and renders it back into foo.asm, and then saves that.

This reflects a concern I had which was that simply concealing part of the line in each pane wasn't going to work. I would welcome any comment on the pros and cons of the above approach, or in fact, any other approach which could deliver this particular feature-request.

Regards

Michael

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