

LaTeX + Vim + MacOS.
source link: https://tpaschalis.github.io/macos-latex-vim/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

LaTeX + Vim + MacOS.
I absolutely love LaTeX; and since I’ve started using a Mac for work, I wanted a setup for writing with it.
I settled with installing MacTex, a free re-distribution of TeX Live which also includes Ghostcript and some mac-specific GUI applications. (Don’t judge for not building from source ^^)
However, the goal was to keep using Vim; there’s a bunch of plugins for that like vimtex or vim-latex, but a) I’m not going to learn or use all of their features, since I’m not writing on a day-to-day basis, and b) I didn’t want to slow down my Vim for no reason. I will concede that vimtex looks very cool though, and I’ll be checking it out in the near future.
So, thinking the Unix way, I thought what’s my LaTeX workflow? I keep editor and document side-by-side and
a) Write
b) Compile
c) See PDF change
d) GOTO a
This is easily doable with Vim commands and a nice PDF viewer which will support auto-reloading (eg. evince).
Preview, the default PDF viewer in MacOS, does support auto-reloading;
Version 1
:! pdflatex %
The problem is that Preview will auto-reload the pdf only when you switch focus to the it, which had me alt-tab twice for every change.
This is easily solved with the following command, where MacOS’ open -a
will open or focus the instance an application.
Version 2
:! pdflatex % && open -a Preview && open -a iTerm
This way we get the compilation output, but have to press an extra enter key to return. We can solve this by using Vim’s silent option, which will suppress the message box that pops up and reports the result. The problem is that when you run something silently, if it outputs, you’ll have to either use ^L or redraw!, as your screen might be messed up.
So, let’s wrap this up in a proper way; introduce a new command, Silent, which will silently call your arguments and then re-draw the screen; then map this to F5. (Thanks to this vim wiki article.)
Version 3
" Custom Silent command that will call redraw
command! -nargs=+ Silent
\ execute 'silent ! <args>'
\ | redraw!
:map <F5> :Silent pdflatex % && open -a Preview && open -a iTerm
And voila, adding these to .vimrc covered 90% of my day-to-day workflow. How I wish all software was simple to use and modify this way!
Recommend
-
145
gerw's latex-suite This repo contains an improved version of latex-suite (http://sourceforge.net/projects/vim-latex/) Undocumented Improvements
-
261
vim-latex aka latex-suite This vim plugin provides a rich tool of features for editing latex files. For further descriptions, we refer to the website. There is also a
-
64
ipynb-tex.sty ipynb-tex is a simple style sheet which allows you to extract tagged cells out of a Jupyter notebook and include them in a TeX document
-
24
Tmux and Vim: Copy and Paste on macOS Sierra Posted: 2017-03-22 - Last updated: 2019-06-05 Tagged
-
5
Files Permalink Latest commit message Commit time
-
5
kindaVimVim for the whole macOS
-
11
Vim + LaTeX snippets setup How I'm able to take notes in mathematics lectures using LaTeX and Vim Vim configuration Copy tex.snippets to
-
4
因为 VIM 里存在多个 mode ,使得编辑中文变得很痛苦。在 Insert mode 下需要使用中文输入法, 但当切换回 Normal 模式后又需要使用英文输入法。在 VIM 里切换 mode 是很经常的事儿, 在需要输入中文时,每次的 mode 切换都需要进行输入法的切换,很麻烦。 通过...
-
14
Real-time LaTeX Using (Neo)Vim This tutorial series will help you set up the Vim or Neovim text editors for efficiently writing LaTeX documents. Here is an example of what I have in mind:
-
6
NOTE: scribble latex requirement on macOSNOTE: scribble latex requirement on macOSEmail: [email protected]:
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK