Edit with VIM: Inherit modeline

5 views
Skip to first unread message

Satheesh Babu Vattekkat

unread,
Nov 8, 2009, 11:57:23 PM11/8/09
to leo-editor
I use VIM to edit longer nodes (prefer VIM against VIM keybindings
because of too much customization already done for my VIM). One thing
I miss and can't figure out is how to inherit a modeline when I edit
child nodes. At the moment, I put the modeline in every child node,
but it is a bit painful. Or I put some AutoBufRead commands to set the
mode - works most of the time.

Any thoughts?

TL

unread,
Nov 9, 2009, 7:54:08 AM11/9/09
to leo-editor
> One thing I miss and can't figure out is how to inherit a modeline when I edit
> child nodes.

I have the same issue. By definition, modelines must exist as
directives within the file. Leo has no mechanism for appending lines
when the file is exported to an external editor and then removing them
when the file is imported back into Leo.

My solution is to use AutoBufRead as you have done or to create
plugins for each file extension that I want to run some custom Vim
code. For example, if the file extension is ".abc", place a "vim.abc"
file with the commands in the vimfiles/ftplugins directory.

This only works if the sub-nodes are exported to Vim with the
extension of the parent node appended to the temporary file. Is that
occurring?

TL

Ville M. Vainio

unread,
Nov 9, 2009, 7:58:19 AM11/9/09
to leo-e...@googlegroups.com
On Mon, Nov 9, 2009 at 2:54 PM, TL <t...@tltools.net> wrote:

> I have the same issue.  By definition, modelines must exist as
> directives within the file.  Leo has no mechanism for appending lines
> when the file is exported to an external editor and then removing them
> when the file is imported back into Leo.

It's not like such a thing would be hard to add, though, by some
changes to c.openWith.

--
Ville M. Vainio
http://tinyurl.com/vainio

Edward K. Ream

unread,
Nov 9, 2009, 11:41:00 AM11/9/09
to leo-e...@googlegroups.com
On Mon, Nov 9, 2009 at 6:58 AM, Ville M. Vainio <viva...@gmail.com> wrote:

On Mon, Nov 9, 2009 at 2:54 PM, TL <t...@tltools.net> wrote:

> I have the same issue.  By definition, modelines must exist as
> directives within the file.  Leo has no mechanism for appending lines
> when the file is exported to an external editor and then removing them
> when the file is imported back into Leo.

It's not like such a thing would be hard to add, though, by some
changes to c.openWith.

Yes.  The code that sends text to vim would end the mode line, and the code that gets text from vim would delete the mode line if present.

Edward
Reply all
Reply to author
Forward
0 new messages