Latex in Vim

CptCharis

Well-Known Member
Credits
273
Hello everybody.

Do any of you have instruction to add Latex in Vim?

Thanks a lot & have a nice day.
 


CptCharis

Well-Known Member
Credits
273
Thanks @JasKinasis
I have read this article but I have some difficulties to follow it.


Step 2 of 4: Set a few things in .vimrc
The recommended settings for vim-latex in your .vimrc file are now only described in the vim-latex manual.

There is not any ~/.vimrc file in my home directory . Anyway I did the changes in my root file /.vim/vimrc

Step 3 of 4: Install the help files
To install the included latex-suite.txt and latexhelp.txt files as vim help files, start vim and do the following:
helptags ~/.vim/doc (for *nix users)
helptags ~/vimfiles/doc (for windows users)


What exactly they mean?
 

JasKinasis

Well-Known Member
Credits
1,193
Step 2 of 4:
==========
If you don't have a personal .vimrc - you could always create one.

Somewhere on your system, bundled with the documentation for vim - there will be an example .vimrc which has some sane defaults in it, which you can copy to your home folder and use as a base for your own .vimrc.

I think the example vimrc is somewhere like:
/usr/share/vim/vim80/vimrc_example.vim

But to find its exact location on your machine, just try something like:
Code:
locate vimrc_example.vim
There is also an example gvimrc file, for the gui version of vim called gvimrc_example.vim.

Once you have located it, copy it to your home directory and rename it .vimrc (or .gvimrc for the GUI version of vim). Then you can make your customisations to it.

However, if modifying roots .vimrc works for you - then by all means go with that!

Step 3 of 4:
=========

It looks like helptags is a script that should have been installed when you installed the rest of the vim-latex suite. It looks like it will convert a couple of text files and will add them to vims built-in documentation.
This will allow you to use vims :help command to access help on whatever tools are packaged with vim-latex.

You need to run it and pass it the path to store the generated vim documentation.
So it looks like you should run:
Code:
helptags ~/.vim/doc
If the above fails because you don't have a .vim/ or .vim/doc directory, you can make the directories manually:
Code:
mkdir -p ~/.vim/doc
Then try running the script again.

Or you could perhaps install the help documentation in the root .vim directory where you put your vimrc:
e.g. install the help to /.vim/doc
Which I imagine would require root permissions:
Code:
sudo helptags /.vim/doc
The above assumes you are using sudo in your arch installation. If not, I guess you would need to su to root before running the helptags script.

And again, if the script fails because the doc subdirectory doesn't exist in /.vim/, then use mkdir to make the subdirectory and try the helptags script again.

NOTE: I haven't looked at the installation instructions for vim-latex. I'm just going by what I can deduce from your post. It looks fairly straightforward.
 
Last edited:

CptCharis

Well-Known Member
Credits
273
@JasKinasis, It looks that could work but it returns a error

E319: Sorry, the command is not available in this version: filetype plugin on line 70:

and so on all lines that I add the recommended modifications, which is strange bcz when I did the same on roots .vimrc
I didn't have this error.

Anyway thank you Mate.
 

JasKinasis

Well-Known Member
Credits
1,193
Hmmm.... Not sure what to suggest there.
If I get a chance, I'll try to install the vim-latex suite myself and see what happens. Then I'll get back to you!
 

CptCharis

Well-Known Member
Credits
273
I use my Mint now not Arch

I found package for Latex in Mint repo but it took 2+ hours for download. I quit it of course and I'm trying to do manual.
 

CptCharis

Well-Known Member
Credits
273
@JasKinasis just one last thing
In my
Code:
/usr/shar/vim/vim80
there is not any
Code:
vimrc_example.vim
but there is a
Code:
debian.vim
and
Code:
locate vimrc_example.vim
is not return any result.

In
Code:
/usr/share/vim
there is a soft link named vimrc

I don't know if I can use this one.
 

JasKinasis

Well-Known Member
Credits
1,193
OK, well this is embarrassing.
I've finally fired up my laptop for the first time in a few weeks.
If you are using a Debian based distro, the vim-latex package is available from the repos. The package name is vim-latexsuite.

So you can install via apt:
Code:
sudo apt install vim-latexsuite
After installing the package, it will update vim's help.

You can enable the plugin for your user account using vim-addon-manager:
Code:
vim-addon-manager install latex-suite
If you prepend the above command with sudo, it will install the plugin system-wide - for all users.

Saves having to install manually!

Regarding the .vimrc problem - I think you might be right. debian.vim is probably the example .vimrc file for Debian based distros.
My instructions were based on my cygwin setup on my Windows PC at work. But I wasn't sure what the example vimrc was called in Debian or arch based distros. I think that's down to the package maintainers. Different packages probably have it set up slightly differently. I just assumed it would be similar - evidently I was wrong.
I haven't had to use the example .vimrc for donkeys years. I've got my own .vimrc with settings that I've collected over the years.

But once you've located the example .vimrc and copied it to your home directory - you should be able add the recommended .vimrc settings for vim-latexsuite
 

CptCharis

Well-Known Member
Credits
273
Thank you very much dear Sir,
@JasKinasis

I will try once again I will have internet access.
Anyway I really appreciate for your time.
 


Members online


Top