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

Re: color scheme for files with arbitrary extensions

Expand Messages
  • Ben Fritz
    ... Please use correct terminology. You are trying to use C syntax on *hoc files. A colorscheme is something you load with a command like :colorscheme
    Message 1 of 4 , Jun 11, 2013
    • 0 Attachment
      On Tuesday, June 11, 2013 6:31:30 PM UTC-5, Anton Arkhipov wrote:
      >
      > I am having trouble enabling a color scheme when using vim with *hoc files. I am trying to use the "c" color scheme, and I can do that using “:set syntax=c” inside the vim session, but only for that one session.

      Please use correct terminology. You are trying to use C syntax on *hoc files. A colorscheme is something you load with a command like ":colorscheme elflord", and defines a collection of colors to use for ALL syntaxes.

      > I'd like to do that for any session automatically.
      >
      > I tried to add the following to .vimrc:
      >
      > syntax enable
      >

      You want "syntax on" not "syntax enable"

      > filetype plugin on
      > au FileType hoc set syntax=c
      >
      > But there's no effect. Perhaps my vim doesn’t look into .vimrc?

      More likely, Vim doesn't know how to detect the "hoc" syntax. See :help new-filetype

      If I understand correctly, you want to use one of the methods listed at that help reference, to set the filetype of *.hoc files to "c".

      > There was actually no such file in my home directory in the environment I'm currently working under, so I created it and added to it those three lines. However, like I said, I don't get any colors when editing *hoc files.
      >

      Yes, you need to create the file if it does not exist. But you didn't mention, what system are you on? An easy way to get to the home directory that Vim actually sees on ANY system, would be to do :echo $HOME from within Vim.

      --
      --
      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@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Christian Brabandt
      ... See http://vimhelp.appspot.com/vim_faq.txt.html#faq-26.8 regards, Christian -- -- You received this message from the vim_use maillist. Do not top-post!
      Message 2 of 4 , Jun 11, 2013
      • 0 Attachment
        On Wed, June 12, 2013 01:31, Anton Arkhipov wrote:
        > Hello,
        >
        > I am having trouble enabling a color scheme when using vim with *hoc
        > files. I am trying to use the "c" color scheme, and I can do that using
        > “:set syntax=c” inside the vim session, but only for that one session.
        > I'd like to do that for any session automatically.
        >
        > I tried to add the following to .vimrc:
        >
        > syntax enable
        > filetype plugin on
        > au FileType hoc set syntax=c
        >
        > But there's no effect. Perhaps my vim doesn’t look into .vimrc? There
        > was actually no such file in my home directory in the environment I'm
        > currently working under, so I created it and added to it those three
        > lines. However, like I said, I don't get any colors when editing *hoc
        > files.
        >
        > If someone could suggest a solution, I would very much appreciate it.
        >

        See http://vimhelp.appspot.com/vim_faq.txt.html#faq-26.8

        regards,
        Christian

        --
        --
        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@....
        For more options, visit https://groups.google.com/groups/opt_out.
      • Anton Arkhipov
        Thanks a lot, Ben and Christian. After all, it turned out that my vim did look into .vimrc that I created, but apparently commands I used there weren t
        Message 3 of 4 , Jun 12, 2013
        • 0 Attachment
          Thanks a lot, Ben and Christian.

          After all, it turned out that my vim did look into .vimrc that I created, but apparently commands I used there weren't adequate. The following single line in .vimrc did the job:

          au BufRead,BufNewFile *.hoc setfiletype c

          I used this line after reading documentation with ":help new-filetype" :).

          Thanks!

          Anton.

          --
          --
          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@....
          For more options, visit https://groups.google.com/groups/opt_out.
        Your message has been successfully submitted and would be delivered to recipients shortly.