vim编辑代码自动补全设置

来源:互联网 发布:淘宝网店如何起步 编辑:程序博客网 时间:2024/05/16 14:32

1.安装vundle插件

执行:git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim 从git下面下载vundle.vim文件

将如下文本设置到/etc/vimrc中

set nocompatible              " be iMproved, required"filetype off                  " required   这个需要设置为on,用来识别自动文本类型" set the runtime path to include Vundle and initializeset rtp+=~/.vim/bundle/Vundle.vimcall vundle#begin()" alternatively, pass a path where Vundle should install plugins"call vundle#begin('~/some/path/here')" let Vundle manage Vundle, requiredPlugin 'VundleVim/Vundle.vim'" The following are examples of different formats supported." Keep Plugin commands between vundle#begin/end." plugin on GitHub repoPlugin 'tpope/vim-fugitive'" plugin from http://vim-scripts.org/vim/scripts.html" Plugin 'L9'" Git plugin not hosted on GitHubPlugin 'git://git.wincent.com/command-t.git'" git repos on your local machine (i.e. when working on your own plugin)Plugin 'file:///home/gmarik/path/to/plugin'" The sparkup vim script is in a subdirectory of this repo called vim." Pass the path to set the runtimepath properly.Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}" Install L9 and avoid a Naming conflict if you've already installed a" different version somewhere else." Plugin 'ascenator/L9', {'name': 'newL9'}" All of your Plugins must be added before the following linecall vundle#end()            " requiredfiletype plugin indent on    " required" To ignore plugin indent changes, instead use:"filetype plugin on"" Brief help" :PluginList       - lists configured plugins" :PluginInstall    - installs plugins; append `!` to update or just :PluginUpdate" :PluginSearch foo - searches for foo; append `!` to refresh local cache" :PluginClean      - confirms removal of unused plugins; append `!` to auto-approve removal"" see :h vundle for more details or wiki for FAQ" Put your non-Plugin stuff after this line

参考:

https://github.com/VundleVim/Vundle.vim

http://www.jianshu.com/p/0e85e7c9e543#


2.设置/etc/vimrc内容

添加如下设置:

syn on
filetype on
set number
set ruler
set hls
set history=500
"set cursorline
"set laststatus=2
"set cmdheight=1
set expandtab
set tabstop=4
set shiftwidth=4
set softtabstop=4
set smarttab
set autoindent
set smartindent
set cindent
"set showcmd
set showmatch


3.自动对齐设置命令

进入vim,先选择行数,再按下“=”号两次,即可自动对齐

如:按下300,再按下“=”两次,可以将文本的光标以下300行自动对齐。




0 0