常用vimrc记录

记录下vim 的一些常用配置。每当换到一台新电脑的时候,使用vim的时候,缩进等各种方式都不友好。每次都要到互联网上去找,还要找半天,这篇博客,记录下我常用的vim配置,以及扩展,能够快速的配置开发环境。提高工作效率,省下的时间用来玩耍或者陪家人朋友。

set nu
  if has("autocmd")
    au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif

set number   "显示行号
set nowrap   "不换行
set shiftwidth=4  "默认缩进4个空格
set softtabstop=4  "使用tab时 tab空格数
set tabstop=4  "tab代表4个空格
set laststatus=2  "总是显示状态行

"backspace键
" indent 删除自动缩进的值
" eol 删除上一行行末尾的回车,两行合并
" start 除了刚输入的,还删除原来的字符
set backspace=indent,eol,start
set expandtab "使用空格替换tab

set autoindent " 自动缩进
colorscheme evening  "颜色模式

syn on  "语法高亮
filetype on "文件类型

set encoding=utf-8 "编码为utf8

安装vim 的扩展管理插件

Vundle是一款Vim的插件管理软件(Linux),用起来很方便的原因有几点:

  • 支持插件超多,可以来源于github、Vundle自带、Vim-scripts、本地仓库等等。
  • 安装流程非常简单,配置好vimrc后一键安装/更新所有
  • Vundle很容易上手,很方便

下载vundle到指定位置

$ git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

添加如下配置文件

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)
" 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://www.cnblogs.com/xcw0754/p/8391711.html

posted @ 2019-02-25 16:43  roverliang  阅读(219)  评论(0编辑  收藏  举报