有用的vim插件

介绍一些我正在使用的有用的vim插件

我的vim配置

一、vim-move

可以在NORMALVISUAL模式下移动行和块

" 插件配置
let g:move_map_keys = 0
vmap <A-k> <Plug>MoveBlockDown
vmap <A-i> <Plug>MoveBlockUp
vmap <A-j> <Plug>MoveBlockLeft
vmap <A-l> <Plug>MoveBlockRight
nmap <A-k> <Plug>MoveLineDown
nmap <A-i> <Plug>MoveLineUp
nmap <A-j> <Plug>MoveLineLeft
nmap <A-l> <Plug>MoveLineRight

二、wildfire

快速选中括号或其它符号内的内容

let g:wildfire_objects = ["i'", 'i"', "i)", "i]", "i}", "i>"]

三、comfortable-motion

使vim可以顺滑的滚动

let g:comfortable_motion_friction = 100
let g:comfortable_motion_air_drag = 2
let g:comfortable_motion_no_default_key_mappings = 1
let g:comfortable_motion_impulse_multiplier = 1 " Feel free to increase/decrease this value.
nnoremap <silent> <C-d> :call comfortable_motion#flick(g:comfortable_motion_impulse_multiplier * winheight(0) * 2)<CR>
nnoremap <silent> <C-u> :call comfortable_motion#flick(g:comfortable_motion_impulse_multiplier * winheight(0) * -2)<CR>
noremap <silent> <ScrollWheelDown> :call comfortable_motion#flick(40)<CR>
noremap <silent> <ScrollWheelUp> :call comfortable_motion#flick(-40)<CR>

四、vim-visual-multi

多选操作,相当常用

let g:VM_maps = {}
let g:VM_leader = {'default': ',', 'visual': ',', 'buffer': ','}
let g:VM_maps['Select All'] = '<M-n>'
let g:VM_maps['Visual All'] = '<M-n>'
let g:VM_maps['Skip Region'] = '<C-x>'
let g:VM_maps['Remove Region'] = '<C-p>'
let g:VM_maps['Increase'] = '+'
let g:VM_maps['Decrease'] = '-'
let g:VM_maps["Undo"] = 'u'
let g:VM_maps["Redo"] = '<C-r>'
let g:VM_custom_motions = {'j': 'h', 'l': 'l', 'i': 'k', 'k': 'j'}
let g:VM_maps['i'] = 'h'
let g:VM_maps['I'] = 'H'

五、undotree

查看历史更改

noremap L :UndotreeToggle<CR>
let g:undotree_DiffAutoOpen = 1
let g:undotree_SetFocusWhenToggle = 1
let g:undotree_ShortIndicators = 1
let g:undotree_WindowLayout = 2
let g:undotree_DiffpanelHeight = 8
let g:undotree_SplitWidth = 24
function g:Undotree_CustomMap()
nmap <buffer> i <plug>UndotreeNextState
nmap <buffer> k <plug>UndotreePreviousState
nmap <buffer> I 5<plug>UndotreeNextState
nmap <buffer> K 5<plug>UndotreePreviousState
endfunc