Loading ...
Sorry, an error occurred while loading the content.
 

Re: Expanding Syntax menu

Expand Messages
  • Sean Hubbell
    ... Try using ... Sean
    Message 1 of 4 , Sep 1, 2005
      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
    • Tony Mechelynck
      ... From: Justin Randall To: Sent: Thursday, September 01, 2005 6:30 PM Subject: Expanding Syntax menu ... You can
      Message 2 of 4 , Sep 1, 2005
        ----- Original Message -----
        From: "Justin Randall" <randall311@...>
        To: <vim@...>
        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.
      • Justin Randall
        ... 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.
        Message 3 of 4 , Sep 1, 2005
          >--- Tony Mechelynck <antoine.mechelynck@...> wrote:
          >
          > ----- Original Message -----
          > From: "Justin Randall" <randall311@...>
          > To: <vim@...>
          > 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
        Your message has been successfully submitted and would be delivered to recipients shortly.