vile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vile] modelines and :map! ?


From: Thomas Dickey
Subject: Re: [vile] modelines and :map! ?
Date: Fri, 22 Dec 2017 14:34:38 -0500
User-agent: Mutt/1.5.23 (2014-03-12)

On Fri, Dec 22, 2017 at 10:05:13AM -0500, address@hidden wrote:
> Greetings.
> 
> I've just discovered the concept of "modelines" and I'm curious to see
> how I can use it.
> 
> Sadly, I am hampered in searching the documentation because the term
> "modeline" is also used to describe the status line at the bottom of my
> vile window.
> 
> Anyway, my question is this:  Can I use a modeline to do a key mapping?

no...

I didn't consider this case, but back in the 90's there was some debate
over the security issues of modeline.  The original vi allowed "any"
valid vi command to be part of a modeline, including shell commands.

So when I implemented modelines, I limited it to setting buffer-modes
(no global modes, no $variables, etc).

> 
> Right now, I have this:
> 
> :map! ^X^M ^[!!./codenames2points.pl^Mjjo
> 
> in a local .vilerc in a specific directory.  Can I put that into a modeline
> since it really only applies to one specific file?

It won't work, since map is a global thing, because it's initialized from the
minibuffer (outside any editable buffer).  There's only one set of key-binding
tables as well (for different editing modes, of course).

If you enable "popup-msgs" in your .vilerc, you'll probably see a warning
for each try to execute that command:
        # vile:ts=5 map! ^X^M ^[!!./codenames2points.pl^Mjjo

(if it's "vi" rather than "vile", that's simply ignored)
 
> This isn't a situation where it matters.  The .vilerc setup is working
> fine, and I can't think of any real reason why I can't put this in my
> main .vilerc .  I'm just trying to learn what I can and can't do.
> 
> --hymie!     http://lactose.homelinux.net/~hymie    address@hidden

-- 
Thomas E. Dickey <address@hidden>
https://invisible-island.net
ftp://ftp.invisible-island.net

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]