I open my Vim session with multiple tabpages simultaneously. Some of my tabpages are .txt files, some are not.
I have created, in my .vimrc, a command named Tran which refers to syntax.vim where are defined a few specific syntax highlightings for my .txt files.
:command Tran :source syntax.vim
My problems/questions :
1) When I open my Vim session, I would like to have all my .txt files highlighted thanks to the Tran command. I tried (in my .vimrc) :
:command Tran :source syntax.vim
autocmd filetype txt :Tran
… and failed.
2) For the time being, when I switch to a .txt tabpage, I immediately type the following command :
:Tran
and it works. But if I go to another tabpage, and later come back to my .txt tabpage (during the same session), all the highlighting has disappeared.
I suppose those 2 problems can be solved in 1 simple way. But which one ?
Thanks in advance.