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

Re: Syntax highlighting for .profile

Expand Messages
  • Tim Johnson
    ... Yes, as I have indicated above, autocommand with ft=sh gives me syntax highlighting. ... That s a good tip, thanks, but if I change au BufRead,BufNewFile
    Message 1 of 7 , Feb 26, 2013
    • 0 Attachment
      * Charles Campbell <Charles.E.Campbell@...> [130226 08:37]:
      > Tim Johnson wrote:
      > >* Phil Dobbin <phildobbin@...> [130226 07:10]:
      > >>On 26/02/2013 01:51, Tim Johnson wrote:
      > >>
      > >>>Hello:
      > >>>How can set syntax highlighting for .profile on the mac os 10.7, as I
      > >>>would for .bashrc or .bash_profile?
      > >>>thanks
      > >>>
      > >>I use:
      > >>
      > >>'au BufRead,BufNewFile {*.cfg,*.profile,*.log} set ft=syslog'
      > >>
      > >>in my vimrc. syslog.vim is a syntax plugin available from the scripts
      > >>page on: <www.vim.org>
      > > Thanks for the replies. I have followed both suggestions, and
      > > neither worked, even as I could see ft change to syslog or bash.
      > > But I noted that from /etc/bashrc ft is set to 'sh' with syntax
      > > highlight operating, so :
      > >
      > > au BufRead,BufNewFile {*.cfg,*.profile,*.log} set ft=sh
      > >
      > > Gives me syntax highlighting
      > > Thanks again
      > > cheers
      > syn on
      > should have enabled syntax highlighting for .profile (with ft == sh).
      > Does this not work?

      Yes, as I have indicated above, autocommand with ft=sh gives me
      syntax highlighting.

      > Since you indicated .bashrc, etc; I'm guessing that you're using bash
      > for your .profile, so you should also put
      > let g:is_bash= 1
      That's a good tip, thanks, but if I change
      au BufRead,BufNewFile {*.cfg,*.profile,*.log} set ft=sh
      " where syntax higlighting works
      " to
      au BufRead,BufNewFile {*.cfg,*.profile,*.log} set ft=bash

      I now _do not_ have highlighting

      regardless of the order in which
      let g:is_bash= 1
      comes in respect to the autocommand.

      So..... setting ft to 'sh' works, and that works for me.

      Why setting ft to 'bash' does not work is a mystery to this
      eternal vim noob, but what I have now is sufficient.
      thanks again
      --
      Tim
      tim at tee jay forty nine dot com or akwebsoft dot com
      http://www.akwebsoft.com

      --
      --
      You received this message from the "vim_mac" 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_mac" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_mac+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Charles Campbell
      ... Its because bash isn t a distribution-supported filetype; sh is. Putting let g:is_bash=1 into your .vimrc tells syntax/sh.vim to do bash-style syntax
      Message 2 of 7 , Feb 27, 2013
      • 0 Attachment
        Tim Johnson wrote:
        > * Charles Campbell <Charles.E.Campbell@...> [130226 08:37]:
        >> Tim Johnson wrote:
        >>> * Phil Dobbin <phildobbin@...> [130226 07:10]:
        >>>> On 26/02/2013 01:51, Tim Johnson wrote:
        >>>>
        >>>>> Hello:
        >>>>> How can set syntax highlighting for .profile on the mac os 10.7, as I
        >>>>> would for .bashrc or .bash_profile?
        >>>>> thanks
        >>>>>
        >>>> I use:
        >>>>
        >>>> 'au BufRead,BufNewFile {*.cfg,*.profile,*.log} set ft=syslog'
        >>>>
        >>>> in my vimrc. syslog.vim is a syntax plugin available from the scripts
        >>>> page on: <www.vim.org>
        >>> Thanks for the replies. I have followed both suggestions, and
        >>> neither worked, even as I could see ft change to syslog or bash.
        >>> But I noted that from /etc/bashrc ft is set to 'sh' with syntax
        >>> highlight operating, so :
        >>>
        >>> au BufRead,BufNewFile {*.cfg,*.profile,*.log} set ft=sh
        >>>
        >>> Gives me syntax highlighting
        >>> Thanks again
        >>> cheers
        >> syn on
        >> should have enabled syntax highlighting for .profile (with ft == sh).
        >> Does this not work?
        > Yes, as I have indicated above, autocommand with ft=sh gives me
        > syntax highlighting.
        >
        >> Since you indicated .bashrc, etc; I'm guessing that you're using bash
        >> for your .profile, so you should also put
        >> let g:is_bash= 1
        > That's a good tip, thanks, but if I change
        > au BufRead,BufNewFile {*.cfg,*.profile,*.log} set ft=sh
        > " where syntax higlighting works
        > " to
        > au BufRead,BufNewFile {*.cfg,*.profile,*.log} set ft=bash
        >
        > I now _do not_ have highlighting
        >
        > regardless of the order in which
        > let g:is_bash= 1
        > comes in respect to the autocommand.
        >
        > So..... setting ft to 'sh' works, and that works for me.
        >
        > Why setting ft to 'bash' does not work is a mystery to this
        > eternal vim noob, but what I have now is sufficient.
        >
        Its because bash isn't a distribution-supported filetype; sh is.
        Putting "let g:is_bash=1" into your .vimrc tells syntax/sh.vim to do
        bash-style syntax highlighting.
        Your .profile should be getting syntax highlighting without needing your
        au BufRead,BufNewFile ...etc... ; without the g:is_bash=1, though, it'll
        be getting Bourne style highlighting rather than bash-style syntax
        highlighting.
        So,
        without the BufRead,BufNewFile autocmd,
        and with g:is_bash=1 in your .vimrc,
        does
        vim .profile
        :syn on
        give you syntax highlighting? Because it should...

        Regards,
        C Campbell

        --
        --
        You received this message from the "vim_mac" 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_mac" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_mac+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.