Expanding Syntax menu

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Expanding Syntax menu

Justin Randall-2
Hi,
I was wondering if anyone could tell me how to make the vim syntax menu expanded by
default.  I have a key map that sets the syntax highlighting using the SetSyn function.
The problem is that this function is unknown unless I choose Syntax > Show Filetypes in
Menu.  I want to be able to hve my key mapping work without choosing this option from the
dropdown menu.  Does anybody have a solution to 'unfold' the syntax menu?  Here is the
map:

map <F4> <Esc>:cal SetSyn("cpp")<CR>    " F4: turn on C++ syntax

Thanks in advance,
Justin

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com 
Reply | Threaded
Open this post in threaded view
|

Re: Expanding Syntax menu

Sean Hubbell
Justin Randall wrote:

>Hi,
>I was wondering if anyone could tell me how to make the vim syntax menu expanded by
>default.  I have a key map that sets the syntax highlighting using the SetSyn function.
>The problem is that this function is unknown unless I choose Syntax > Show Filetypes in
>Menu.  I want to be able to hve my key mapping work without choosing this option from the
>dropdown menu.  Does anybody have a solution to 'unfold' the syntax menu?  Here is the
>map:
>
>map <F4> <Esc>:cal SetSyn("cpp")<CR>    " F4: turn on C++ syntax
>
>Thanks in advance,
>Justin
>
>__________________________________________________
>Do You Yahoo!?
>Tired of spam?  Yahoo! Mail has the best spam protection around
>http://mail.yahoo.com 
>
>
>  
>
Try using

:set ft=cpp


Sean
Reply | Threaded
Open this post in threaded view
|

Re: Expanding Syntax menu

A.J.Mechelynck
In reply to this post by Justin Randall-2
----- Original Message -----
From: "Justin Randall" <[hidden email]>
To: <[hidden email]>
Sent: Thursday, September 01, 2005 6:30 PM
Subject: Expanding Syntax menu


> Hi,
> I was wondering if anyone could tell me how to make the vim syntax menu
> expanded by
> default.  I have a key map that sets the syntax highlighting using the
> SetSyn function.
> The problem is that this function is unknown unless I choose Syntax > Show
> Filetypes in
> Menu.  I want to be able to hve my key mapping work without choosing this
> option from the
> dropdown menu.  Does anybody have a solution to 'unfold' the syntax menu?
> Here is the
> map:
>
> map <F4> <Esc>:cal SetSyn("cpp")<CR>    " F4: turn on C++ syntax
>
> Thanks in advance,
> Justin

You can trigger the menu "Syntax -> Show Filetypes in Menu" by means of the
following command in your vimrc:

    if has("gui_running") && has("menu")
        let do_syntax_sel_menu = 1
        autocmd VimEnter * map {lhs} {rhs}
    endif

(to do it later it's more complicated).

This will supposedly slow your gvim startup considerably. Note the use of
the autocommand to define your mapping at the end of startup, after loading
the menus.

Best regards,
Tony.


Reply | Threaded
Open this post in threaded view
|

Re: Expanding Syntax menu

Justin Randall-2
>--- Tony Mechelynck <[hidden email]> wrote:
>
> ----- Original Message -----
> From: "Justin Randall" <[hidden email]>
> To: <[hidden email]>
> Sent: Thursday, September 01, 2005 6:30 PM
> Subject: Expanding Syntax menu
>
>
> > Hi,
> > I was wondering if anyone could tell me how to make the vim syntax menu
> > expanded by
> > default.  I have a key map that sets the syntax highlighting using the
> > SetSyn function.
> > The problem is that this function is unknown unless I choose Syntax > Show
> > Filetypes in
> > Menu.  I want to be able to hve my key mapping work without choosing this
> > option from the
> > dropdown menu.  Does anybody have a solution to 'unfold' the syntax menu?
> > Here is the
> > map:
> >
> > map <F4> <Esc>:cal SetSyn("cpp")<CR>    " F4: turn on C++ syntax
> >
> > Thanks in advance,
> > Justin
>
> You can trigger the menu "Syntax -> Show Filetypes in Menu" by means of the
> following command in your vimrc:
>
>     if has("gui_running") && has("menu")
>         let do_syntax_sel_menu = 1
>         autocmd VimEnter * map {lhs} {rhs}
>     endif
>
> (to do it later it's more complicated).
>
> This will supposedly slow your gvim startup considerably. Note the use of
> the autocommand to define your mapping at the end of startup, after loading
> the menus.
>
> Best regards,
> Tony.
>

Thanks for your help Tony and Sean.  Your GUI check statement was exactly what I was
looking for!  I noticed no slowdown whatsoever when loading gvim. Perhaps this is because
I'm running it on a 3.2 GHz Xeon box.  Thanks again guys.  

Take care,
Justin


               
____________________________________________________
Start your day with Yahoo! - make it your home page
http://www.yahoo.com/r/hs