Vim error message when opening .ini file

66 просмотров
Перейти к первому непрочитанному сообщению

Melvin Q. Watchpocket

не прочитано,
19 авг. 2023 г., 18:44:5019.08.2023
– vim_use

Vim shows the following long error message when I open a file with a dot-ini (.ini) file extension:

Error detected while processing /usr/share/vim/vimrc[25]../usr/share/vim/vim90/syntax/syntax.vim[44]..BufRead Autocommands for "*~"..BufRead Autocommands for "*.ini"..FileType Autocommands for "*"..Syntax Autocommands for "*"..function <SNR>3_SynSet[25]..script /usr/share/vim/vim90/syntax/dosini.vim: line 28: E10: \ should be followed by /, ? or &

Following that "\" on line 28 with any one of "/", "?" or "&" resulted in an even longer error message.

In my .zshenv:

export EDITOR=vim 
export FCEDIT=vim 
export SLANG_EDITOR=vim

Also:

--> vim --version
VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Aug 15 2023 20:47:29) Included patches: 1-1713 Modified by team...@tracker.debian.org Compiled by team...@tracker.debian.org Huge version without GUI. Features included (+) or not (-): +acl +file_in_path +mouse_urxvt -tag_any_white +arabic +find_in_path +mouse_xterm -tcl +autocmd +float +multi_byte +termguicolors +autochdir +folding +multi_lang +terminal -autoservername -footer -mzscheme +terminfo -balloon_eval +fork() +netbeans_intg +termresponse +balloon_eval_term +gettext +num64 +textobjects -browse -hangul_input +packages +textprop ++builtin_terms +iconv +path_extra +timers +byte_offset +insert_expand -perl +title +channel +ipv6 +persistent_undo -toolbar +cindent +job +popupwin +user_commands -clientserver +jumplist +postscript +vartabs -clipboard +keymap +printer +vertsplit +cmdline_compl +lambda +profile +vim9script +cmdline_hist +langmap -python +viminfo +cmdline_info +libcall +python3 +virtualedit +comments +linebreak +quickfix +visual +conceal +lispindent +reltime +visualextra +cryptv +listcmds +rightleft +vreplace +cscope +localmap -ruby +wildignore +cursorbind -lua +scrollbind +wildmenu +cursorshape +menu +signs +windows +dialog_con +mksession +smartindent +writebackup +diff +modify_fname +sodium -X11 +digraphs +mouse -sound -xfontset -dnd -mouseshape +spell -xim -ebcdic +mouse_dec +startuptime -xpm +emacs_tags +mouse_gpm +statusline -xsmp +eval -mouse_jsbterm -sun_workshop -xterm_clipboard +ex_extra +mouse_netterm +syntax -xterm_save +extra_search +mouse_sgr +tag_binary -farsi -mouse_sysmouse -tag_old_static system vimrc file: "$VIM/vimrc" user vimrc file: "$HOME/.vimrc" 2nd user vimrc file: "~/.vim/vimrc" user exrc file: "$HOME/.exrc" defaults file: "$VIMRUNTIME/defaults.vim" fall-back for $VIM: "/usr/share/vim" Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -Wdate-time -g -O2 -ffile-prefix-map=/build/vim-9Zy3tT/vim-9.0.0749+really.v9.0.1713=. -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 Linking: gcc -Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -flto=auto -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim -lm -ltinfo -lselinux -lsodium -lacl -lattr -lgpm -L/usr/lib/python3.10/config-3.10-x86_64-linux-gnu -lpython3.10 -lcrypt -ldl -lm -lm```

:set runtimepath? shows:

runtimepath=~/.vim,/var/lib/vim/addons,/etc/vim,/usr/share/vim/vimfiles,/usr/share/vim/vim90/,/usr/share/vim/vimfiles/after,/etc/vim/after,/var/lib/vim/addons/after,~/.vim/after

Also, I have vim-plug the vim plugin manager in ~/.vim/autoload/plug.vim but no plugins installed yet.

How can I get Vim to open .ini files without any error message(s)?

Enan Ajmain

не прочитано,
20 авг. 2023 г., 01:21:3520.08.2023
– Melvin Q. Watchpocket, vim...@googlegroups.com, ho...@topbug.net
On Sat, 19 Aug 2023 15:24:29 -0700 (PDT)
"Melvin Q. Watchpocket" <watch...@gmail.com> wrote:
> <https://vi.stackexchange.com/posts/42840/timeline>
>
> Vim shows the following long error message when I open a file with a
> dot-ini (.ini) file extension:
> Error detected while processing
> /usr/share/vim/vimrc[25]../usr/share/vim/vim90/syntax/syntax.vim[44]..BufRead
> Autocommands for "*~"..BufRead Autocommands for "*.ini"..FileType
> Autocommands for "*"..Syntax Autocommands for "*"..function
> <SNR>3_SynSet[25]..script /usr/share/vim/vim90/syntax/dosini.vim: line 28:
> E10: \ should be followed by /, ? or &

I can't test on Linux right now. On Windows, Vim 9.0.1640 opens ini
files without error. Could you try opening the file with "--clean"
argument?

I also see that between my version (9.0.1640) and yours (9.0.1713),
dosini.vim changed [1]. Maybe try commenting out line 28?

Copying Hong Xu, the developer of dosini syntax file.

--
Enan

[1]:
https://github.com/xuhdev/syntax-dosini.vim/commit/e04e6e82b90bdbbe7aef11e767b8ad1e6f5010bf

Hong Xu

не прочитано,
20 авг. 2023 г., 03:36:4920.08.2023
– Enan Ajmain, Melvin Q. Watchpocket, vim...@googlegroups.com, Lucas Hoffmann
Hi Enan and Melvin,

I can't reproduce the bug with the latest version of the dosini file. My Vim version is 9.0.1378 but I have installed the latest dosini syntax file.

Would you still be able to reproduce the error if you comment out lines 27 and 28 of `/usr/share/vim/vim90/syntax/dosini.vim`?

Also CCing the patch contributor Lucas.

Hong

Anton Sharonov

не прочитано,
20 авг. 2023 г., 03:49:4720.08.2023
– vim...@googlegroups.com, Enan Ajmain, Melvin Q. Watchpocket, Lucas Hoffmann
for what it worst, Debian (?) user complained as well in
comp.editors about dosini.vim error which looks similar, may be
also related:

https://groups.google.com/g/comp.editors/c/4ylkonD0ARs/m/KMNZRYTmBQAJ

Anton

Enan Ajmain

не прочитано,
20 авг. 2023 г., 04:27:5220.08.2023
– Anton Sharonov, vim...@googlegroups.com, Melvin Q. Watchpocket, Lucas Hoffmann, Hong Xu
On Sun, 20 Aug 2023 09:49:20 +0200
Anton Sharonov <anton.s...@gmail.com> wrote:
> for what it worst, Debian (?) user complained as well in
> comp.editors about dosini.vim error which looks similar, may be
> also related:
>
> https://groups.google.com/g/comp.editors/c/4ylkonD0ARs/m/KMNZRYTmBQAJ
>
> Anton

Not similar. It's the same user. comp.editors redirected them here.

--
Enan

Christian Brabandt

не прочитано,
20 авг. 2023 г., 04:47:5920.08.2023
– vim...@googlegroups.com

On Sa, 19 Aug 2023, Melvin Q. Watchpocket wrote:

>
>
> Vim shows the following long error message when I open a file with a dot-ini (.ini) file extension:
>
> Error detected while processing /usr/share/vim/vimrc[25]../usr/share/vim/vim90/syntax/syntax.vim[44]..BufRead Autocommands for "*~"..BufRead Autocommands for "*.ini"..FileType Autocommands for "*"..Syntax Autocommands for "*"..function
> <SNR>3_SynSet[25]..script /usr/share/vim/vim90/syntax/dosini.vim: line 28: E10: \ should be followed by /, ? or &
>
> Following that "\" on line 28 with any one of "/", "?" or "&" resulted in an even longer error message.

Please try the following patch:

diff --git a/runtime/syntax/dosini.vim b/runtime/syntax/dosini.vim
index 751a12f4b..42e9b7fd6 100644
--- a/runtime/syntax/dosini.vim
+++ b/runtime/syntax/dosini.vim
@@ -14,6 +14,9 @@ if exists("b:current_syntax")
finish
endif

+let s:cpo_save = &cpo
+set cpo&vim
+
" shut case off
syn case ignore

@@ -39,4 +42,7 @@ hi def link dosiniValue String

let b:current_syntax = "dosini"

+let &cpo = s:cpo_save
+unlet s:cpo_save
+
" vim: sts=2 sw=2 et


Best,
Christian
--
A stitch in time saves nine.

Melvin Q. Watchpocket

не прочитано,
20 авг. 2023 г., 12:23:1120.08.2023
– vim_use
--> patch --dry-run -ruN NEW-dosini.vim < the-patch
checking file NEW-dosini.vim
patch: **** malformed patch at line 6: finish

I'm likely not applying the patch correctly.  I've never applied a patch before.  What am I doing wrong?

Christian Brabandt

не прочитано,
20 авг. 2023 г., 12:31:2520.08.2023
– vim...@googlegroups.com

On So, 20 Aug 2023, Melvin Q. Watchpocket wrote:

> --> patch --dry-run -ruN NEW-dosini.vim < the-patch
> checking file NEW-dosini.vim
> patch: **** malformed patch at line 6: finish
>
> I'm likely not applying the patch correctly.  I've never applied a patch
> before.  What am I doing wrong?

You are likely running vim in compatible mode. Try the following syntax
file instead:

,----
| " Vim syntax file
| " Language: Configuration File (ini file) for MSDOS/MS Windows
| " Version: 2.3
| " Original Author: Sean M. McKee <mc...@misslink.net>
| " Previous Maintainer: Nima Talebi <ni...@it.net.au>
| " Current Maintainer: Hong Xu <ho...@topbug.net>
| " Homepage: http://www.vim.org/scripts/script.php?script_id=3747
| " Repository: https://github.com/xuhdev/syntax-dosini.vim
| " Last Change: 2023 Aug 20
|
|
| " quit when a syntax file was already loaded
| if exists("b:current_syntax")
| finish
| endif
|
| " using of line-continuation requires cpo&vim
| let s:cpo_save = &cpo
| set cpo&vim
|
| " shut case off
| syn case ignore
|
| syn match dosiniLabel "^.\{-}\ze\s*=" nextgroup=dosiniNumber,dosiniValue
| syn match dosiniValue "=\zs.*"
| syn match dosiniNumber "=\zs\s*\d\+\s*$"
| syn match dosiniNumber "=\zs\s*\d*\.\d\+\s*$"
| syn match dosiniNumber "=\zs\s*\d\+e[+-]\=\d\+\s*$"
| syn region dosiniHeader start="^\s*\[" end="\]"
| syn match dosiniComment "^[#;].*$"
| syn region dosiniSection start="\s*\[.*\]" end="\ze\s*\[.*\]" fold
| \ contains=dosiniLabel,dosiniValue,dosiniNumber,dosiniHeader,dosiniComment
|
| " Define the default highlighting.
| " Only when an item doesn't have highlighting yet
|
| hi def link dosiniNumber Number
| hi def link dosiniHeader Special
| hi def link dosiniComment Comment
| hi def link dosiniLabel Type
| hi def link dosiniValue String
|
|
| let b:current_syntax = "dosini"
|
| let &cpo = s:cpo_save
| unlet s:cpo_save
|
| " vim: sts=2 sw=2 et
`----

