Le 19 août 2010 à 08:11, John Beckett a écrit : > Etienne Benoît Roesch wrote: >> Initially, I put it in ~/.vim/ftplugin/ as instructed, but it >> did not load (did not show up with :scriptnames). Then I >> moved it to ~/.vim/plugin/ instead. The command :scriptnames >> does show ~/.vim/plugin/csv.vim now, but loading a .csv file >> does not trigger the plugin, nor does creating a file from >> scratch with fields between commas and :set ft=csv > > As indicated in the "Usage" section at: > http://vim.wikia.com/wiki/Working_with_CSV_files > > you have to put csv.vim in the *ftplugin* directory (not > plugin), *and* you have to put a .csv rule in filetype.vim. > > I suggest you move csv.vim from plugin to ftplugin, and double > check the .csv rule, then close Vim and start it again. > > To be sure you have the .csv rule, enter the following in Vim: > :au BufNewFile *.csv > :au BufRead *.csv > > They should both show something like: > filetypedetect BufRead > *.csv setf csv > > John
Hi John, I know how to read instructions, thank you :) but I must have failed to mention that I did add a .csv rule in filetype.vim. I have been using vim for years now, and adding that rule is the first thing I did! -- although I have to admit I had to create filetype.vim, as I was usually handling autocmds in .vimrc. Those bad old habits! Both :au BufNewFile *.csv and :au BufRead *.csv do show: *csv set csv When I said "Initially, I put it in ~/.vim/ftplugin/ as instructed, but it did not load (did not show up with :scriptnames)" .. I should have added: - Opening test.csv (content below) did not activate column hightlightning *and* using H J K L 0 $ produced some weird behaviour (H goes up the file, and J does nothing...) *and* the :Sort command yields an error E492: Not an editor command: Sort this,is,a dummy,file,foo - Nor did typing the content of test.csv in a buffer, and entering :set ft=csv (I can verify the ft update in my statusline) - or replacing commas with tabs Hence my initial post. From your first response, I got to try :scriptnames, which I didn't know before and showed no script in /ftplugin whatsoever. As the plugin readcsv.vim I was previously using resided in /plugin and not /ftplugin, I decided to try putting csv.vim in /plugin. It did show up in :scriptnames, but still did not produce the expected behaviour. >From reading this list of symptoms, I can only conclude that MacVim does not >check into /ftplugin. How can I solve this? Again, John, thank you very much for your help! I am *really* looking forward to using your plugin :) Best regards, Etienne -- You received this message from the "vim_mac" 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
