目录[-]

高效vim插件

如果不熟悉vim的,请在使用vim插件之前,请先阅读 Vim学习指南, 建议通过前3个层次。以及有一个有趣的vim练习游戏http://vim-adventures.com/

插件管理利器

vim的插件原始安装容易混乱,而且管理起来,不方便。那么就渴望一个插件管理工具:pathogen

简单安装:

1
2
3
mkdir -p ~/.vim/autoload ~/.vim/bundle; \
curl -Sso ~/.vim/autoload/pathogen.vim \
    https://raw.github.com/tpope/vim-pathogen/master/autoload/pathogen.vim

详细请查看:https://github.com/tpope/vim-pathogen

配置:

在vimrc文件的filetype plugin之前·「没有的就在最前面」添加:

1
2
call pathogen#infect()
filetype plugin indent on

,记住,一定是vimrc,而不是gvimrc。可以参考我的vimrc配置

高效插件集

  • eclim [java]
  • c.vim[C/C++]
  • vim-colorschemes

请将这插件安装在$HOME/.vim/bundle目录下:

NerdTree

The NERD tree allows you to explore your filesystem and to open files and directories. It presents the filesystem to you in the form of a tree which you manipulate with the keyboard and/or mouse. It also allows you to perform simple filesystem operations.

你可以使用Git这样安装:

1
2
cd $HOME/.vim/bundle
git clone https://github.com/scrooloose/nerdtree.git

snipMate

这个可以有。想快速写或者减少重复写代码,那么code snippets就是必须的,而对于vim来说,snipMate,你值得拥有。[ps:你可以在其snippets目录下找到对应语言的snippets,可以修改相应的snippets]。请到vim官网下载http://www.vim.org/scripts/script.php?script_id=2540。

tagbar

如果你使用过eclipse,那么它右边有个叫做Outline函数列表,对,tagbar就是这个效果。

你可以使用Git这样安装:

1
2
cd $HOME/.vim/bundle
git clone https://github.com/majutsushi/tagbar.git

vim-multiple-cursors

这个插件具有Sublime Text的多光标编辑功能哟。

你可以使用Git这样安装:

1
2
cd $HOME/.vim/bundle
git clone https://github.com/terryma/vim-multiple-cursors.git

jedi-vim

如果使用python的,有了它,爽歪歪。它拥有强大的提示能力。

注意,刚开始我安装这个插件,总是报错,主要是vim没有--enable-pythoninterp 和没有安装jedi·「pip install jedi」,而且后来 在jedi-vim开发者David Halter提示下,在.bashrc中设置·「export PYTHONSTARTUP="$(python -m jedi repl)" 」就可以让python具有ipython的功能。很强大!

你可以使用Git这样安装:

1
2
cd $HOME/.vim/bundle
git clone https://github.com/davidhalter/jedi-vim.git

eclim

eclim 就是 eclipse 和 vim的有机结合。它充分利用了eclipse强大的提示功能,快捷键<c-x><c-u>

按照官网安装之后,它会在.vim目录下生成eclim和plugin目录,请在bundle目录新建一个目录eclim,然后将这两个目录剪切到bundle/eclim目录中.这时它没有启动,还需要执行ECLIPSE目录中的eclimd。这个并没有列举出来。

其实还可以加一个supertab插件,但是我习惯使用tab来代替空格,实际上一个tab是4个空格。所以并没有列举出来。

你可以使用git这样安装:

1
2
cd $HOME/.vim/bundle
git clone https://github.com/ervandew/supertab.git

c.vim

请到这里去下载,这个不解释,很强大,官网有很详细的解释和帮助文档,对于c/c++来说不可缺少。

vim-colorschemes

保护视力,请从一个好的主题开始。那么vim-colorschemes中集成了很多的主题,个人比较爱好cobalt,不过有些主题只能在gvim中才能显示效果,而在vim中没有背景颜色等等问题。github去下载

1
2
cd $HOME/.vim/bundle
git clone https://github.com/upsuper/vim-colorschemes.git

vim配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
" Uncomment the next line to make Vim more Vi-compatible
" NOTE: debian.vim sets 'nocompatible'.  Setting 'compatible' changes numerous
" options, so any other options should be set AFTER setting 'compatible'.
"set compatible
set nocompatible
 
" Vim5 and later versions support syntax highlighting. Uncommenting the next
" line enables syntax highlighting by default.
if has("syntax")
  syntax on
