chrisbra/csv.vim

"No filetype support" error in VIM 9 on Mac0S 12.16.1 (Monterey)

Closed this issue · 5 comments

I assumed this was setup/config problem rather than a bug, but maybe a bug.

I installed the chrisbra cvs.vim plugin (csv-0.31.vmb) on MacOS 12.16.1 running VIM - Vi IMproved 9.0.

When I open any .csv file I get this error message twice, and of course the plugin doesn't work correctly:

CSV Syntax:No filetype support, only simple highlighting using, as delimiter! See :h csv-installation
CSV Syntax:No filetype support, only simple highlighting using, as delimiter! See :h csv-installation
Press ENTER or type command to continue

Then after typing ENTER I get more errors:

CSV Syntax:Invalid column pattern, using default pattern \%([^,]*,\|$\)
CSV: No delimiter found. See :h csv-delimiter to set it manually!
CSV: No delimiter found. See :h csv-delimiter to set it manually!
CSV: No delimiter found. See :h csv-delimiter to set it manually!

Troubleshooting:
Google search (and stack overflow) says the first error is caused by not having :filetype plugin on in my ~/.vimrc. But I DO have that set. I did not see any other causes for this error.

Eventually I installed the same package on a RedHat Linux host which has VIM - Vi IMproved 7.4. The plug in works there, on identical .csv file that failed on MacOS. So I conclude the .csv file is not the problem.

I even replaced the .vimrc and .vim/ file & directory on my Mac with the ones from Linux, so that I am comparing identical .csv file and identical .vim* configurations. I still get the errors on my Mac.

Maybe there is a problem with VIM 9.0? I searched the cvs.vim Issues and found someone using VIM 9 and reporting a minor bug, but the plugin was working for them, so seems like it should work for me.

Is there a problem with csv.vim and VIM 9? Or with MacOS?

I've also gone so far as to mimic the calculation that the ftplugin/csv.vim does when it reports the error, but my hand commands give the correct result.

Code from the pulugin:

" First:
" Check for filetype plugin. This syntax script relies on the filetype
" plugin, else, it won't work properly.
redir => s:a |sil filetype | redir end
let s:a=split(s:a, "\n")[0]
if match(s:a, '\cplugin:off') > 0
    call <sid>Warning("No filetype support, only simple highlighting using"
    \ . s:del_def . " as delimiter! See :h csv-installation")
endif

And my running the commands by hand:

:redir => scott |sil filetype | redir end

:echoerr scott
^@filetype detection:ON  plugin:ON  indent:OFF

:let scott1 = split(scott, "\n")[0]

:echoerr scott1
filetype detection:ON  plugin:ON  indent:OFF

:echoerr match(scott1, '\cplugin:off')
-1

:echoerr match(scott1, 'plugin:ON')
23

:echoerr match(scott1, '\cplugin:on')
23


So, -1 means no match, and \c means case-insensitive
And the test
if match(s:a, '\cplugin:off') > 0
should return -1, because there is no match

Lastly, full ":version" of the two VIM programs I'm using.

On MacOS:

NewMacBook Dec 12 6:41pm ~ 107: vim --version
VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Sep 26 2022 01:50:42)
macOS version - arm64
Included patches: 1-270
Compiled by root@apple.com
Normal 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/dyn +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 -DMACOS_X_UNIX -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -L/usr/local/lib -o vim -lm -lncurses -liconv -framework Cocoa

On Linux:

ipm0.MUB Dec 12 8:22pm ~/Problems 106: vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jul 9 2019 02:33:15)
Included patches: 1-207, 209-629
Modified by bugzilla@redhat.com
Compiled by bugzilla@redhat.com
Huge version without 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/dyn +viminfo
+cscope +lispindent -python3 +vreplace
+cursorbind +listcmds +quickfix +wildignore
+cursorshape +localmap +reltime +wildmenu
+dialog_con -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
+eval +mouse_dec +startuptime -xterm_clipboard
+ex_extra +mouse_gpm +statusline -xterm_save
+extra_search -mouse_jsbterm -sun_workshop -xpm

can you please mention, how you installed it?

Hello,
same error, with Vim 9 on Windows 10.
I installed it with Pathogen.

Same with vim 8.2.5117 under MSYS2.

CSV Syntax:No filetype support, only simple highlighting using, as delimiter! See :h csv-installation
CSV Syntax:No filetype support, only simple highlighting using, as delimiter! See :h csv-installation
Premi INVIO o un comando per proseguire

Then

CSV Syntax:Invalid column pattern, using default pattern \%([^,]*,\|$\)
CSV Syntax:Or ftplugin hasn't been sourced before the syntax script

but next to this the file is displayed correctly, with colors, vartabstop and all the stuffs.

do you have the :syn on before the ´:filetype` command in your vimrc? See also the plugins help: https://github.com/chrisbra/csv.vim/blob/master/doc/ft-csv.txt#L1741-L1765

You are right. I fixed the statement's order and now it works fine!
I'm really sorry. It's my fault. I read the doc, but reading the installation seciion I was sure I did everything.
Sometimes good and exhaustive documentaion could be to much to read. But don't get me wrong, too much docs is better than too little. :-)

no problem. Everything fine, no reason to apologize :)

Glad to hear it is solved.