Can you get Vim to behave like TeXworks or vice versa?

Disclaimer I use nvi not VIM! It is trivial to force VIM to open appropriate PDF file. Put something like this in your .exrc file (or whatever VIM configuration file is .vimrc)

map ^X :w^M:!make dvi-view

That would allow you to use key binding Ctrl+X to tex your file and automatically open dvi viewer with the dvi file after tex-ing. Note I am using in this example Xdvi because I know for the fact that direct and inverse search work with Xdvi. I do not use direct and inverse search since nvi doesn't have server mode so when you do inverse search Xdvi opens new instance of nvi with the file you are editing. However VIM supports server mode and inverse search works fine. You will also need to edit your Makefile as

FILE = filename

LATEX = latex
XDVI = xdvi
DVI = ${FILE}.dvi

dvi : 
        ${LATEX} ${FILE}.tex
        ${LATEX} ${FILE}.tex
dvi-view : dvi
        ${XDVI} ${DVI}

Granted you have srctex loaded into the document you are editing you will be able to tex your file, open Xdvi automatically and have direct and inverse search. Now toggling VIM instance and Xdvi is also trivial but the solution depends on your Window manager. I could tell you how to do in my window manager of choice (Calm Window Manager on OpenBSD) but that one only available as an unofficial port on FreeBSD (note CWM of OpenBSD is not really portable and meant to be used outside of OpenBSD).

To make TeXworks acting as a VIM is asking to have the vi keybindings at very least. I am not sure if TeXworks has those but they can definitely be hard coded. Now that is not a five minute job.


I think the short answer is no but maybe someone has a set up for this.

What you are asking for is a GUI which isn't a GUI so I don't think that is possible. I have used both Vim and Emacs (Emacs now currently) and do all my editing in the terminal.

Here is my set up which may add what you need:

I use a slightly see through terminal that drops down from the top with the pdf underneath it. This way I can see through it or just hit F12 and it auto hides until I want it back. Then if I want to update the pdf, I just compile the file again and the updates appear on the pdf immediately. If you use synctex, you can then click on the pdf and have it jump to that spot in your terminal window for correcting or editing. In my view, this is the best you may get since you aren't using the GUI.


I use Vim-Latex suite on window and Sumatra pdf viewer that doesn't lock files so I can compile with \ll and open pdf with \lv.

Tags:

Vim

Texworks