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

Issue 215 in vim: ft=sh highlighting thinks . is a valid character in variable names.

Expand Messages
  • vim@...
    Status: New Owner: ---- Labels: Type-Defect Priority-Medium New issue 215 by ewtoo...@gmail.com: ft=sh highlighting thinks . is a valid character in variable
    Message 1 of 10 , Apr 7, 2014
    • 0 Attachment
      Status: New
      Owner: ----
      Labels: Type-Defect Priority-Medium

      New issue 215 by ewtoo...@...: ft=sh highlighting thinks . is a valid
      character in variable names.
      http://code.google.com/p/vim/issues/detail?id=215

      What steps will reproduce the problem?
      0. Start vim without a configuration:
      $ vim -u NONE test.sh
      1. :set ft=sh
      2. :syntax on
      3. insert the following:
      echo "$PATH.text"
      echo "$PATH/text"

      What is the expected output?
      .text and /text should be the same colour.

      What do you see instead?
      .text is the same colour as PATH, incorrectly suggesting the variable name
      is PATH.text, when it is not. Just run
      $ sh test.sh
      if you are unsure yourself. If the variable name was PATH.text, the first
      line in the script would only write a newline to stdout.

      What version of the product are you using? On what operating system?
      7.4.214-1 on archlinux x86_64. (-1 is the archlinux package release number.)

      Please provide any additional information below.
      $ vim --version
      returns
      VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Mar 24 2014 19:36:05)
      Included patches: 1-214
      Compiled by Arch Linux
      Huge version with GTK2 GUI. Features included (+) or not (-):
      +acl +farsi +mouse_netterm +syntax
      +arabic +file_in_path +mouse_sgr +tag_binary
      +autocmd +find_in_path -mouse_sysmouse +tag_old_static
      +balloon_eval +float +mouse_urxvt -tag_any_white
      +browse +folding +mouse_xterm -tcl
      ++builtin_terms -footer +multi_byte +terminfo
      +byte_offset +fork() +multi_lang +termresponse
      +cindent +gettext -mzscheme +textobjects
      +clientserver -hangul_input +netbeans_intg +title
      +clipboard +iconv +path_extra +toolbar
      +cmdline_compl +insert_expand +perl +user_commands
      +cmdline_hist +jumplist +persistent_undo +vertsplit
      +cmdline_info +keymap +postscript +virtualedit
      +comments +langmap +printer +visual
      +conceal +libcall +profile +visualextra
      +cryptv +linebreak +python +viminfo
      +cscope +lispindent -python3 +vreplace
      +cursorbind +listcmds +quickfix +wildignore
      +cursorshape +localmap +reltime +wildmenu
      +dialog_con_gui +lua +rightleft +windows
      +diff +menu +ruby +writebackup
      +digraphs +mksession +scrollbind +X11
      +dnd +modify_fname +signs -xfontset
      -ebcdic +mouse +smartindent +xim
      +emacs_tags +mouseshape -sniff +xsmp_interact
      +eval +mouse_dec +startuptime +xterm_clipboard
      +ex_extra +mouse_gpm +statusline -xterm_save
      +extra_search -mouse_jsbterm -sun_workshop -xpm
      system vimrc file: "/etc/vimrc"
      user vimrc file: "$HOME/.vimrc"
      2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
      system gvimrc file: "/etc/gvimrc"
      user gvimrc file: "$HOME/.gvimrc"
      2nd user gvimrc file: "~/.vim/gvimrc"
      system menu file: "$VIMRUNTIME/menu.vim"
      fall-back for $VIM: "/usr/share/vim"
      Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -pthread
      -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/pango-1.0
      -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1
      -I/usr/include/libdrm -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16
      -I/usr/include/pango-1.0 -I/usr/include/glib-2.0
      -I/usr/lib/glib-2.0/include -I/usr/include/freetype2
      -I/usr/include/libpng16 -I/usr/include/harfbuzz -I/usr/include/freetype2
      -I/usr/include/libpng16 -I/usr/include/harfbuzz -D_FORTIFY_SOURCE=2
      -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector
      --param=ssp-buffer-size=4 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
      Linking: gcc -L. -Wl,-O1,--sort-common,--as-needed,-z,relro
      -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-E
      -Wl,-rpath,/usr/lib/perl5/core_perl/CORE
      -Wl,-O1,--sort-common,--as-needed,-z,relro -L/usr/local/lib -Wl,--as-needed
      -o vim -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo
      -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0
      -lglib-2.0 -lfontconfig -lfreetype -lSM -lICE -lXt -lX11 -lXdmcp -lSM
      -lICE -lm -lncurses -lelf -lnsl -lacl -lattr -lgpm -ldl -L/usr/lib
      -llua -Wl,-E -Wl,-rpath,/usr/lib/perl5/core_perl/CORE
      -Wl,-O1,--sort-common,--as-needed,-z,relro -fstack-protector
      -L/usr/local/lib -L/usr/lib/perl5/core_perl/CORE -lperl -lnsl -ldl -lm
      -lcrypt -lutil -lpthread -lc -L/usr/lib/python2.7/config -lpython2.7
      -lpthread -ldl -lutil -lm -Xlinker -export-dynamic -lruby -lpthread -lgmp
      -ldl -lcrypt -lm -L/usr/lib


      --
      You received this message because this project is configured to send all
      issue notifications to this address.
      You may adjust your notification preferences at:
      https://code.google.com/hosting/settings

      --
      --
      You received this message from the "vim_dev" 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_dev" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/d/optout.
    • vim@...
      Comment #1 on issue 215 by John.B.L...@gmail.com: ft=sh highlighting thinks . is a valid character in variable names.
      Message 2 of 10 , Apr 8, 2014
      • 0 Attachment
        Comment #1 on issue 215 by John.B.L...@...: ft=sh highlighting
        thinks . is a valid character in variable names.
        http://code.google.com/p/vim/issues/detail?id=215

        The Korn shell has . in variable names; bash doesn't AFAICT, but sh.vim
        anticipates the problem: if you put this in your .vimrc

        let g:sh_noisk = 1

        "." will no longer be part of keywords.

        Regards, John Little

        --
        You received this message because this project is configured to send all
        issue notifications to this address.
        You may adjust your notification preferences at:
        https://code.google.com/hosting/settings

        --
        --
        You received this message from the "vim_dev" 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_dev" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
        For more options, visit https://groups.google.com/d/optout.
      • vim@...
        Comment #2 on issue 215 by gary....@gmail.com: ft=sh highlighting thinks . is a valid character in variable names.
        Message 3 of 10 , Apr 8, 2014
        • 0 Attachment
          Comment #2 on issue 215 by gary....@...: ft=sh highlighting thinks .
          is a valid character in variable names.
          http://code.google.com/p/vim/issues/detail?id=215

          Setting g:sh_noisk doesn't seem to affect the syntax highlighting of '.'
          using Vim 7.4.236 and syntax/sh.vim version 132.

          Regards,
          Gary

          --
          You received this message because this project is configured to send all
          issue notifications to this address.
          You may adjust your notification preferences at:
          https://code.google.com/hosting/settings

          --
          --
          You received this message from the "vim_dev" 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_dev" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
          For more options, visit https://groups.google.com/d/optout.
        • vim@...
          Comment #3 on issue 215 by ewtoo...@gmail.com: ft=sh highlighting thinks . is a valid character in variable names.
          Message 4 of 10 , Apr 8, 2014
          • 0 Attachment
            Comment #3 on issue 215 by ewtoo...@...: ft=sh highlighting thinks .
            is a valid character in variable names.
            http://code.google.com/p/vim/issues/detail?id=215

            """
            The Korn shell has . in variable names; bash doesn't AFAICT, but sh.vim
            anticipates the problem: if you put this in your .vimrc

            let g:sh_noisk = 1

            "." will no longer be part of keywords.
            """---John.B

            It seems to me that the Korn shell is far less common than the Bourne Shell
            or the Bourne Again Shell, both of which do not allow '.'. As such, the
            Korn shell is the special case, for which something like 'let g:sh_nu_metal
            = 1' should be necessary to /add/ '.' to variable names. The default
            behaviour should not include '.'.

            --
            You received this message because this project is configured to send all
            issue notifications to this address.
            You may adjust your notification preferences at:
            https://code.google.com/hosting/settings

            --
            --
            You received this message from the "vim_dev" 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_dev" group.
            To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
            For more options, visit https://groups.google.com/d/optout.
          • vim@...
            Comment #4 on issue 215 by John.B.L...@gmail.com: ft=sh highlighting thinks . is a valid character in variable names.
            Message 5 of 10 , Apr 8, 2014
            • 0 Attachment
              Comment #4 on issue 215 by John.B.L...@...: ft=sh highlighting
              thinks . is a valid character in variable names.
              http://code.google.com/p/vim/issues/detail?id=215

              Gary commented:

              > Setting g:sh_noisk doesn't seem to affect the syntax highlighting of '.'
              > using Vim >7.4.236 and syntax/sh.vim version 132.

              I tested it carefully, sh.vim 132 and 133. Maybe:

              - Changing it after loading sh.vim has no effect, even reloading sh.vim
              won't work. Did you put the setting in .vimrc?

              - g:sh_isk overrides it too, if you have that set it will use that.

              - on some colour schemes, the change is subtle.

              ewtoo...@... commented:
              ...The default behaviour should not include '.'.

              I agree; even with ksh a dot is only seen as part of a variable name within
              a ${...}
              construct, in your example $PATH.text is parsed as ${PATH}.text even with
              ksh.

              Note that a syntax colouring file for .sh files IMO is a heroic
              undertaking, mind boggling in difficulty for even one flavour of shell
              script, let alone one that copes with the old Bourne shell, bash, ksh,
              dash, ash, and zsh.

              Regards, John

              --
              You received this message because this project is configured to send all
              issue notifications to this address.
              You may adjust your notification preferences at:
              https://code.google.com/hosting/settings

              --
              --
              You received this message from the "vim_dev" 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_dev" group.
              To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
              For more options, visit https://groups.google.com/d/optout.
            • vim@...
              Comment #5 on issue 215 by gary....@gmail.com: ft=sh highlighting thinks . is a valid character in variable names.
              Message 6 of 10 , Apr 8, 2014
              • 0 Attachment
                Comment #5 on issue 215 by gary....@...: ft=sh highlighting thinks .
                is a valid character in variable names.
                http://code.google.com/p/vim/issues/detail?id=215

                I tested it two ways: using my standard setup, which includes the setting
                of g:sh_noisk in my .vimrc, and the following command, which should
                eliminate anything unique to my environment.

                vim -N -u NORC -i NONE --cmd 'let &rtp=$VIMRUNTIME' --cmd 'let
                g:is_bash=1' --cmd 'let g:sh_noisk=1' --cmd 'syntax on' foo.sh

                The file foo.sh contained the line

                FOO.BAR=hello

                I used the command from http://vim.sourceforge.net/tips/tip.php?tip_id=99
                to determine the syntax highlighting under the cursor. Putting the cursor
                over the "FOO", the "." and the "BAR" all gave the same result:

                hi<shVariable> trans<shVariable> lo<Identifier>

                Regards,
                Gary

                --
                You received this message because this project is configured to send all
                issue notifications to this address.
                You may adjust your notification preferences at:
                https://code.google.com/hosting/settings

                --
                --
                You received this message from the "vim_dev" 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_dev" group.
                To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
                For more options, visit https://groups.google.com/d/optout.
              • vim@...
                Updates: Status: Started Owner: drc...@campbellfamily.biz Comment #6 on issue 215 by drc...@campbellfamily.biz: ft=sh highlighting thinks . is a valid
                Message 7 of 10 , Apr 9, 2014
                • 0 Attachment
                  Updates:
                  Status: Started
                  Owner: drc...@...

                  Comment #6 on issue 215 by drc...@...: ft=sh highlighting
                  thinks . is a valid character in variable names.
                  http://code.google.com/p/vim/issues/detail?id=215

                  Please try syntax/sh.vim v133, available at my website as

                  http://www.drchip.org/astronaut/vim/index.html#SYNTAX_SH

                  I haven't inflicted it on Bram and the broader vim community yet, so I'm
                  still entertaining feedback on it.

                  Gary: g:sh_noisk affects whether or not syntax/sh.vim will change isk for
                  that buffer. When one does a "dw" while atop a foo.bar using ksh, one
                  wants foo.bar to be deleted, not just the foo or bar. It doesn't affect
                  shVariable highlighting, as your experiments noted.

                  ewtoombs: you have a common misperception about the "popularity" of bash vs
                  ksh; although bash is more common than ksh, posix is largely the same as
                  ksh, and hence shares (mostly) the same highlighting as does ksh. The
                  posix shell is also very popular.

                  --
                  You received this message because this project is configured to send all
                  issue notifications to this address.
                  You may adjust your notification preferences at:
                  https://code.google.com/hosting/settings

                  --
                  --
                  You received this message from the "vim_dev" 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_dev" group.
                  To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
                  For more options, visit https://groups.google.com/d/optout.
                • vim@...
                  Comment #7 on issue 215 by gary....@gmail.com: ft=sh highlighting thinks . is a valid character in variable names.
                  Message 8 of 10 , Apr 9, 2014
                  • 0 Attachment
                    Comment #7 on issue 215 by gary....@...: ft=sh highlighting thinks .
                    is a valid character in variable names.
                    http://code.google.com/p/vim/issues/detail?id=215

                    Thanks for the new version. With syntax/sh.vim v133, the
                    line "FOO.BAR=hello" (without the quotes) has only "BAR" highlighted.
                    However, the line "FOO,BAR=hello" has all of "FOO,BAR" highlighted as
                    shVariable. A bash variable name cannot contain a comma, either.

                    Regards,
                    Gary

                    --
                    You received this message because this project is configured to send all
                    issue notifications to this address.
                    You may adjust your notification preferences at:
                    https://code.google.com/hosting/settings

                    --
                    --
                    You received this message from the "vim_dev" 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_dev" group.
                    To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
                    For more options, visit https://groups.google.com/d/optout.
                  • vim@...
                    Comment #8 on issue 215 by drc...@campbellfamily.biz: ft=sh highlighting thinks . is a valid character in variable names.
                    Message 9 of 10 , Apr 9, 2014
                    • 0 Attachment
                      Comment #8 on issue 215 by drc...@...: ft=sh highlighting
                      thinks . is a valid character in variable names.
                      http://code.google.com/p/vim/issues/detail?id=215

                      Thanks, Gary -- I'm not sure why that comma was there, even for the
                      ksh/posix shells. So, its gone! Well, in v134, anyway.

                      --
                      You received this message because this project is configured to send all
                      issue notifications to this address.
                      You may adjust your notification preferences at:
                      https://code.google.com/hosting/settings

                      --
                      --
                      You received this message from the "vim_dev" 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_dev" group.
                      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
                      For more options, visit https://groups.google.com/d/optout.
                    • vim@...
                      Updates: Status: Fixed Comment #9 on issue 215 by drc...@campbellfamily.biz: ft=sh highlighting thinks . is a valid character in variable names.
                      Message 10 of 10 , Oct 24, 2014
                      • 0 Attachment
                        Updates:
                        Status: Fixed

                        Comment #9 on issue 215 by drc...@...: ft=sh highlighting
                        thinks . is a valid character in variable names.
                        https://code.google.com/p/vim/issues/detail?id=215

                        This problem has been fixed awhile back. Just closing it now.

                        --
                        You received this message because this project is configured to send all
                        issue notifications to this address.
                        You may adjust your notification preferences at:
                        https://code.google.com/hosting/settings

                        --
                        --
                        You received this message from the "vim_dev" 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_dev" group.
                        To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
                        For more options, visit https://groups.google.com/d/optout.
                      Your message has been successfully submitted and would be delivered to recipients shortly.