# vim学习
## vim配置
1. 主要配置使用Python3
```
" 基础配置
syntax on
set encoding=utf-8
set nu
set ruler
" 自动缩进和Tabs设置
set tabstop=4
set shiftwidth=4
set expandtab
set autoindent
set cindent
set ai!
set smartindent
" 符号自动匹配
set showmatch
" 搜索自动匹配
set incsearch
" 安装插件管理器
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
" 使用Vundle安装的插件
Plugin 'delimitMate.vim'
Plugin 'Pydiction'
filetype plugin on
let g:pydiction_location = '/Users/yangp/.vim/bundle/Pydiction/complete-dict'
let g:pydiction_menu_height = 3
```
## vim主要快捷键
1. vim的模式,命令行模式,插入模式,视图模式
3. 常用命令:
1.插入、保存、退出、强制
2.视图模式选择
3.dd 删除单行
4.p 粘贴
5.y 复制
6.G 转到最后一行
7.gg转到第一行
8.o 在下一行插入
9.w 通过空格确定单词
10.方向键 hjkl
11.v 进入视图模式
3. 组合命令
1.ggvG 全选
4. vim跳转命令
1.跳转到行首^,行尾$
2.下一个单词首w,尾e,前一个单词b
5. 视图模式
1.添加选定视图的内容到系统剪切板 :w !pbcopy
2.从系统剪切板粘贴内容:r !pbpaste
3.拷贝整个文件:%w !pbcopy
4.使用vim的寄存器剪切 复制y,粘贴p
5.v,视图模式,crtl+v 行视图,shift+v 列视图
6.在视图模式下也可以使用各种跳转命令(也许有特例,没事试过)
6.