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

Sensing the extension in vimrc

Expand Messages
  • Anith C.R
    Hi all, I want to load a certain set of parameters when I open a file with a particular extension. Say, I have a c file, and when I open it I should have
    Message 1 of 4 , Feb 3, 2003
    • 0 Attachment
      Hi all,
      I want to load a certain set of parameters when I
      open a file with a particular extension. Say, I have
      a "c" file, and when I open it I should have ":set
      noic" (I have the default setting as "ignorecase").
      How do i specify the condition in my .vimrc?
      thanx
      Anith.

      __________________________________________________
      Do you Yahoo!?
      Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
      http://mailplus.yahoo.com
    • Naveen Chandra
      ... you can use autocommands for some simple settings. Put the following in your .vimrc au BufRead *.c set noic read :help au hth -ncr -- Calvin: But Calvin is
      Message 2 of 4 , Feb 3, 2003
      • 0 Attachment
        > Hi all,
        > I want to load a certain set of parameters when I
        > open a file with a particular extension. Say, I have
        > a "c" file, and when I open it I should have ":set
        > noic" (I have the default setting as "ignorecase").
        > How do i specify the condition in my .vimrc?

        you can use autocommands for some simple settings. Put the
        following in your .vimrc

        au BufRead *.c set noic

        read :help au

        hth
        -ncr

        --
        Calvin: But Calvin is no kind and loving god! He's one of the
        old gods! He demands sacrifice!
        -- Calvin and Hobbes

        ---o0o---

        Naveen Chandra R
        Validation Technologies Group, PNP,
        Sun Microsystems,
        Bangalore, India.

        Homepage: http://www.geocities.com/ncr_10/
        Ph: 91-80-2298989, ext:27461

        ---o0o---
      • Luc Hermitte
        ... If you have many things to specify and you want to watch many different extensions like : all the C files, all the C++ files, all the ada files, etc. Then
        Message 3 of 4 , Feb 3, 2003
        • 0 Attachment
          * On Mon, Feb 03, 2003 at 03:11:35AM -0800, Anith C.R <cr_anith@...> wrote:
          > How do i specify the condition in my .vimrc?

          If you have many things to specify and you want to watch many different
          extensions like : all the C files, all the C++ files, all the ada files,
          etc.
          Then prefer using filetype plugins to having hundred of autocommands in
          your .vimrc.

          BTW, don't use :set, but :setlocal in such cases.
          :map -> :map <buffer>, etc.

          --
          Luc Hermitte
          http://hermitte.free.fr/vim/
        • Benji Fisher
          ... If you want to do more complicated customizations, it may be easier to use filetype plugins. See ... in the users manual. Note that you may open other
          Message 4 of 4 , Feb 3, 2003
          • 0 Attachment
            Naveen Chandra wrote:
            >>Hi all,
            >> I want to load a certain set of parameters when I
            >>open a file with a particular extension. Say, I have
            >>a "c" file, and when I open it I should have ":set
            >>noic" (I have the default setting as "ignorecase").
            >> How do i specify the condition in my .vimrc?
            >
            >
            > you can use autocommands for some simple settings. Put the
            > following in your .vimrc
            >
            > au BufRead *.c set noic
            >
            > read :help au

            If you want to do more complicated customizations, it may be
            easier to use filetype plugins. See

            :help filetype-plugin

            in the users' manual.

            Note that you may open other files after starting vim, so simply
            changing settings in your vimrc file is not going to work. Either using
            autocommands or filetype plugins will work.

            HTH --Benji Fisher
          Your message has been successfully submitted and would be delivered to recipients shortly.