On mar., 2019-05-14 at 13:17 -0700, Gary Johnson wrote: > On 2019-05-14, Mathieu Roux wrote: > > Hi everybody, > > > > I have understood that for vim's help, the syntax file used is > > help.vim > > (in the directory /usr/share/vim/vim80/syntax). > > > > I can use it with: > > :so help.vim > > (if it is in the same directory of the file i open) > > > > But i still don't understand why, when i open one file in > > /usr/share/vim/vim80/doc > > EVEN A NEW FILE > > it automatically uses the syntax of help.vim, whereas i do > > nothing... > > Maybe someone can explain me. > > This is explained in > > :help syntax > > In short, when you enable syntax highlighting by executing > > :syntax enable > > in your vimrc, you source $VIMRUNTIME/filetype.vim, which contains: > > " Vim help file > au BufNewFile,BufRead $VIMRUNTIME/doc/*.txt setf help > > Whenever you open a file matching that pattern, Vim sets the > 'filetype' to "help" and (with the aid of a few other scripts) > sources $VIMRUNTIME/syntax/help.vim. > > > You wrote above that you opened a new file in > /usr/share/vim/vim80/doc. Do not create new syntax files in that > directory. Do not create new files or modify any files anywhere > under /usr/share/vim/vim80. Those directories are for files > included with the Vim package. Any files in those directories may > be overwritten by an update to the Vim package and will not be > accessed when you upgrade to a version later than 8.0. > > Instead, put any files you create for you own use under ~/.vim or > any that you want to share with other users under > /usr/share/vim/vimfiles. Then they will be safe from any changes to > your distribution's Vim package and will continue to be used even if > you build Vim yourself. > > Regards, > Gary > > --
I think i don't understand... In fact, i don't want to modify /usr/share/vim/vim80/. i just tried, and i see that a new file automatically uses help.vim syntax. In my ~/.vimrc, i don't see where i source filetype.vim. Should i have a lign so filetype.vim? /usr/share/vim/vim80/ has a subdirectory called syntax, but it contains many .vim files with many syntaxes. I don't understand why file in doc directory uses help.vim. As for me, in my directory, say ~/mathieu, i want that every .txt file that i create uses help.vim syntax. I copied help.vim file in ~/mathieu and in ~/mathieu/syntax. I tried :syntax on But it does not work. The only solution for me is to do :so help.vim But when i close my .txt file and open it again, i have to do :so help.vim again. I am sorry, i am quite a beginner in vim, but i really don't understand your explanation. Best regards, Mathieu -- -- You received this message from the "vim_use" 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_use" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/7c77f313a12b8d015cf064b50ce3b0adc8e96151.camel%40gmail.com. For more options, visit https://groups.google.com/d/optout.