Filed at https://github.com/xuhdev/syntax-dosini.vim/pull/6

Once this is approved and you confirm it works, I guess we can
merge it into the runtime files.



Best,
Christian
--
Harris's Lament:
All the good ones are taken.

Melvin Q. Watchpocket

не прочитано,
20 авг. 2023 г., 13:18:4320.08.2023
– vim_use
OK!  This works! 
I've replaced the old dosini.vim file with yours posted above. 

Using this file now as my /usr/share/vim/vim90/syntax/dosini.vim file, I can open a .ini file WITHOUT getting any error messages.

Thank you, Christian!  

One question: should I be seeing some syntax coloring in a .ini file like the one I've opened in Vim?  Here is the file, which appears in "black & white": 

  1 127.0.0.53             localhost                                                                                                                 2 4.2.2.2                   b.resolvers.level3.net
  3 4.2.2.4                   d.resolvers.level3.net
  4 4.2.2.6                   f.resolvers.level3.net
  5 64.69.98.35           spr-resolv3-sun.onecommunications.net
  6 64.80.255.251       ··· no official Internet DNS name ···
  7 64.215.98.148       dns1.lon.gblx.net
  8 66.6.65.5               ··· no official Internet DNS name ···
  9 66.28.0.45             res1.dns.cogentco.com
 10 66.92.159.2          dns.wdc1.speakeasy.net
 11 66.109.229.4        dns3.dejazzd.com
 12 66.153.50.66        dns1-nyc.paetec.net
 13 68.237.161.12      nsnyny01.verizon.net
 14 74.82.42.42          ordns.he.net
 15 129.250.35.250    x.ns.gin.ntt.net
 16 129.250.35.251    y.ns.gin.ntt.net
 17 151.197.0.37        world4.bellatlantic.net
 18 151.198.0.38        nsnwrk.bellatlantic.net
 19 151.198.0.39        home5.bellatlantic.net
 20 151.201.0.38        nspitt.bellatlantic.net

