lefttree / VimSetup

my vim setup, plugins and .vimrc

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Vim Setup

my vim setup, plugins and .vimrc

How to Install

  1. You need to compile vim by yourself first

  2. ./install.sh, it would install the plugins and color theme

##Compile Vim from source

系统自带的vim往往功能有阉割(我的ubuntu 14.04就没有clipboard支持),所以一般我们需要compile from source, 一般使用Vim 7.4+

具体如何compile请看在YouCompleteMe下的这个文章

上面那个blog compile的vim有可能没有clipboard support,这篇blog讲了如何更好地compile vim

###Install on Mac(stackoverflow)

Download the latest MacVim which comes with a very complete vim executable and use it in Terminal.app like so.

alias vim='/Applications/MacVim.app/Contents/MacOS/Vim'

##插件管理

转载

一般有两种选择vundlepathogen,这里我选择pathogen.

使用: 安装

  1. 先在 ~/.vim/bundle/ 下创建目录 plugin_name/
  2. 然后到 vim 官网下载 plugin_name 压缩包并解压至 ~/.vim/bundle/plugin_name/

注意不要重复包含多次 plugin_name/ 目录,如,~/.vim/bundle/plugin_name/plugin_name/。

卸载

  1. 直接删除 plugin_name/ 插件目录即可。

通过 pathogen 管理插件后,相较以前有几点变化:

  • 切勿通过发行套件自带的软件管理工具安装任何插件,不然 .vim/ 又要混乱了;
  • pathogen 无法安装配色主题风格,只能将主题插件手工放置于 ~/.vim/colors/;

###plugin list

##Theme

我表示一直用solarized 将solarized.vim copy到~/.vim/colors/, 然后在.vimrc中设置其为theme

想换的可以到这个网站

###Mac Iterm color settings

if you iterm doesn't show correct color, see this stackoverflow link

##Fonts

如何在linux上安装字体 (link)(http://my.oschina.net/itblog/blog/278566)

##Short-Cuts

search

search for where cursor is

<shift> + # search for next occurance <shift> + * search for previous occurance

insert

ci[ 删除一对 [] 中的所有字符并进入插入模式
ci( 删除一对 () 中的所有字符并进入插入模式
ci< 删除一对 <> 中的所有字符并进入插入模式
ci{ 删除一对 {} 中的所有字符并进入插入模式
cit 删除一对 HTML/XML 的标签内部的所有字符并进入插入模式
ci" ci' ci` 删除一对引号字符 (" 或 ' 或 `) 中所有字符并进入插入模式
vi[ 选择一对 [] 中的所有字符
vi( 选择一对 () 中的所有字符
vi< 选择一对 <> 中的所有字符
vi{ 选择一对 {} 中的所有字符
vit 选择一对 HTML/XML 的标签内部的所有字符
vi" vi' vi` 选择一对引号字符 (" 或 ' 或 `) 中所有字符

comment

<leader>cc,注释当前选中文本,如果选中的是整行则在每行首添加 //,如果选中一行的部分内容则在选中部分前后添加分别 /、/;
<leader>cu,取消选中文本块的注释。

indent

插入模式
  Ctrl-T增加缩进,Ctrl-D减小缩进。
命令模式
  >> 右缩进, << 左缩进,注意n<< 或 n>>是缩进多行,如4>>
可视模式
  < 、 > 用于左右缩进, n< 、 n> 可做多节缩进,如 2> 。

跳转

跳转到定义
  gd到局部变量的定义,gD到全局变量的定义
搜索
  *, # 可对光标处的词向前/向后做全词搜索,g*, g# 做相对应的非全词匹配搜索
代码块首尾
  [[, ]] 可跳到当前代码块起始或结束的大括号处。
括号首尾
  % 可在配对的括号、块首尾之前跳转。
位置历史
  Ctrl-O 在历史记录中后台,Ctrl-I 则为前进。

quickFix

:cw
:cn
:cp

vim-flake8

press <F7> to run flake8 on python file

NerdTree

<Leader>fl #nerdTree toggle

JsDoc

  1. move cursor on function ketword line
  2. :JsDoc
  3. follow prompt to insert JSDoc

DoxygenToolkit

License :DoxLic Author :DoxAuthor Function/Class :Dox Group :DoxBlock

Tagbar

<F8>

nmap <F8> :TagbarToggle<CR>

Taglist

:TlistToggle

easy motion

<Leader><Leader> w
<Leader><Leader> fe //search for e

vim-surround

delete use ds change use cs ys takes a valid Vim motion or text object as the first object, and wraps
it using the second argument as with cs. (It's a stretch, but a good
mnemonic for "ys" is "you surround".)

It's easiest to explain with examples. Press cs"' inside

"Hello world!" to change it to

'Hello world!'

To remove the delimiters entirely, press ds'.

Hello world!

vim expand

+ to expand - to shrink

emmet

tutorial

Jslint

  • :JSLintUpdate
  • :JSLintToggle

##Reference

##Vim学习

About

my vim setup, plugins and .vimrc

License:MIT License


Languages

Language:Vim Script 96.9%Language:Shell 3.1%