Bug#754507: vim: syntax on: matching pairs issue with zsh script

Jim Murphy srlinuxadmin at gmail.com
Fri Jul 11 20:15:04 UTC 2014


Package: vim
Version: 2:7.3.547-7
Severity: normal

Hello,

This issues does not effect the script, it does make editing interesting
when pairs don't match.  I only found this once.  This is also the first
time I used the globbing expansion flag "(.)".

Work arounds:
Switching off syntax.
Add a temporary line with just a right parentheses while editing.
  Don't forget to comment or delete before trying to run script.

FYI, also tested on a chroot load of Sid with same results:
# vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled May 27 2014 21:55:28)
Included patches: 1-273
#

Example Script:

   1 #! /bin/zsh
   2 Data_Path_Saved="${HOME}/some/valid/path/"
   3 SavedFilesList=("${(f@)$(ls ${Data_Path_Saved}**/*(.))}")
   4 print "Found ${#SavedFilesList} files."

Note: Script runs without a problem.

While editing the above script, pair matching fails on line 3 after the period.
This is with syntax "on".  With syntax "off" pair matching works fine.

SavedFilesList=("${(f@)$(ls ${Data_Path_Saved}**/*(.))}")
               ^                                  ^ ^^
               *                Start of pair  _ /   \\_ match here syntax "on"
                                                      \_ match here syntax "off"

* With syntax on, the first parentheses will never be matched.

Although placing the curser over the right parentheses after the period, does
match the left parentheses on the left side of the period.

BTW, the line of code is setting an array element for each "file" found by the
recursive globbing.

Thanks in advance.

Sincerely,

Jim

-- Package-specific info:

--- real paths of main Vim binaries ---
/usr/bin/vi is /usr/bin/vim.basic
/usr/bin/vim is /usr/bin/vim.basic

-- System Information:
Debian Release: 7.5
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'proposed-updates'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to en_US.UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages vim depends on:
ii  libacl1      2.2.51-8
ii  libc6        2.13-38+deb7u2
ii  libgpm2      1.20.4-6
ii  libselinux1  2.1.9-5 
ii  libtinfo5    5.9-10
ii  vim-common   2:7.3.547-7
ii  vim-runtime  2:7.3.547-7

vim recommends no packages.

Versions of packages vim suggests:
pn   ctags       <none>
pn   vim-doc     <none>
pn   vim-scripts <none>

-- no debconf information

--

Also tested on a chroot load of Sid with same results:

# vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled May 27 2014 21:55:28)
Included patches: 1-273
#

Example Script:

   1 #! /bin/zsh
   2 Data_Path_Saved="${HOME}/some/valid/path/"
   3 SavedFilesList=("${(f@)$(ls ${Data_Path_Saved}**/*(.))}")
   4 print "Found ${#SavedFilesList} files."

Note: Script runs without a problem.

While editing the above script, pair matching fails on line 3 after the period.
This is with syntax "on".  With syntax "off" pair matching works fine.

SavedFilesList=("${(f@)$(ls ${Data_Path_Saved}**/*(.))}")
               ^                                  ^ ^^
               *                Start of pair  _ /   \\_ match here syntax "on"
                                                      \_ match here syntax "off"

* With syntax on, the first parentheses will never be matched.

Although placing the curser over the right parentheses after the period, does
match the left parentheses on the left side of the period.

BTW, the line of code is setting an array element for each "file" found by the
recursive globbing.



More information about the pkg-vim-maintainers mailing list