VIM

Installation & Usage

Installation

Installing the latest version of vim:

sudo add-apt-repository ppa:jonathonf/vim

sudo apt update

sudo apt install vim

Verify if vim has been installed, it should show version 8.2

vim --version

Usage

Vim literally has every command you can think of when it comes to editing, which is why developers love it so much. You can start with basic commands for navigating, inserting, deleting and searching, then look for more advanced stuff that is suitable for your needs to build your own set of working commands. Some basic interactive tutorial: 

https://www.openvim.com/tutorial.html

http://www.vimgenius.com/lessons/vim-intro/levels/level-4

https://www.youtube.com/watch?v=5r6yzFEXajQ&ab_channel=NickNisi

Customize the theme with vimrc

After installing vim, you will write text with the default setup, which is the most boring screen you ever want to look at. After playing with the commands and have a bit of confidence to use vim, it's time to customize the look so that you have a beautiful working screen to show off with your friends, and trust me, it can also boost your productivity significantly, and by significantly I mean very very significantly!

Basically, you can change all the settings on the fly while editing a text file, but after you close the file, all the settings will be gone, so you definitely don't want to spend 15mins every time you open a new file to set up a nice window before you actually note down something. The solution is very straighforward: throwing all the set up commands into a file called vimrc. There are many tutorials out there where people showing their vimrc files and you can just copy and paste to use for your own. However, it would be nice to actually understand what the heck is going on inside that file so you can customize it the way you want. For that purpose, I recommend: A Good Vimrc, or the official documentation.

Taking Lecture Notes with VIM + LATEX

(Operation: Ubuntu 16.04)

Installing the full version of TeX Live, which is quite a big download (~3.6Gb and a couple of minutes for installation). However, as it contains every Latex packages, you don't need to install new packages every time you want to use them.  

sudo apt-get update

sudo apt-get install texlive-full

Install necessary packages

sudo apt-get install libsynctex-dev

sudo apt install libgtk-3-dev

Install Zathura pdf viewer. Create a new text file, e.g, install-zathura, and paste all commands below into the file:

#!/bin/bash

GIRARA_VERSION=0.2.6

ZATHURA_VERSION=0.3.6


sudo apt-get remove libgirara-dev

# need for zathura compilation

sudo apt-get install libmagic-dev


rm -rf /tmp/girara /tmp/zathura


cd /tmp && git clone https://git.pwmt.org/pwmt/girara.git && cd girara && git checkout $GIRARA_VERSION && make && sudo make install

cd /tmp && git clone https://git.pwmt.org/pwmt/zathura.git && cd zathura && git checkout $ZATHURA_VERSION && make WITH_SYNCTEX=1 && sudo make install

Make the text file executable using chmod command and then execute the file to automatically install zathura:

chmod +x install-zathura

./install-zathura

Install a plugin manager, in this case we use vim-plug, by running the following command (download plug.vim and put it into the ~/.vim/autoload folder)

curl -fLo ~/.vim/autoload/plug.vim --create-dirs  https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

Install vimtex by adding the following lines somewhere in vimrc file:

call plug#begin('~/.vim/plugged')

Plug 'lervag/vimtex'

call plug#end()

Later if you want to change the color setting using a different plugin, simply add Plug '<plugin-name>' in between the two call commands