endif
 
" If using a dark background within the editing area and syntax highlighting
" turn on this option as well
"set background=dark
 
" Uncomment the following to have Vim jump to the last position when
" reopening a file
"if has("autocmd")
"  au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
"endif
 
" Uncomment the following to have Vim load indentation rules and plugins
" according to the detected filetype.
"if has("autocmd")
"  filetype plugin indent on
"endif
 
call pathogen#infect()
 
filetype plugin indent on
 
" The following are commented out as they cause vim to behave a lot
" differently from regular Vi. They are highly recommended though.
set showcmd     " Show (partial) command in status line.
"set showmatch      " Show matching brackets.
"set ignorecase     " Do case insensitive matching
set smartcase       " Do smart case matching
"set incsearch      " Incremental search
"set autowrite      " Automatically save before commands like :next and :make
"set hidden             " Hide buffers when they are abandoned
set mouse=a     " Enable mouse usage (all modes)
set nu
set tabstop=4
set softtabstop=4
" set shiftwidth=4
set expandtab           " use whitespace instead of tab
set autoindent
set smartindent
set cindent shiftwidth=4
" set autoindent shiftwidth=4
set foldmethod=indent
set backspace=indent,eol,start
set colorcolumn=80
 
 
" === tagbar setting =======
nmap <F4> :TagbarToggle<CR>   " shortcut
let g:tagbar_width = 20      " tagbar's width, default 20
autocmd VimEnter * nested :call tagbar#autoopen(1)  "automate to open tagbar
let g:tagbar_left = 1       " on the left side
"let g:tagbar_right = 1     " on the right side
let NERDTreeIgnore=['\.pyc', '\.pyo', '\.swp', '\~'] " ignore *.py[co], *.swp and *~
" =======end==================
 
" switch window
nnoremap <c-h> <c-w>h
nnoremap <c-j> <c-w>j
nnoremap <c-k> <c-w>k
nnoremap <c-l> <c-w>l
 
" ===== brace autocompletion =========
inoremap ( ()<Esc>i
inoremap [ []<Esc>i
inoremap { {<CR>}<Esc>O
autocmd Syntax html,vim inoremap < <lt>><Esc>i| inoremap > <c-r>=ClosePair('>')<CR>
inoremap ) <c-r>=ClosePair(')')<CR>
inoremap ] <c-r>=ClosePair(']')<CR>
inoremap } <c-r>=CloseBracket()<CR>
inoremap " <c-r>=QuoteDelim('"')<CR>
inoremap ' <c-r>=QuoteDelim("'")<CR>
 
function ClosePair(char)
 if getline('.')[col('.') - 1] == a:char
 return "\<Right>"
 else
 return a:char
 endif
endf
 
function CloseBracket()
 if match(getline(line('.') + 1), '\s*}') < 0
 return "\<CR>}"
 else
 return "\<Esc>j0f}a"
 endif
endf
 
function QuoteDelim(char)
 let line = getline('.')
 let col = col('.')
 if line[col - 2] == "\\"
 "Inserting a quoted quotation mark into the string
 return a:char
 elseif line[col - 1] == a:char
 "Escaping out of the string
 return "\<Right>"
 else
 "Starting a string
 return a:char.a:char."\<Esc>i"
 endif
endf
 
 
" Source a global configuration file if available
if filereadable("/etc/vim/vimrc.local")
    source /etc/vim/vimrc.local
endif
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<span></span>
 
  
  
  
  
 <div>
 
 
  
  
  
  
 </div>

一个实例

这是我在写python nose插件nose-colorxunit时截图:

http://my.oschina.net/swuly302/blog/156784

