I want to map F2 to compiling tex files, and F3 for viewing tex files.
This is what I put in my .vimrc
:
if &filetype == "tex"
nnoremap <F2> :Latexmk<cr>
inoremap <F2> <Esc>:Latexmk<cr>a
nnoremap <F3> :LatexView<cr>
inoremap <F3> <Esc>:LatexView<cr>a
endif
These Latex*
commands are from LaTeX-Box plugin. I can execute them manually without any problems. Typing :echo &filetype
in any *.tex file returns tex
.