您的位置:首页 > 编程语言

vim编辑代码自动补全设置

2017-05-05 14:34 411 查看
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 initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')

" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'

" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" plugin on GitHub repo
Plugin 'tpope/vim-fugitive'
" plugin from http://vim-scripts.org/vim/scripts.html " Plugin 'L9'
" Git plugin not hosted on GitHub
Plugin '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 line
call vundle#end()            " required
filetype 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行自动对齐。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  vim 插件