vim和latex环境搭建

安装软件

下载软件

安装

gvim安装自不必说。

http://vim-latex.sourceforge.net/index.php?subject=download&title=Download讲了安装步骤,拷贝如下:

Installation Instructions

Step 1 of 4: Download and extract the archives

Extract one of the archives above into your ~/vimfiles directory (if you are using windows) or ~/.vim directory (if you are using *nix).
If you are updating after a long time, it might be a good idea to remove the ~/vimfiles/ftplugin/latex-suite directory from previous installations before reinstalling.

NOTE: If you already have some latex ftplugin files, read the Advanced Installation Instructions to make sure you do not over-write any of your files.

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.

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) 

Step 4 of 4: Done!

Thats it! You are done! Now start editing a latex file in vim. Latex-Suite should start up automatically. You can do

:help latex-suite.txt

from within vim to get the online Latex-Suite reference.

注:1. win下面,.vimrc对应的就是_vimrc;2. 上述helptags命令后面可以用相对路径或全路径文件名,如:

:helptags d:/Vim/vimfiles/doc

上面第二步的网页内容拷贝在这里,方便取用:

Installation and recommended Settings

If you are reading this, it most probably means that you have already installed Latex-Suite and the help files. If this is not the case, follow the detailed instructions on Latex-Suite’s download page.

Make sure that you create a few necessary settings in your ~/.vimrc.

" REQUIRED. This makes vim invoke Latex-Suite when you open a tex file.
filetype plugin on

" IMPORTANT: win32 users will need to have 'shellslash' set so that latex
" can be called correctly.
set shellslash

" IMPORTANT: grep will sometimes skip displaying the file name if you
" search in a singe file. This will confuse Latex-Suite. Set your grep
" program to always generate a file-name.
set grepprg=grep\ -nH\ $*

" OPTIONAL: This enables automatic indentation as you type.
filetype indent on

" OPTIONAL: Starting with Vim 7, the filetype of empty .tex files defaults to
" 'plaintex' instead of 'tex', which results in vim-latex not being loaded.
" The following changes the default filetype back to 'tex':
let g:tex_flavor='latex'

In addition, the following settings could go in your ~/.vim/ftplugin/tex.vim file:

" this is mostly a matter of taste. but LaTeX looks good with just a bit
" of indentation.
set sw=2
" TIP: if you write your \label's as \label{fig:something}, then if you
" type in \ref{fig: and press <C-n> you will automatically cycle through
" all the figure labels. Very useful!
set iskeyword+=:

顺便可以看到,http://vim-latex.sourceforge.net/documentation/latex-suite/index.html是详细的vim-latex在线帮助。

vim文档

http://www.vim.org/docs.php提供了一些vim的文档。

latex的用上面helptags的方法来即可。

练习

按照latex-suite的Tutorial,gvim打开tex文件都闪退;只能用vim。还不清楚具体原因。另外,也没有看到latex-suite的菜单。

其他

vi常用命令

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
1. 安装vim 在Linux系统中,vim通常已经预装了。如果没有安装,可以使用以下命令安装: ``` sudo apt-get install vim ``` 2. 配置vimvim中,可以通过配置文件.vimrc来配置vim。可以使用以下命令创建.vimrc文件: ``` vim ~/.vimrc ``` 在.vimrc文件中添加以下内容: ``` syntax on set nu set tabstop=4 set shiftwidth=4 set expandtab set autoindent set cindent ``` 这些配置将会: - 打开语法高亮 - 显示行号 - 设置制表符宽度为4个空格 - 设置缩进宽度为4个空格 - 将制表符转换为空格 - 自动缩进 - 使用C语言缩进 3. 安装插件 vim有很多插件可以增强其功能。以下是一些常用的插件: - YouCompleteMe:自动补全插件 - NERDTree:文件浏览器插件 - Tagbar:显示代码结构的插件 - CtrlP:快速查找文件的插件 可以使用vim插件管理器Vundle来安装插件。首先,需要安装Vundle: ``` git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim ``` 然后,在.vimrc文件中添加以下内容: ``` set rtp+=~/.vim/bundle/Vundle.vim call vundle#begin() Plugin 'VundleVim/Vundle.vim' Plugin 'Valloric/YouCompleteMe' Plugin 'scrooloose/nerdtree' Plugin 'majutsu-no-ierukana/tagbar' Plugin 'kien/ctrlp.vim' call vundle#end() ``` 保存并退出.vimrc文件,然后在vim中执行以下命令安装插件: ``` :PluginInstall ``` 安装完成后,可以在.vimrc文件中配置插件。例如,以下是配置YouCompleteMe插件的示例: ``` let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py' let g:ycm_autoclose_preview_window_after_completion = 1 let g:ycm_key_invoke_completion = '<C-Space>' ``` 以上配置将会: - 设置YouCompleteMe的配置文件路径 - 自动关闭自动补全窗口 - 设置自动补全快捷键为Ctrl+Space 4. 使用vim进行C语言开发 在vim中,可以使用以下命令打开C语言文件: ``` vim example.c ``` 在C语言文件中,可以使用以下命令编译并运行程序: ``` :!gcc % -o example && ./example ``` 以上命令将会: - 使用gcc编译当前文件 - 将编译后的可执行文件命名为example - 运行example程序 可以使用以下命令保存并退出vim: ``` :wq ``` 以上是在Linux系统中搭建C语言开发环境的步骤。在Windows系统中,可以使用vim for Windows来搭建开发环境。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值