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

Re: fortran highlighting not working

Expand Messages
  • Srinath
    Is it the case that the .gvimrc is sourced only once upon starting MacVim? I now know what is my issue. Normally in this modern age ;), one would have let
    Message 1 of 7 , Sep 2, 2008
    • 0 Attachment
      Is it the case that the .gvimrc is sourced only once upon starting
      MacVim? I now know what is my issue.
      Normally in this modern age ;), one would have "let
      fortran_free_source=1" in their .gvimrc file. If one was to get fancy
      (hey...fortran is to a modern language ;)), then one would comment out
      the quoted above and instead use:
      "or comment-out the above and uncomment this:
      let s:extfname = expand("%:e") " .f90 wil be free, .f fixed
      if s:extfname ==? "f90"
      let fortran_free_source=1
      elseif s:extfname ==? "F90"
      let fortran_free_source=1
      else
      unlet! fortran_free_source
      endif

      and free form would be selected because of file extension, and all
      excluded would be considered fixed form. Now, if one starts with
      "macvim <foo>.f90", then all further opened files will be opened with
      "let fortran_free_source=1". But, if one starts "macvim <bar>.f" it
      is properly highlighted as fixed form fortran, but if I open a new tab
      for <foo>.f90, MacVim is still using "unlet fortran_free_source", and
      thus is incorrectly highlighted.

      So, how do get the .vimrc or .gvimrc source with every new tab? Also,
      can I get an explanation for the different purposes for .vimrc
      and .gvimrc?

      Thanks so much for making MacVim what it is,
      <>Srinath

      On Aug 26, 8:21 am, Srinath <srinath.vadlam...@...> wrote:
      > I got things to work by using the snap shot right before the last
      > stable release (7-2?).   I will elaborate later today.
      >
      > On Aug 26, 6:24 am, Nico Weber <nicolaswe...@...> wrote:
      >
      > > Hi Srinath,
      >
      > > On 26.08.2008, at 08:09, Srinath wrote:
      >
      > > > With the most recent snapshot, the fortran highlighting for
      > > > fortran_free_form is not working.
      >
      > > does it work with the system stock `vim` in Terminal.app? If so,  
      > > please do `:e $VIMRUNTIME/syntax/fortran.vim`. What's the version of  
      > > that file (third line)? MacVim ships with version 0.88, which is the  
      > > official fortran syntax file -- also included with vim7.2 (7.0 even).
      >
      > > If highlighting for `fortran_free_form` stopped working, it's probably  
      > > because the fortran syntax file was changed.
      >
      > > Hm, after some googling I suspect that you're talking about  
      > > `fortran_free_source`. Could you elaborate on the problem?
      >
      > > Nico
      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_mac" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Nico Weber
      Hi Srinath, ... Yes. That s normal vim behavior. ... You do not really want to do that :-) What you want is a file plugin. `:h vimrc-filetype` gives an
      Message 2 of 7 , Sep 2, 2008
      • 0 Attachment
        Hi Srinath,

        On 02.09.2008, at 20:04, Srinath wrote:

        > Is it the case that the .gvimrc is sourced only once upon starting
        > MacVim?

        Yes. That's normal vim behavior.

        > So, how do get the .vimrc or .gvimrc source with every new tab?

        You do not really want to do that :-) What you want is a file plugin.
        `:h vimrc-filetype` gives an overview what this is, but a not very
        good one. Here's what you want to do, in a nutshell:

        1. Put `filetype plugin on` in your .vimrc

        2. Add a file called `f90.vim` to the folder ~/.vim/ftplugin/. This
        file will be execute every time you edit a .f90 file

        3. Put `let fortran_free_source=1` in that file.

        Now everything should work fine. If not, get back to us.

        > Also, can I get an explanation for the different purposes for .vimrc
        > and .gvimrc?

        Sure. .vimrc is read ever time you start MacVim. .gvimrc is only read
        when starting in gui mode (type `vim` in a terminal and hit enter to
        see vim in non-gui mode).

        >
        HTH,
        Nico

        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_mac" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • Srinath
        I had to create ~/.vim/ftplugin directories. I added f90.vim and also added a F90.vim with the solo line: let fortran_free_source=1 This did not work. I must
        Message 3 of 7 , Sep 2, 2008
        • 0 Attachment
          I had to create ~/.vim/ftplugin directories. I added f90.vim
          and also added a F90.vim with the solo line:

          let fortran_free_source=1

          This did not work. I must be missing some.
          <>Srinath

          On Sep 2, 1:40 pm, Nico Weber <nicolaswe...@...> wrote:
          > Hi Srinath,
          >
          > On 02.09.2008, at 20:04, Srinath wrote:
          >
          > > Is it the case that the .gvimrc is sourced only once upon starting
          > > MacVim?
          >
          > Yes. That's normal vim behavior.
          >
          > > So, how do get the .vimrc or .gvimrc source with every new tab?
          >
          > You do not really want to do that :-) What you want is a file plugin.  
          > `:h vimrc-filetype` gives an overview what this is, but a not very  
          > good one. Here's what you want to do, in a nutshell:
          >
          > 1. Put `filetype plugin on` in your .vimrc
          >
          > 2. Add a file called `f90.vim` to the folder ~/.vim/ftplugin/. This  
          > file will be execute every time you edit a .f90 file
          >
          > 3. Put `let fortran_free_source=1` in that file.
          >
          > Now everything should work fine. If not, get back to us.
          >
          > >  Also, can I get an explanation for the different purposes for .vimrc
          > > and .gvimrc?
          >
          > Sure. .vimrc is read ever time you start MacVim. .gvimrc is only read  
          > when starting in gui mode (type `vim` in a terminal and hit enter to  
          > see vim in non-gui mode).
          >
          >
          >
          > HTH,
          > Nico
          --~--~---------~--~----~------------~-------~--~----~
          You received this message from the "vim_mac" maillist.
          For more information, visit http://www.vim.org/maillist.php
          -~----------~----~----~----~------~----~------~--~---
        • Nico Weber
          Hi, ... my fault, I m just not familiar with that fortran stuff :-P So, remove f90.vim and F90.vim and instead put a file called fortran.vim into
          Message 4 of 7 , Sep 3, 2008
          • 0 Attachment
            Hi,

            On 03.09.2008, at 06:35, Srinath wrote:

            > I had to create ~/.vim/ftplugin directories. I added f90.vim
            > and also added a F90.vim with the solo line:
            >
            > let fortran_free_source=1
            >
            > This did not work. I must be missing some.

            my fault, I'm just not familiar with that fortran stuff :-P So, remove
            f90.vim and F90.vim and instead put a file called 'fortran.vim' into
            ~/.vim/ftplugin (the file needs to be called like the filetype it
            should be loaded for -- the output of `:set filetype?` is hopefully
            "fortran" on your system, too). In that file fortran.vim put

            let s:extfname = expand("%:e")
            if s:extfname ==? "f90"
            let fortran_free_source=1
            unlet! fortran_fixed_source
            else
            let fortran_fixed_source=1
            unlet! fortran_free_source
            endif

            Note that this will work only if the "filetype plugin indent on" command
            precedes the "syntax on" command in your .vimrc file.

            (taken from `:h fortran`).

            Does this help?

            Nico

            --~--~---------~--~----~------------~-------~--~----~
            You received this message from the "vim_mac" maillist.
            For more information, visit http://www.vim.org/maillist.php
            -~----------~----~----~----~------~----~------~--~---
          Your message has been successfully submitted and would be delivered to recipients shortly.