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

Re: vim: who/where/when set my ft?

Expand Messages
  • ping
    ... thanks! that s another good tip to learn about debugging vim. so I tried that: vim -V2temp-vim-verbose-log temp1.log and from the result
    Message 1 of 14 , Jul 31, 2012
    • 0 Attachment
      On 07/31/2012 11:08 AM, Gary Johnson wrote:
      > On 2012-07-31, ping wrote:
      >
      >> I tried these debugging tools but still have no clear clue.
      >> I even tried vim -V temp1.log or vim -V4 temp1.log, the 1st part of
      >> the result flushed away from my screen and I couldn't capture
      >> anything into here, from the rest of the output I couldn't find
      >> anything related to /etc/vim
      >
      > If you immediately follow the -V argument by a filename (i.e.,
      > without an intervening space), the debug information will be
      > captured to that file instead of being spewed across your screen. I
      > think level 2 will capture what we're interested in here.
      >
      > vim -V2verboselog [other arguments]
      >
      > Regards,
      > Gary
      >

      thanks! that's another good tip to learn about debugging vim.

      so I tried that:
      vim -V2temp-vim-verbose-log temp1.log

      and from the result temp-vim-verbose-log file I couldn't find a match on
      /etc/vim:
      ping@640g-laptop:~$ grep "/etc/vim" temp-vim-verbose-log
      ping@640g-laptop:~$

      so I tried another raw method: I open all 10 scripts from :scriptnames
      captures, and did a search into them:

      :scriptnames
      1: /usr/share/vim/vimrc
      2: /usr/share/vim/vim73/syntax/syntax.vim
      3: /usr/share/vim/vim73/syntax/synload.vim
      4: /usr/share/vim/vim73/syntax/syncolor.vim
      5: /usr/share/vim/vim73/filetype.vim
      6: /home/ping/.vim/ftdetect/csv.vim
      7: /home/ping/.vim/ftdetect/mkd.vim
      8: /home/ping/.vim/ftdetect/myft.vim
      9: /home/ping/.vim/ftdetect/taskpaper.vim
      10: /etc/vim/ftdetect/asciidoc_filetype.vim <-----------

      ping@640g-laptop:~$ vim /usr/share/vim/vimrc
      /usr/share/vim/vim73/syntax/syntax.vim
      /usr/share/vim/vim73/syntax/synload.vim
      /usr/share/vim/vim73/syntax/syncolor.vim
      /usr/share/vim/vim73/filetype.vim /home/ping/.vim/ftdetect/csv.vim
      /home/ping/.vim/ftdetect/mkd.vim /home/ping/.vim/ftdetect/myft.vim
      /home/ping/.vim/ftdetect/taskpaper.vim

      and only 1 file contains an close entry:
      "/usr/share/vim/vimrc"
      51 " Source a global configuration file if available
      52 if filereadable("/etc/vim/vimrc.local")
      53 source /etc/vim/vimrc.local
      54 endif
      55
      ~



      ~


      /usr/share/vim/vimrc

      but even that doesn't explain why this script was involved here:
      10: /etc/vim/ftdetect/asciidoc_filetype.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
    • Gary Johnson
      ... [...] ... It s odd that someone would put system/local Vim configuration files in both /usr/share/vim and /etc. In my experience, package maintainers
      Message 2 of 14 , Jul 31, 2012
      • 0 Attachment
        On 2012-07-31, ping wrote:
        > On 07/31/2012 11:08 AM, Gary Johnson wrote:
        > >On 2012-07-31, ping wrote:
        > >
        > >>I tried these debugging tools but still have no clear clue.
        > >>I even tried vim -V temp1.log or vim -V4 temp1.log, the 1st part of
        > >>the result flushed away from my screen and I couldn't capture
        > >>anything into here, from the rest of the output I couldn't find
        > >>anything related to /etc/vim
        > >
        > >If you immediately follow the -V argument by a filename (i.e.,
        > >without an intervening space), the debug information will be
        > >captured to that file instead of being spewed across your screen. I
        > >think level 2 will capture what we're interested in here.
        > >
        > > vim -V2verboselog [other arguments]

        > thanks! that's another good tip to learn about debugging vim.
        >
        > so I tried that:
        > vim -V2temp-vim-verbose-log temp1.log
        >
        > and from the result temp-vim-verbose-log file I couldn't find a match
        > on /etc/vim:
        > ping@640g-laptop:~$ grep "/etc/vim" temp-vim-verbose-log
        > ping@640g-laptop:~$

        [...]

        > and only 1 file contains an close entry:
        > "/usr/share/vim/vimrc"
        > 51 " Source a global configuration file if available
        > 52 if filereadable("/etc/vim/vimrc.local")
        > 53 source /etc/vim/vimrc.local
        > 54 endif
        > 55

        It's odd that someone would put system/local Vim configuration files
        in both /usr/share/vim and /etc. In my experience, package
        maintainers choose one or the other.

        Somewhere in that temp-vim-verbose-log file there should have been a
        message about /etc/vim/ftdetect/asciidoc_filetype.vim, so maybe I
        had the level wrong. ":help 'verbose'" lists the levels and what
        they do. Maybe 8 would work better. (I usually just set 15 and go
        searching through the mess that results.)

        What are you running on that laptop? If a Linux distribution, which
        one?

        Regards,
        Gary

        --
        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
      • Ben Schmidt
        ... In this case, we don t want the file just before it, but the one a few files back: /usr/share/vim/vim73/filetype.vim has clearly issued ... each directory
        Message 3 of 14 , Jul 31, 2012
        • 0 Attachment
          >>> filetype=asciidoc
          >>> Last set from /etc/vim/ftdetect/asciidoc_filetype.vim
          >>>
          >>> what is that /etc/vim/ folder doing here?
          >>>
          >>> runtimepath=~/.vim,/usr/share/vim/vimfiles,/usr/share/vim/vim73,/usr/share/vim/vimfiles/after,~/.vim/after

          > :scriptnames
          > 1: /usr/share/vim/vimrc
          > 2: /usr/share/vim/vim73/syntax/syntax.vim
          > 3: /usr/share/vim/vim73/syntax/synload.vim
          > 4: /usr/share/vim/vim73/syntax/syncolor.vim
          > 5: /usr/share/vim/vim73/filetype.vim
          > 6: /home/ping/.vim/ftdetect/csv.vim
          > 7: /home/ping/.vim/ftdetect/mkd.vim
          > 8: /home/ping/.vim/ftdetect/myft.vim
          > 9: /home/ping/.vim/ftdetect/taskpaper.vim
          > 10: /etc/vim/ftdetect/asciidoc_filetype.vim <-----------

          > ***the file right before it:
          > 9: /home/ping/.vim/ftdetect/taskpaper.vim

          In this case, we don't want the file just before it, but the one a few
          files back: /usr/share/vim/vim73/filetype.vim has clearly issued
          :runtime! which is sourcing all scripts in the ftdetect subdirectory of
          each directory in runtimepath, as a bunch of unrelated files under
          ftdetect are being sourced.

          Indeed the filetype.vim distributed with vim does include the command
          :runtime! ftdetect/*.vim

          So, either:

          - runtimepath was different when filetype.vim was loaded. You can have a
          good guess about this by giving giving :verbose runtimepath? and
          checking whether it was set by a script before or after filetype.vim
          in the :scriptnames list.

          - more likely, one of the directories or subdirectories in your runtime
          path is symlinked (or possibly but probably not hardlinked) to
          something in /etc/vim. It's not /usr/share/vim/vim73, because that is
          appearing in :scriptnames as itself, but there's a good chance that
          /usr/share/vim/vimfiles is symlinked (or hardlinked) to /etc/vim. That
          would fit nicely with some distributions' policies of putting
          user-written/mutable configuration files under /etc but distributed
          static configuration/support files under /usr. (It comes up as the
          real path rather than the path in runtimepath presumably because Vim
          does realpath() on the files so that duplicates are correctly
          identified and script-local scope can work reliably.)

          Hope this helps,

          Ben.



          --
          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
        • Ben Schmidt
          ... P.S. You can check this by doing ls -ld /usr/share/vim/vimfiles in a terminal, though you probably know that. ... -- You received this message from the
          Message 4 of 14 , Jul 31, 2012
          • 0 Attachment
            On 1/08/12 10:07 AM, Ben Schmidt wrote:
            >>>> filetype=asciidoc
            >>>> Last set from /etc/vim/ftdetect/asciidoc_filetype.vim
            >>>>
            >>>> what is that /etc/vim/ folder doing here?
            >>>>
            >>>> runtimepath=~/.vim,/usr/share/vim/vimfiles,/usr/share/vim/vim73,/usr/share/vim/vimfiles/after,~/.vim/after
            >>>>
            >
            >> :scriptnames
            >> 1: /usr/share/vim/vimrc
            >> 2: /usr/share/vim/vim73/syntax/syntax.vim
            >> 3: /usr/share/vim/vim73/syntax/synload.vim
            >> 4: /usr/share/vim/vim73/syntax/syncolor.vim
            >> 5: /usr/share/vim/vim73/filetype.vim
            >> 6: /home/ping/.vim/ftdetect/csv.vim
            >> 7: /home/ping/.vim/ftdetect/mkd.vim
            >> 8: /home/ping/.vim/ftdetect/myft.vim
            >> 9: /home/ping/.vim/ftdetect/taskpaper.vim
            >> 10: /etc/vim/ftdetect/asciidoc_filetype.vim <-----------
            >
            >> ***the file right before it:
            >> 9: /home/ping/.vim/ftdetect/taskpaper.vim
            >
            > In this case, we don't want the file just before it, but the one a few
            > files back: /usr/share/vim/vim73/filetype.vim has clearly issued
            > :runtime! which is sourcing all scripts in the ftdetect subdirectory of
            > each directory in runtimepath, as a bunch of unrelated files under
            > ftdetect are being sourced.
            >
            > Indeed the filetype.vim distributed with vim does include the command
            > :runtime! ftdetect/*.vim
            >
            > So, either:
            >
            > - runtimepath was different when filetype.vim was loaded. You can have a
            > good guess about this by giving giving :verbose runtimepath? and
            > checking whether it was set by a script before or after filetype.vim
            > in the :scriptnames list.
            >
            > - more likely, one of the directories or subdirectories in your runtime
            > path is symlinked (or possibly but probably not hardlinked) to
            > something in /etc/vim. It's not /usr/share/vim/vim73, because that is
            > appearing in :scriptnames as itself, but there's a good chance that
            > /usr/share/vim/vimfiles is symlinked (or hardlinked) to /etc/vim. That
            > would fit nicely with some distributions' policies of putting
            > user-written/mutable configuration files under /etc but distributed
            > static configuration/support files under /usr. (It comes up as the
            > real path rather than the path in runtimepath presumably because Vim
            > does realpath() on the files so that duplicates are correctly
            > identified and script-local scope can work reliably.)

            P.S. You can check this by doing ls -ld /usr/share/vim/vimfiles in a
            terminal, though you probably know that.

            > Hope this helps,
            >
            > Ben.
            >
            >
            >

            --
            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
          • ping
            ... ping@640g-laptop:~$ ls -ld /usr/share/vim/vimfiles lrwxrwxrwx 1 root root 8 2010-03-07 06:50 /usr/share/vim/vimfiles - /etc/vim ...
            Message 5 of 14 , Jul 31, 2012
            • 0 Attachment
              On 7/31/2012 8:13 PM, Ben Schmidt wrote:
              > On 1/08/12 10:07 AM, Ben Schmidt wrote:
              >>>>> filetype=asciidoc
              >>>>> Last set from /etc/vim/ftdetect/asciidoc_filetype.vim
              >>>>>
              >>>>> what is that /etc/vim/ folder doing here?
              >>>>>
              >>>>> runtimepath=~/.vim,/usr/share/vim/vimfiles,/usr/share/vim/vim73,/usr/share/vim/vimfiles/after,~/.vim/after
              >>>>>
              >>>>>
              >>
              >>> :scriptnames
              >>> 1: /usr/share/vim/vimrc
              >>> 2: /usr/share/vim/vim73/syntax/syntax.vim
              >>> 3: /usr/share/vim/vim73/syntax/synload.vim
              >>> 4: /usr/share/vim/vim73/syntax/syncolor.vim
              >>> 5: /usr/share/vim/vim73/filetype.vim
              >>> 6: /home/ping/.vim/ftdetect/csv.vim
              >>> 7: /home/ping/.vim/ftdetect/mkd.vim
              >>> 8: /home/ping/.vim/ftdetect/myft.vim
              >>> 9: /home/ping/.vim/ftdetect/taskpaper.vim
              >>> 10: /etc/vim/ftdetect/asciidoc_filetype.vim <-----------
              >>
              >>> ***the file right before it:
              >>> 9: /home/ping/.vim/ftdetect/taskpaper.vim
              >>
              >> In this case, we don't want the file just before it, but the one a few
              >> files back: /usr/share/vim/vim73/filetype.vim has clearly issued
              >> :runtime! which is sourcing all scripts in the ftdetect subdirectory of
              >> each directory in runtimepath, as a bunch of unrelated files under
              >> ftdetect are being sourced.
              >>
              >> Indeed the filetype.vim distributed with vim does include the command
              >> :runtime! ftdetect/*.vim
              >>
              >> So, either:
              >>
              >> - runtimepath was different when filetype.vim was loaded. You can have a
              >> good guess about this by giving giving :verbose runtimepath? and
              >> checking whether it was set by a script before or after filetype.vim
              >> in the :scriptnames list.
              >>
              >> - more likely, one of the directories or subdirectories in your runtime
              >> path is symlinked (or possibly but probably not hardlinked) to
              >> something in /etc/vim. It's not /usr/share/vim/vim73, because that is
              >> appearing in :scriptnames as itself, but there's a good chance that
              >> /usr/share/vim/vimfiles is symlinked (or hardlinked) to /etc/vim. That
              >> would fit nicely with some distributions' policies of putting
              >> user-written/mutable configuration files under /etc but distributed
              >> static configuration/support files under /usr. (It comes up as the
              >> real path rather than the path in runtimepath presumably because Vim
              >> does realpath() on the files so that duplicates are correctly
              >> identified and script-local scope can work reliably.)
              >
              > P.S. You can check this by doing ls -ld /usr/share/vim/vimfiles in a
              > terminal, though you probably know that.
              >

              ping@640g-laptop:~$ ls -ld /usr/share/vim/vimfiles
              lrwxrwxrwx 1 root root 8 2010-03-07 06:50 /usr/share/vim/vimfiles ->
              /etc/vim

              :set runtimepath?

              runtimepath=~/.vim,/usr/share/vim/vimfiles,/usr/share/vim/vim73,/usr/share/vim/vimfiles/after,~/.vim/after


              >> Hope this helps,
              >>
              >> Ben.

              Ben, you are exactly right!

              --
              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
            Your message has been successfully submitted and would be delivered to recipients shortly.