vi customization

Ubuntu and Debian use a default /usr/share/vim/vim81/defaults.vim  to set the defaults.

Strangely, the setting will be destroyed when we create a file ~/.vimrc. This is very unfortunately very confusing.

The default autoindent when editing a LaTeX file is quite annoying, e.g. { of  \frac{ is hit, etc. 

Even after reading some posts in stackexchange  I tweaked  :set indent  but that did not work).

I find it easier to have a full control of the behaviors of vi by editing /etc/vim/vimrc.

These are the changes I made in /etc/vim/vimrc:

(1) To avoid loading the weird /usr/share/vim/vim81/defaults.vim we shall set 

let g:skip_defaults_vim = 1

(2) Turn syntax on:

if has("syntax")

  syntax on

endif

(3) To remember the position of the cursor:

au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif

(4) To have a normal behavior of the mouse:

set mouse=r

Note: This link tells us how to find the cryptic variable VIMRUNTIME!

If we really want to print this value, then launch vi, then :echo $VIMRUNTIME shows the cryptic variable.