-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkeyMappings.vim
74 lines (64 loc) · 2.82 KB
/
keyMappings.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
let s:keyMapping = {}
let s:mappedKeys = {}
function SetKeysMapping(name, keys)
let s:keyMapping[a:name] = a:keys
if has_key(s:mappedKeys, a:name)
let mk = s:mappedKeys[a:name]
call UnmapKeys(a:name)
call MapKeys(a:name, mk.mapCmds, mk.cmd)
end
endf
function MapKeys(name, mapCmds, cmd)
if has_key(s:keyMapping, a:name)
let mapCmds = type(a:mapCmds) != type([]) ? [a:mapCmds] : a:mapCmds
let keys = type(s:keyMapping[a:name]) != type([]) ? [s:keyMapping[a:name]] : s:keyMapping[a:name]
let s:mappedKeys[a:name] = { 'mapCmds': mapCmds, 'keys': keys, 'cmd': a:cmd }
for key in keys
for mapCmd in mapCmds
exec mapCmd.' '.key.' '.a:cmd
endfor
endfor
end
endf
function UnmapKeys(name)
if has_key(s:mappedKeys, a:name)
let mk = s:mappedKeys[a:name]
for key in mk.keys
for mapCmd in mk.mapCmds
let unmapCmd = substitute(mapCmd, '\(nore\)\?map', 'unmap', '')
exec unmapCmd.' '.key
endfor
endfor
unlet s:mappedKeys[a:name]
end
endf
call SetKeysMapping('general.search', '<F5>')
call SetKeysMapping('general.findFile', [ '<C-F><C-F>', '<C-F>f', '<F3>' ])
call SetKeysMapping('general.findSymbol', [ '<C-F><C-S>', '<C-F>s', 'O1;5R' ]) " <C-F3>
call SetKeysMapping('general.findSymbolInBuffer', [ '<C-F><C-B>', '<C-F>b', 'O1;6R' ]) " <C-S-F3>
call SetKeysMapping('general.findLineInBuffer', [ '<C-F><C-L>', '<C-F>l' ])
call SetKeysMapping('general.findChangeListEntry', [ '<C-F><C-C>', '<C-F>c' ])
call SetKeysMapping('general.prevError', '<F7>')
call SetKeysMapping('general.nextError', '<F8>')
call SetKeysMapping('general.prevTab', '<M-PageUp>')
call SetKeysMapping('general.nextTab', '<M-PageDown>')
call SetKeysMapping('general.prevBuf', '<M-Left>')
call SetKeysMapping('general.nextBuf', '<M-Right>')
call SetKeysMapping('langPlugin.addImport', '<C-K>')
call SetKeysMapping('langPlugin.gotoSymbol', 't<C-]>')
call SetKeysMapping('langPlugin.openAlternativeFile', '<F4>')
call SetKeysMapping('langPlugin.printScope', '<C-P>')
call SetKeysMapping('langPlugin.searchDerived', '<C-F5>')
call SetKeysMapping('langPlugin.searchUsages', '<S-F5>')
call SetKeysMapping('langPlugin.toggleComment', '<F2>')
call SetKeysMapping('langPlugin.openSymbolInNewTab', '<F6>')
call SetKeysMapping('langPlugin.openSymbolPreview', '<C-\>')
call SetKeysMapping('langPlugin.openDocumentation', 'K')
call SetKeysMapping('vcs.showCommit', [])
call SetKeysMapping('vcs.blame', [])
call SetKeysMapping('buildsystem.buildFile', '<C-F7>')
"call SetKeysMapping('buildsystem.buildAll', '<C-B>')
call SetKeysMapping('buildsystem.build', '<C-B>')
"call SetKeysMapping('plugins.vimCommander.toggle', [ '<C-F><C-F>', '<C-F>f' ])
call SetKeysMapping('plugins.nerdTree.toggle', [ '<C-N><C-N>', '<C-N>n' ])
call SetKeysMapping('plugins.nerdTree.findCurrentFile', [ '<C-N><C-F>', '<C-N>f' ])