码迷,mamicode.com
首页 > 系统相关 > 详细

VIM 使用心得

时间:2016-05-06 00:23:37      阅读:257      评论:0      收藏:0      [点我收藏+]

标签:

序  

  到百度任职以后,发现我们部门内无论 mac 还是 windows 程序员们清一色地都在使用 VIM 来编辑代码,各种插件、快捷键、眼花缭乱的命令等等。我之前在大学时只会极少的 VIM 命令,到百度以后奋起直追,现在也能用 VIM 幸福地开发了。

插件安装

  minibufexpl.vim(缓冲区预览)

  从 https://github.com/fholgado/minibufexpl.vim 上下载;按照 http://www.vim.org/scripts/script.php?script_id=159 的指引进行安装。

  安装步骤:Copy minibufexpl.vim into your plugin directory and add the following to your .vimrc

let g:miniBufExplMapWindowNavVim = 1 
let g:miniBufExplMapWindowNavArrows = 1 
let g:miniBufExplMapCTabSwitchBufs = 1 
let g:miniBufExplModSelTarget = 1 

  neocomplete(代码补全)

  从 https://github.com/Shougo/neocomplete.vim#requirements 下载并按照说明指导进行安装,依赖项 if_lua 一定要有,没有的话阅读 requirements 一节。

.vimrc 配置文件

  0.3.5 版本(新增 .*.un~文件统一管理)

技术分享
syntax on

set nobackup
set noswapfile
set hlsearch
set number
set ruler
set expandtab
set tabstop=4
set softtabstop=4
set shiftwidth=4
set autoindent
set cindent
set smartindent
set mouse=v
set bg=dark
set encoding=utf-8
set nobomb
set cursorline
set magic
set confirm
set langmenu=zh_CN.UTF-8
set showmatch
set matchtime=1
set scrolloff=3  
set completeopt=longest,menu
set t_Co=256
set wildmenu    "<tab>自动不全                                              
set wildmode=full  "<tab>自动不全 zsh自动不全菜单                                                                                  
set history=200 "提高命令行历史记录的数目非常有价值
set undofile    "un~ 文件统一存放
set undodir=~/.vimundofile

colorscheme darkblue

cnoremap <C-p> <Up>    "命令行模式中 <C-p> 映射为 <Up>
cnoremap <C-n> <Down>

"加载插件的最小配置
set nocompatible
filetype plugin on


autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o  "禁止粘贴时自动注释
View Code

 

 

  

  

 

VIM 使用心得

标签:

原文地址:http://www.cnblogs.com/fengyubo/p/5463815.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!