How to set up the Latex with Vim

1. Install Tex-live

1.1 for debian or ubuntu

Install the perl-tk for the installation with gui

Downloads the iso file for the tex-live. And mount the iso file

fellow the steps showed in the screen. After the installation, return to home folder, and unmount the iso file.

change the environment setting

paste the fellowing lines to the end of the bashrc

resource the bashrc

Making sure that the latex is useful in the ternimal

find the lines below

change the 3rd lines to

setting the fonts for the whole system.

setting up the update repository for the tlmgr

1.2 basic commands

update the components of texlive

update the tlmgr itself with –self

1.3 Install vim

2. Install and configure vim-plug

2.1 Installation of vim-plug

2.2 Configuration for the vim-plug

Paste the fellowing to the vimrc

Between the 2 lines input the plug which you need. Starts with the
Plug ‘the plug which you need’. Because we need the vimtex. According to the https://github.com/lervag/vimtex

So, in the text means

Operate the actions in the vim. Firstly log into the vim

source the change for the vim from vimrc

check the status of the vim

install the plug in the vimrc

2.2.1 if you want to update the plug

2.2.2 if you want to upgrade the vim-plug

2.2.3 if you want to roll-back to the previous editions of the plug, due to the bug of the new editions of plug

2.2.4 if you want to delete the plug.

Firstly delete the line in the vimrc

log in the vim

source the vimrc

uninstall the plug

3. Test the examples for the latex

create the folder for the files to be test

create the latex file for testing

paste the lines to the file

save the file

in the normal model, compile the file (the command, you can not see it in the screen, just input the command from the keyboard)

in the normal model, view the pdf created from the test_latex.tex file (the command, you can not see it in the screen, just input the command from the keyboard)

4. Installation for the UltiSnips

“UltiSnips is the ultimate solution for snippets in Vim. It has tons of features and is very fast”. But the “UltiSnips” doesn’t provide snips. So we must use the “vim-snippets” providing the snips.

There are 2 facts are import

  1. This plugin only works if ‘compatible’ is not set.
  2. only available when |+python| or |+python3| have been enabled at compile time. “+python” means python 2, “+python3 ” means python 3.

For editing the vimrc

between the “call plug#begin(‘~/.vim/plugged’)” and “call plug#end()” add the 2 lines

create a folder for the snip files

links the folder to ultisnips

source the vimrc

4.1 examples for the UltiSnips

create the snip for the xxxxx.cpp files. when you press the “std” + [TAB]. You can get “use namespace std”.

4.2 details and more examples for the UltiSnips

https://github.com/SirVer/ultisnips/blob/master/doc/UltiSnips.txt
https://vimzijun.net/2016/10/30/ultisnip/
https://zhuanlan.zhihu.com/p/60049290
https://github.com/SirVer/ultisnips

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.