Christian Brabandt

не прочитано,
20 авг. 2023 г., 13:40:3220.08.2023
– vim...@googlegroups.com

On So, 20 Aug 2023, Melvin Q. Watchpocket wrote:

> OK!  This works! 
> I've replaced the old dosini.vim file with yours posted above. 

Great to hear.

>
> Using this file now as my /usr/share/vim/vim90/syntax/dosini.vim file, I can open a .ini file WITHOUT getting any error messages.
>
> Thank you, Christian!  
>
> One question: should I be seeing some syntax coloring in a .ini file like the one I've opened in Vim?  Here is the file, which appears in "black & white": 
>
>   1 127.0.0.53             localhost                                                                                                                 2 4.2.2.2                   b.resolvers.level3.net
>   3 4.2.2.4                   d.resolvers.level3.net
>   4 4.2.2.6                   f.resolvers.level3.net
>   5 64.69.98.35           spr-resolv3-sun.onecommunications.net
>   6 64.80.255.251       ··· no official Internet DNS name ···
>   7 64.215.98.148       dns1.lon.gblx.net
>   8 66.6.65.5               ··· no official Internet DNS name ···
>   9 66.28.0.45             res1.dns.cogentco.com
>  10 66.92.159.2          dns.wdc1.speakeasy.net
>  11 66.109.229.4        dns3.dejazzd.com
>  12 66.153.50.66        dns1-nyc.paetec.net
>  13 68.237.161.12      nsnyny01.verizon.net
>  14 74.82.42.42          ordns.he.net
>  15 129.250.35.250    x.ns.gin.ntt.net
>  16 129.250.35.251    y.ns.gin.ntt.net
>  17 151.197.0.37        world4.bellatlantic.net
>  18 151.198.0.38        nsnwrk.bellatlantic.net
>  19 151.198.0.39        home5.bellatlantic.net
>  20 151.201.0.38        nspitt.bellatlantic.net

this does not seem to be a typical ini file. Not sure why you are using
the .ini file extension.

Best,
Christian
--
You will be winged by an anti-aircraft battery.

Melvin Q. Watchpocket

не прочитано,
20 авг. 2023 г., 13:56:2620.08.2023
– vim_use
I'm runing Steve Gibson's DNSBench program under wine.
https://www.grc.com/dns/benchmark.htm

It automatically creates a custom list of nearby DNS servers as a .ini file and puts it in the same directory as the program.
 
Before this, I probably have never before opened a .ini file in Vim.

Enan Ajmain

не прочитано,
20 авг. 2023 г., 14:42:0120.08.2023
– Melvin Q. Watchpocket, vim...@googlegroups.com
On Sun, 20 Aug 2023 10:56:26 -0700 (PDT)
"Melvin Q. Watchpocket" <watch...@gmail.com> wrote:
> On Sunday, August 20, 2023 at 1:40:32 PM UTC-4 Christian Brabandt wrote:
> [...]
> > this does not seem to be a typical ini file. Not sure why you are using
> > the .ini file extension.
>
> I'm runing Steve Gibson's DNSBench program under wine.
> https://www.grc.com/dns/benchmark.htm
>
> It automatically creates a custom list of nearby DNS servers *as a .ini
> file* and puts it in the same directory as the program.

