I use file externalization with tikz, so I usually put the tikzpicture environments each in a separate file with extension .tikz. When I open such files with Vim, the syntax is not highlighted, which makes difficult for me to rapidly edit the file. The basic question is: How can I make Vim use for these files the same syntax coloring used for .tex files? But that question carries another one: How can I make Vim treat these as it does with tex files (so that completions with <F5> can be used)?


Add the following lines to the ~/.vimrc file (or create it if doesn't exist):

syntax on
filetype on
au BufNewFile,BufRead *.tikz set filetype=tex
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.