-
Notifications
You must be signed in to change notification settings - Fork 35
/
menu_example.vim
200 lines (176 loc) · 8.69 KB
/
menu_example.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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
"======================================================================
"
" menu_init.vim -
"
" Created by skywind on 2019/12/26
" Last Modified: 2019/12/26 16:23:48
"
"======================================================================
if has('patch-8.1.2292') == 0 && exists('*nvim_open_win') == 0
finish
endif
call quickui#menu#reset()
call quickui#menu#install("&File", [
\ [ "&Open\t(:w)", 'call feedkeys(":tabe ")'],
\ [ "&Save\t(:w)", 'write'],
\ [ "--", ],
\ [ "LeaderF &File", 'Leaderf file', 'Open file with leaderf'],
\ [ "LeaderF &Mru", 'Leaderf mru --regexMode', 'Open recently accessed files'],
\ [ "LeaderF &Buffer", 'Leaderf buffer', 'List current buffers in leaderf'],
\ [ "--", ],
\ [ "J&unk File", 'JunkFile', ''],
\ ])
if has('win32') || has('win64') || has('win16')
call quickui#menu#install('&File', [
\ [ "--", ],
\ [ "Start &Cmd", 'silent !start /b cmd /C c:\drivers\clink\clink.cmd' ],
\ [ "Start &PowerShell", 'silent !start powershell.exe' ],
\ [ "Open &Explore", 'call Show_Explore()' ],
\ ])
endif
call quickui#menu#install("&File", [
\ [ "--", ],
\ [ "E&xit", 'qa' ],
\ ])
call quickui#menu#install("&Edit", [
\ ['Copyright &Header', 'call feedkeys("\<esc> ec")', 'Insert copyright information at the beginning'],
\ ['&Trailing Space', 'call StripTrailingWhitespace()', ''],
\ ['Update &ModTime', 'call UpdateLastModified()', ''],
\ ['&Paste Mode Line', 'PasteVimModeLine', ''],
\ ['Format J&son', '%!python -m json.tool', ''],
\ ['--'],
\ ['&Align Table', 'Tabularize /|', ''],
\ ['Align &Cheatsheet', 'MyCheatSheetAlign', ''],
\ ])
call quickui#menu#install('&Symbol', [
\ [ "&Grep Word\t(In Project)", 'call MenuHelp_GrepCode()', 'Grep keyword in current project' ],
\ [ "--", ],
\ [ "Find &Definition\t(GNU Global)", 'call MenuHelp_Gscope("g")', 'GNU Global search g'],
\ [ "Find &Symbol\t(GNU Global)", 'call MenuHelp_Gscope("s")', 'GNU Gloal search s'],
\ [ "Find &Called by\t(GNU Global)", 'call MenuHelp_Gscope("d")', 'GNU Global search d'],
\ [ "Find C&alling\t(GNU Global)", 'call MenuHelp_Gscope("c")', 'GNU Global search c'],
\ [ "Find &From Ctags\t(GNU Global)", 'call MenuHelp_Gscope("z")', 'GNU Global search c'],
\ [ "--", ],
\ [ "Goto D&efinition\t(YCM)", 'YcmCompleter GoToDefinitionElseDeclaration'],
\ [ "Goto &References\t(YCM)", 'YcmCompleter GoToReferences'],
\ [ "Get D&oc\t(YCM)", 'YcmCompleter GetDoc'],
\ [ "Get &Type\t(YCM)", 'YcmCompleter GetTypeImprecise'],
\ ])
call quickui#menu#install('&Move', [
\ ["Quickfix &First\t:cfirst", 'cfirst', 'quickfix cursor rewind'],
\ ["Quickfix L&ast\t:clast", 'clast', 'quickfix cursor to the end'],
\ ["Quickfix &Next\t:cnext", 'cnext', 'cursor next'],
\ ["Quickfix &Previous\t:cprev", 'cprev', 'quickfix cursor previous'],
\ ])
call quickui#menu#install("&Build", [
\ ["File &Execute\tF5", 'AsyncTask file-run'],
\ ["File &Compile\tF9", 'AsyncTask file-build'],
\ ["File E&make\tF7", 'AsyncTask emake'],
\ ["File &Start\tF8", 'AsyncTask emake-exe'],
\ ['--', ''],
\ ["&Project Build\tShift+F9", 'AsyncTask project-build'],
\ ["Project &Run\tShift+F5", 'AsyncTask project-run'],
\ ["Project &Test\tShift+F6", 'AsyncTask project-test'],
\ ["Project &Init\tShift+F7", 'AsyncTask project-init'],
\ ['--', ''],
\ ["T&ask List\tCtrl+F10", 'call MenuHelp_TaskList()'],
\ ['E&dit Task', 'AsyncTask -e'],
\ ['Edit &Global Task', 'AsyncTask -E'],
\ ['&Stop Building', 'AsyncStop'],
\ ])
call quickui#menu#install("&Git", [
\ ['&View Diff', 'call svnhelp#svn_diff("%")'],
\ ['&Show Log', 'call svnhelp#svn_log("%")'],
\ ['File &Add', 'call svnhelp#svn_add("%")'],
\ ])
if has('win32') || has('win64') || has('win16') || has('win95')
call quickui#menu#install("&Git", [
\ ['--',''],
\ ["Project &Update\t(Tortoise)", 'call svnhelp#tp_update()', 'TortoiseGit / TortoiseSvn'],
\ ["Project &Commit\t(Tortoise)", 'call svnhelp#tp_commit()', 'TortoiseGit / TortoiseSvn'],
\ ["Project L&og\t(Tortoise)", 'call svnhelp#tp_log()', 'TortoiseGit / TortoiseSvn'],
\ ["Project &Diff\t(Tortoise)", 'call svnhelp#tp_diff()', 'TortoiseGit / TortoiseSvn'],
\ ['--',''],
\ ["File &Add\t(Tortoise)", 'call svnhelp#tf_add()', 'TortoiseGit / TortoiseSvn'],
\ ["File &Blame\t(Tortoise)", 'call svnhelp#tf_blame()', 'TortoiseGit / TortoiseSvn'],
\ ["File Co&mmit\t(Tortoise)", 'call svnhelp#tf_commit()', 'TortoiseGit / TortoiseSvn'],
\ ["File D&iff\t(Tortoise)", 'call svnhelp#tf_diff()', 'TortoiseGit / TortoiseSvn'],
\ ["File &Revert\t(Tortoise)", 'call svnhelp#tf_revert()', 'TortoiseGit / TortoiseSvn'],
\ ["File Lo&g\t(Tortoise)", 'call svnhelp#tf_log()', 'TortoiseGit / TortoiseSvn'],
\ ])
endif
call quickui#menu#install('&Tools', [
\ ['Compare &History', 'call svnhelp#compare_ask_file()', ''],
\ ['&Compare Buffer', 'call svnhelp#compare_ask_buffer()', ''],
\ ['--',''],
\ ['List &Buffer', 'call quickui#tools#list_buffer("FileSwitch tabe")', ],
\ ['List &Function', 'call quickui#tools#list_function()', ],
\ ['Display &Messages', 'call quickui#tools#display_messages()', ],
\ ['--',''],
\ ["&DelimitMate %{get(b:, 'delimitMate_enabled', 0)? 'Disable':'Enable'}", 'DelimitMateSwitch'],
\ ['Read &URL', 'call menu#ReadUrl()', 'load content from url into current buffer'],
\ ['&Spell %{&spell? "Disable":"Enable"}', 'set spell!', 'Toggle spell check %{&spell? "off" : "on"}'],
\ ['&Profile Start', 'call MonitorInit()', ''],
\ ['Profile S&top', 'call MonitorExit()', ''],
\ ["Relati&ve number %{&relativenumber? 'OFF':'ON'}", 'set relativenumber!'],
\ ["Proxy &Enable", 'call MenuHelp_Proxy(1)', 'setup http_proxy/https_proxy/all_proxy'],
\ ["Proxy D&isable", 'call MenuHelp_Proxy(0)', 'clear http_proxy/https_proxy/all_proxy'],
\ ])
call quickui#menu#install('&Plugin', [
\ ["&NERDTree\t<space>tn", 'NERDTreeToggle', 'toggle nerdtree'],
\ ['&Tagbar', '', 'toggle tagbar'],
\ ["&Choose Window/Tab\tAlt+e", "ChooseWin", "fast switch win/tab with vim-choosewin"],
\ ["-"],
\ ["&Browse in github\trhubarb", "Gbrowse", "using tpope's rhubarb to open browse and view the file"],
\ ["&Startify", "Startify", "using tpope's rhubarb to open browse and view the file"],
\ ["&Gist", "Gist", "open gist with mattn/gist-vim"],
\ ["&Edit Note", "Note", "edit note with vim-notes"],
\ ["&Display Calendar", "Calendar", "display a calender"],
\ ['Toggle &Vista', 'Vista!!', ''],
\ ["-"],
\ ["Plugin &List", "PlugList", "Update list"],
\ ["Plugin &Update", "PlugUpdate", "Update plugin"],
\ ])
call quickui#menu#install('Help (&?)', [
\ ["&Index", 'tab help index', ''],
\ ['Ti&ps', 'tab help tips', ''],
\ ['--',''],
\ ["&Tutorial", 'tab help tutor', ''],
\ ['&Quick Reference', 'tab help quickref', ''],
\ ['&Summary', 'tab help summary', ''],
\ ['--',''],
\ ['&Vim Script', 'tab help eval', ''],
\ ['&Function List', 'tab help function-list', ''],
\ ['&Dash Help', 'call asclib#utils#dash_ft(&ft, expand("<cword>"))'],
\ ], 10000)
" let g:quickui_show_tip = 1
"----------------------------------------------------------------------
" context menu
"----------------------------------------------------------------------
let g:context_menu_k = [
\ ["&Peek Definition\tAlt+;", 'call quickui#tools#preview_tag("")'],
\ ["S&earch in Project\t\\cx", 'exec "silent! GrepCode! " . expand("<cword>")'],
\ [ "--", ],
\ [ "Find &Definition\t\\cg", 'call MenuHelp_Fscope("g")', 'GNU Global search g'],
\ [ "Find &Symbol\t\\cs", 'call MenuHelp_Fscope("s")', 'GNU Gloal search s'],
\ [ "Find &Called by\t\\cd", 'call MenuHelp_Fscope("d")', 'GNU Global search d'],
\ [ "Find C&alling\t\\cc", 'call MenuHelp_Fscope("c")', 'GNU Global search c'],
\ [ "Find &From Ctags\t\\cz", 'call MenuHelp_Fscope("z")', 'GNU Global search c'],
\ [ "--", ],
\ [ "Goto D&efinition\t(YCM)", 'YcmCompleter GoToDefinitionElseDeclaration'],
\ [ "Goto &References\t(YCM)", 'YcmCompleter GoToReferences'],
\ [ "Get D&oc\t(YCM)", 'YcmCompleter GetDoc'],
\ [ "Get &Type\t(YCM)", 'YcmCompleter GetTypeImprecise'],
\ [ "--", ],
\ ['Dash &Help', 'call asclib#utils#dash_ft(&ft, expand("<cword>"))'],
\ ['Cpp&man', 'exec "Cppman " . expand("<cword>")', '', 'c,cpp'],
\ ['P&ython Doc', 'call quickui#tools#python_help("")', 'python'],
\ ]
"----------------------------------------------------------------------
" hotkey
"----------------------------------------------------------------------
nnoremap <silent><space><space> :call quickui#menu#open()<cr>
nnoremap <silent>K :call quickui#tools#clever_context('k', g:context_menu_k, {})<cr>
if has('gui_running') || has('nvim')
noremap <c-f10> :call MenuHelp_TaskList()<cr>
endif