ini files _should_ look similar to toml files. But I have seen many
Windows software use ini files to store user configuration, without
adhering to general ini format. I myself have done it (if only because
I have seen others do it). Don't know what the history of this misuse
is.

> Before this, I probably have never before opened a .ini file in Vim.

Look at Windows Terminal colortool schemes and see if Vim renders it
with proper colors:
https://github.com/microsoft/terminal/blob/d28b6bf1f2c5a0078e85fe68b3e7ca4c167c4223/src/tools/ColorTool/schemes/campbell.ini

--
Enan

Melvin Q. Watchpocket

не прочитано,
20 авг. 2023 г., 14:51:2320.08.2023
– vim_use
All the color names, to the left of the equal signs and numbers, are green, everything in brackets is orange. clearly not the proper colors.  Shouldn't the dosini.vim file have fixed that?

Enan Ajmain

не прочитано,
20 авг. 2023 г., 15:43:5620.08.2023
– vim...@googlegroups.com
On Sun, 20 Aug 2023 11:51:23 -0700 (PDT)
"Melvin Q. Watchpocket" <watch...@gmail.com> wrote:
> On Sunday, August 20, 2023 at 2:42:01 PM UTC-4 Enan Ajmain wrote:
> > Look at Windows Terminal colortool schemes and see if Vim renders it
> > with proper colors:
> > https://github.com/microsoft/terminal/blob/d28b6bf1f2c5a0078e85fe68b3e7ca4c167c4223/src/tools/ColorTool/schemes/campbell.ini
>
> All the color names, to the left of the equal signs and numbers, are green,
> everything in brackets is orange. clearly not the proper colors.

How did you come to that conclusion? AFAI see, that seems correct. The
syntax item to the left of equal sign is dosiniLabel, to the right of
equal sign is dosiniValue, and in brackets is dosiniHeader. Your color
scheme determines what the color is for each of these syntax items.

--
Enan

> Shouldn't the dosini.vim file have fixed that?

Melvin Q. Watchpocket

не прочитано,
20 авг. 2023 г., 16:19:0320.08.2023
– vim_use
I was just assuming that, for example, the string"DARK_BLUE" in the line 
"DARK_BLUE = 0,55,218" was supposed to actually be dark blue, and the same for the other color-names in the file.

I'm actually  glad to to hear that that notion wrong.  I'm not using a standard colorscheme, I've set all (or most) of my color-groups individually in my .vimrc, though I'm still working on my whole color setup..
Ответить всем
Отправить сообщение автору
Переслать
0 новых сообщений