Friday, June 6, 2014

Re: Filetype specificity for menus

On 31/05/14 20:57, Tim Johnson wrote:
> * Christian Brabandt <cblists@256bit.org> [140531 05:19]:
>> Hi Tim!
>>
>> On Fr, 30 Mai 2014, Tim Johnson wrote:
>>
>>> I'm using vim 7.3 Huge Gtk2-gnome gui, on ubuntu 12.04.
>>>
>>> I've used vim for many years but have not figured out how to do the
>>> following :
>>>
>>> Make a menu item coded for a specific filetype *not* be present in a
>>> buffer of a different filetype.
>>>
>>> Example : with python.vim, a menu for python-specific actions is
>>> installed. Switching to a javascript buffer, the python menu
>>> remains. It would be great if it were to go away.
>>
>> I think, all that is possible is to disable a certain menu but you can't
>> actually removed it once it was defined.
> thanks Christian. At long last I have found something that I like
> better about that editor that starts with 'e'. Since that is
> pretty much the only thing I like better .... I wonder if the
> following is possible in vim :
>
> Disable the installation of filetype-specific menus.
> Of course I could do it by tweaking the code of the .vim source
> file, but that is a "rigged" solution IMHO. Is there a vim
> command that would stop a menu from being loaded in the first
> place?
> This would be useful if I were using an alternate computer, such
> as one of my netbooks with a small screen which might not be able
> to accomadate the number of menus that might accumulate if I have
> a session with multiple filetypes.
>
> thanks
>

Since you would want to make a menu appear or disappear depending on
which file was current (even when editing files of different types
side-by-side, let's say an HTML page with its CSS and JS included
scripts), you would need to have BufEnter autocommands to set the menus
you want in the window being entered but not in others, and BufLeave
autocommands to unset them when leaving. Or you might disable them
instead, which would not entail full re-creation; I don't know whether
in that case the disabled menus would be hidden or just greyed-out.

Best regards,
Tony.
--
"With so many mindbytes to be downloaded, so many mental codons to be
replicated, it is no wonder that child brains are gullible, open to
almost any suggestion, vulnerable to subversion, easy prey to Moonies,
Scientologists and nuns. Like immune-deficient patients, children are
wide open to mental infections that adults might brush off without
effort."
[Richard Dawkins, "Viruses of the Mind"]

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment