Vim Howtos and Tips
Posted on In Linux, ProgrammingVim is a fast and handy editor on *nix systems. Like Emacs, Vim has a steep learning curve as you get constantly get new things. However, the effort deserves it as you efficiency is highly improved. Here, I summarize the tips and howtos I learned using Vim. Some previous posts on vim are tagged with https://www.systutorials.com/tag/vim/.
Table of Contents
My .vimrc and .vim file
My .vimrc and .vim files:
https://github.com/zma/vim-config
How to use these files
cd /path/to/vim-config/
git submodule update --init
If you never configured Vim:
cd
ln -s /path/to/vim-config/.vimrc ./
ln -s /path/to/vim-config/.vim ./
If you ever configured your Vim, you may need to merge my configurations to yours.
Enjoy.
Previous posts tagged vim
Check the posts tagged vim: https://www.systutorials.com/tag/vim/.
Latex Writing in Vim with the Help of vim-latex
vim-latest is a great plugin for Vim to assisting editing of Latex files.
master file
Creating a file with the extension latexmain
to specify the master file which is used to find the references. For example, to specify the main.tex
is the master file, create the file main.tex.latexmain
.
List references to sections, figure and tables to insert
Press <F9>
after inputting \ref{
.
Use keys N and P to navigate the references.
List citations from the bibtex file to insert
Press <F9>
after inputting \cite{
.
Use keys N and P to navigate the citations. Use ‘/’ to start searching.
Added Latex Writing in Vim with the Help of vim-latex: http://www.fclose.com/5242/vim-howtos-and-tips/#latex-writing-in-vim-with-the-help-of-vim-latex
Also check the posts on FAQ tagged with vim: https://www.systutorials.com/qa/tag/vim
You can use `CTRL-O` and `CTRL-I` to jump to previous/next position jumped by `g` or `gg` or `G` or similar commands.
You can use `g;` and `g,`can jump to the previous/next changed places.
Filename/pathname autocomplete:
You can autocomplete filenames or pathnames in insert mode of vim by
`Ctrl-x` `Ctrl-f`
Find the current filetype in Vim:
:set filetype?
or, in short
:se ft?
or,
:echo &filetype
or, in short
:echo &ft
Set the character encoding for a file in vim:
set fileencodings=utf-8,latin1
It can contain a list of encodings. Vim will try the encodings from left to right till it find a workign one.