vim自动缩进及tap空格数设置4

首先要修改配置信息,首先的知道在哪里修改,只说一次,文件路径在 /etc/vim/vimrc

sudo vim /etc/vim/vimrc

在里面添加如下代码,就能实现我们所说的功能

set smartindent  
set tabstop=4  
set shiftwidth=4  
set expandtab  
set softtabstop=4  

vim重装

sudo apt-get install --reinstall vim-gnome vim-gui-common vim-common vim-runtime

vim插件管理及安装

  • 在当前用户目录创建 .vim 目录,如有已经有了,请放肆的略过。命令如下:

mkdir .vim
  • 进入 .vim 目录,并创建目录 bundle ,并进入 bundle 目录,克隆 Vundle ,因为我们用它管理插件。把需要安装的插件加入到 Plugin 'XXXX' 之间。

cd ~/.vim && mkdir bundle && cd bundle

克隆命令代码如下:

git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
  • 编辑并操作运行 vim .vimrc 。下面的设置放在 .vimrc 头部。

set nocompatible              " be iMproved, required
filetype off                  " required

" 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
  • 运行 :PluginInstall 安装插件。在命令行输入 vim ,再输入 :PluginInstall 稍等,一会儿就会安装好的。


starsfun
77 声望6 粉丝

引用和评论

0 条评论