高效vim插件的更多相关文章

  1. 常用vim插件的安装、使用和管理

      1.Ctags Ctags工具是用来遍历源代码文件生成tags文件,这些tags文件能被编辑器或者其他工具用来快速查找定位源代码中的符号,入变量名,函数名等.比如,tags文件就是Taglist和 ...

  2. 【转载】跟我一起学习VIM - vim插件

    目录 写在前面:Life Changing Editor 什么是VIM 为什么选VIM 为什么选其它 为什么犹豫选择它们 VIM >= SUM(现代编辑器) 如何学习VIM 一秒钟变记事本 VI ...

  3. 跟我一起学习VIM - vim插件合集

    2016-06-14 15:04 13333人阅读 评论(0) 收藏 举报 分类: Linux(104)  目录(?)[+]  前两天同事让我在小组内部分享一下VIM,于是我花了一点时间写了个简短的教 ...

  4. [vundle]利用vundle工具来管理vim插件

    转自:http://os.51cto.com/art/201507/484174.htm Vim是Linux上一款用途广泛的轻量级文本编辑工具.虽然对普通的Linux用户来说开始学用起来难度相当大,但 ...

  5. VIM插件攻略

    工欲善其事,必先利其器.一个强大的开发环境可以大大提高工作效率.好吧,我知道这是废话...不过,我想一定有很多跟我一样打算进入Linux平台开发的新手,一开始都为找不到一个像Windows下的VS那样 ...

  6. [Tools] Vim插件管理

    我们在使用插件的时候,都不希望插件安装的很杂乱,它不是一个看不见的黑盒,也为了下次方便在其它地方安装. 由于要方便插件管理,于是有了 Vundle,以下做些介绍: 1. 一个插件管理器, 自己本身也是 ...

  7. Vim插件管理——Vundle

    Vim插件管理--Vundle 都说Vim时程序员写给自己的编辑器,其中的情结可想而知.身为一只程序狗CodingDoge,今天就让我带各位学习Vim的使用. vim因为其庞大而强劲的插件受到无比的推 ...

  8. vim 插件管理

    1 进入自己的vim mkdir ./bundle/vundle 2 在vimrc同级中执行 git clone https://github.com/gmarik/vundle.git ./bund ...

  9. 「个人vim插件+配置」

    2016.10.4 filetype indent on syntax on set nu ai ci si set sw= ts= set autochdir set backspace= colo ...

随机推荐

  1. sql之视图、触发器、函数、存储过程、事务

    视图 # 视图也是一张表,但在data文件里只有表结构,没有表数据 # 不建议使用,扩展性差,程序需改变时,依赖的视图也要改变 # 视图牵涉到多张表时,视图中的记录不能修改. create view ...

  2. 微信小程序开发之页面数据绑定

    js:Page( { data:{ parmer:"",             //字符串参数 userinfo:{      userphone:"",   ...

  3. 创建Sitemap文件供搜索引擎使用

    以下内容转载自 http://www.cnblogs.com/webtrados/archive/2009/12/29/1635305.html 如何创建Sitemap文件 Sitemap的格式有XM ...

  4. PXE与cobbler实现系统自动安装

    安装操作系统的流程事实上并不复杂,如果你要给三五台服务器安装系统那么我们手工去安装即可.但是当我们要部署的是大型机房的操作系统的时候显然手动安装去一台一台的点,是不现实的.尤其现在互联网行业高速发展, ...

  5. mysql:视图,触发器

    一视图 视图是一个虚拟表(非真实存在),其本质是[根据SQL 语句获取动态的数据集,并未其命名],用户使用时只需使用名称即可获取结果集,可以将该结果集当做表来使用. 使用视图我们可以吧查询过程的临时表 ...

  6. E20190308-hm

    sweep vt. 扫除; 打扫,清理; 彻底搜索; 掠过; vi. 打扫; 扫过; 蜿蜒; 大范围伸展; n. 打扫; 延伸; 挥动; 全胜;

  7. setInterval和setTImeout中的this指向问题

    问题:在setInterval和setTimeout中传入函数时,函数中的this会指向window对象 解决方法: 1. 将当前对象的this存为一个变量,定时器内的函数利用闭包来访问这个变量.va ...

  8. 算法学习--Day6

    题目描述 实现一个加法器,使其能够输出a+b的值. 输入描述: 输入包括两个数a和b,其中a和b的位数不超过1000位. 输出描述: 可能有多组测试数据,对于每组数据, 输出a+b的值. 示例1 输入 ...

  9. HDU 3501【欧拉函数拓展】

    欧拉函数 欧拉函数是指:对于一个正整数n,小于n且和n互质的正整数(包括1)的个数,记作φ(n) . 通式:φ(x)=x*(1-1/p1)(1-1/p2)(1-1/p3)*(1-1/p4)-..(1- ...

  10. Android NDK开发指南(一) Application.mk文件

    http://www.cnblogs.com/yaozhongxiao/archive/2012/03/06/2381586.html Application.mk目的是描述在你的应用程序中所需要的模 ...