blob: e89291b16f190baaba41cebe8d14d6349baf495c [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim support file to define the default menus
2" You can also use this as a start for your own set of menus.
3"
4" Maintainer: Bram Moolenaar <Bram@vim.org>
Bram Moolenaar2ce06f62005-01-31 19:19:04 +00005" Last Change: 2005 Jan 30
Bram Moolenaar071d4272004-06-13 20:20:40 +00006
7" Note that ":an" (short for ":anoremenu") is often used to make a menu work
8" in all modes and avoid side effects from mappings defined by the user.
9
10" Make sure the '<' and 'C' flags are not included in 'cpoptions', otherwise
11" <CR> would not be recognized. See ":help 'cpoptions'".
12let s:cpo_save = &cpo
13set cpo&vim
14
15" Avoid installing the menus twice
16if !exists("did_install_default_menus")
17let did_install_default_menus = 1
18
19
20if exists("v:lang") || &langmenu != ""
21 " Try to find a menu translation file for the current language.
22 if &langmenu != ""
23 if &langmenu =~ "none"
24 let s:lang = ""
25 else
26 let s:lang = &langmenu
27 endif
28 else
29 let s:lang = v:lang
30 endif
31 " A language name must be at least two characters, don't accept "C"
32 if strlen(s:lang) > 1
33 " When the language does not include the charset add 'encoding'
34 if s:lang =~ '^\a\a$\|^\a\a_\a\a$'
35 let s:lang = s:lang . '.' . &enc
36 endif
37
38 " We always use a lowercase name.
39 " Change "iso-8859" to "iso_8859" and "iso8859" to "iso_8859", some
40 " systems appear to use this.
41 " Change spaces to underscores.
42 let s:lang = substitute(tolower(s:lang), '\.iso-', ".iso_", "")
43 let s:lang = substitute(s:lang, '\.iso8859', ".iso_8859", "")
44 let s:lang = substitute(s:lang, " ", "_", "g")
45 " Remove "@euro", otherwise "LC_ALL=de_DE@euro gvim" will show English menus
46 let s:lang = substitute(s:lang, "@euro", "", "")
47 " Change "iso_8859-1" and "iso_8859-15" to "latin1", we always use the
48 " same menu file for them.
49 let s:lang = substitute(s:lang, 'iso_8859-15\=$', "latin1", "")
50 menutrans clear
51 exe "runtime! lang/menu_" . s:lang . ".vim"
52
53 if !exists("did_menu_trans")
54 " There is no exact match, try matching with a wildcard added
55 " (e.g. find menu_de_de.iso_8859-1.vim if s:lang == de_DE).
56 let s:lang = substitute(s:lang, '\.[^.]*', "", "")
Bram Moolenaar2ce06f62005-01-31 19:19:04 +000057 exe "runtime! lang/menu_" . s:lang . "[^a-z]*.vim"
Bram Moolenaar071d4272004-06-13 20:20:40 +000058
59 if !exists("did_menu_trans") && strlen($LANG) > 1
60 " On windows locale names are complicated, try using $LANG, it might
61 " have been set by set_init_1().
Bram Moolenaar2ce06f62005-01-31 19:19:04 +000062 " But don't match "slovak" when $LANG is "sl".
63 exe "runtime! lang/menu_" . tolower($LANG) . "[^a-z]*vim"
Bram Moolenaar071d4272004-06-13 20:20:40 +000064 endif
65 endif
66 endif
67endif
68
69
70" Help menu
71an 9999.10 &Help.&Overview<Tab><F1> :help<CR>
72an 9999.20 &Help.&User\ Manual :help usr_toc<CR>
73an 9999.30 &Help.&How-to\ links :help how-to<CR>
74an <silent> 9999.40 &Help.&Find\.\.\. :call <SID>Helpfind()<CR>
75an 9999.45 &Help.-sep1- <Nop>
76an 9999.50 &Help.&Credits :help credits<CR>
77an 9999.60 &Help.Co&pying :help copying<CR>
78an 9999.70 &Help.&Sponsor/Register :help sponsor<CR>
79an 9999.70 &Help.O&rphans :help kcc<CR>
80an 9999.75 &Help.-sep2- <Nop>
81an 9999.80 &Help.&Version :version<CR>
82an 9999.90 &Help.&About :intro<CR>
83
84fun! s:Helpfind()
85 if !exists("g:menutrans_help_dialog")
86 let g:menutrans_help_dialog = "Enter a command or word to find help on:\n\nPrepend i_ for Input mode commands (e.g.: i_CTRL-X)\nPrepend c_ for command-line editing commands (e.g.: c_<Del>)\nPrepend ' for an option name (e.g.: 'shiftwidth')"
87 endif
88 let h = inputdialog(g:menutrans_help_dialog)
89 if h != ""
90 let v:errmsg = ""
91 silent! exe "help " . h
92 if v:errmsg != ""
93 echo v:errmsg
94 endif
95 endif
96endfun
97
98" File menu
99an 10.310 &File.&Open\.\.\.<Tab>:e :browse confirm e<CR>
100an 10.320 &File.Sp&lit-Open\.\.\.<Tab>:sp :browse sp<CR>
101an 10.325 &File.&New<Tab>:enew :confirm enew<CR>
102an <silent> 10.330 &File.&Close<Tab>:close
103 \ :if winheight(2) < 0 <Bar>
104 \ confirm enew <Bar>
105 \ else <Bar>
106 \ confirm close <Bar>
107 \ endif<CR>
108an 10.335 &File.-SEP1- <Nop>
109an <silent> 10.340 &File.&Save<Tab>:w :if expand("%") == ""<Bar>browse confirm w<Bar>else<Bar>confirm w<Bar>endif<CR>
110an 10.350 &File.Save\ &As\.\.\.<Tab>:sav :browse confirm saveas<CR>
111
112if has("diff")
113 an 10.400 &File.-SEP2- <Nop>
114 an 10.410 &File.Split\ &Diff\ with\.\.\. :browse vert diffsplit<CR>
115 an 10.420 &File.Split\ Patched\ &By\.\.\. :browse vert diffpatch<CR>
116endif
117
118if has("printer")
119 an 10.500 &File.-SEP3- <Nop>
120 an 10.510 &File.&Print :hardcopy<CR>
121 vunmenu &File.&Print
122 vnoremenu &File.&Print :hardcopy<CR>
123elseif has("unix")
124 an 10.500 &File.-SEP3- <Nop>
125 an 10.510 &File.&Print :w !lpr<CR>
126 vunmenu &File.&Print
127 vnoremenu &File.&Print :w !lpr<CR>
128endif
129an 10.600 &File.-SEP4- <Nop>
130an 10.610 &File.Sa&ve-Exit<Tab>:wqa :confirm wqa<CR>
131an 10.620 &File.E&xit<Tab>:qa :confirm qa<CR>
132
133" Pasting blockwise and linewise selections is not possible in Insert and
134" Visual mode without the +virtualedit feature. They are pasted as if they
135" were characterwise instead. Add to that some tricks to leave the cursor in
136" the right position, also for "gi".
137" Note: the same stuff appears in mswin.vim.
138if has("virtualedit")
139 nnoremap <silent> <script> <SID>Paste :call <SID>Paste()<CR>
140 func! <SID>Paste()
141 let ove = &ve
142 set ve=all
143 normal `^
144 if @+ != ''
145 normal "+gP
146 endif
147 let c = col(".")
148 normal i
149 if col(".") < c " compensate for i<ESC> moving the cursor left
150 normal l
151 endif
152 let &ve = ove
153 endfunc
154else
155 nnoremap <silent> <script> <SID>Paste "=@+.'xy'<CR>gPFx"_2x
156endif
157
158" Use maps for items that are present both in Edit, Popup and Toolbar menu.
159if has("virtualedit")
160 vnoremap <script> <SID>vPaste "-c<Esc><SID>Paste
161 inoremap <script> <SID>iPaste <Esc><SID>Pastegi
162else
163 vnoremap <script> <SID>vPaste "-c<Esc>gix<Esc><SID>Paste"_x
164 inoremap <script> <SID>iPaste x<Esc><SID>Paste"_s
165endif
166
167func! <SID>SelectAll()
168 exe "norm gg" . (&slm == "" ? "VG" : "gH\<C-O>G")
169endfunc
170
171
172" Edit menu
173an 20.310 &Edit.&Undo<Tab>u u
174an 20.320 &Edit.&Redo<Tab>^R <C-R>
175an 20.330 &Edit.Rep&eat<Tab>\. .
176
177an 20.335 &Edit.-SEP1- <Nop>
178vnoremenu 20.340 &Edit.Cu&t<Tab>"+x "+x
179vnoremenu 20.350 &Edit.&Copy<Tab>"+y "+y
180cnoremenu 20.350 &Edit.&Copy<Tab>"+y <C-Y>
181nnoremenu 20.360 &Edit.&Paste<Tab>"+gP "+gP
182cnoremenu &Edit.&Paste<Tab>"+gP <C-R>+
183vnoremenu <script> &Edit.&Paste<Tab>"+gP <SID>vPaste
184inoremenu <script> &Edit.&Paste<Tab>"+gP <SID>iPaste
185nnoremenu 20.370 &Edit.Put\ &Before<Tab>[p [p
186inoremenu &Edit.Put\ &Before<Tab>[p <C-O>[p
187nnoremenu 20.380 &Edit.Put\ &After<Tab>]p ]p
188inoremenu &Edit.Put\ &After<Tab>]p <C-O>]p
189if has("win32") || has("win16")
190 vnoremenu 20.390 &Edit.&Delete<Tab>x x
191endif
192noremenu <script> <silent> 20.400 &Edit.&Select\ All<Tab>ggVG :<C-U>call <SID>SelectAll()<CR>
193inoremenu <script> <silent> 20.400 &Edit.&Select\ All<Tab>ggVG <C-O>:call <SID>SelectAll()<CR>
194cnoremenu <script> <silent> 20.400 &Edit.&Select\ All<Tab>ggVG <C-U>call <SID>SelectAll()<CR>
195
196an 20.405 &Edit.-SEP2- <Nop>
Bram Moolenaar843ee412004-06-30 16:16:41 +0000197if has("win32") || has("win16") || has("gui_gtk") || has("gui_kde") || has("gui_motif")
Bram Moolenaar071d4272004-06-13 20:20:40 +0000198 an 20.410 &Edit.&Find\.\.\. :promptfind<CR>
199 vunmenu &Edit.&Find\.\.\.
200 vnoremenu &Edit.&Find\.\.\. y:promptfind <C-R>"<CR>
201 an 20.420 &Edit.Find\ and\ Rep&lace\.\.\. :promptrepl<CR>
202 vunmenu &Edit.Find\ and\ Rep&lace\.\.\.
203 vnoremenu &Edit.Find\ and\ Rep&lace\.\.\. y:promptrepl <C-R>"<CR>
204else
205 an 20.410 &Edit.&Find<Tab>/ /
206 an 20.420 &Edit.Find\ and\ Rep&lace<Tab>:%s :%s/
207 vunmenu &Edit.Find\ and\ Rep&lace<Tab>:%s
208 vnoremenu &Edit.Find\ and\ Rep&lace<Tab>:s :s/
209endif
210
211an 20.425 &Edit.-SEP3- <Nop>
212an 20.430 &Edit.Settings\ &Window :options<CR>
213
214" Edit/Global Settings
215an 20.440.100 &Edit.&Global\ Settings.Toggle\ Pattern\ &Highlight<Tab>:set\ hls! :set hls! hls?<CR>
216an 20.440.110 &Edit.&Global\ Settings.Toggle\ &Ignore-case<Tab>:set\ ic! :set ic! ic?<CR>
217an 20.440.110 &Edit.&Global\ Settings.Toggle\ &Showmatch<Tab>:set\ sm! :set sm! sm?<CR>
218
219an 20.440.120 &Edit.&Global\ Settings.&Context\ lines.\ 1\ :set so=1<CR>
220an 20.440.120 &Edit.&Global\ Settings.&Context\ lines.\ 2\ :set so=2<CR>
221an 20.440.120 &Edit.&Global\ Settings.&Context\ lines.\ 3\ :set so=3<CR>
222an 20.440.120 &Edit.&Global\ Settings.&Context\ lines.\ 4\ :set so=4<CR>
223an 20.440.120 &Edit.&Global\ Settings.&Context\ lines.\ 5\ :set so=5<CR>
224an 20.440.120 &Edit.&Global\ Settings.&Context\ lines.\ 7\ :set so=7<CR>
225an 20.440.120 &Edit.&Global\ Settings.&Context\ lines.\ 10\ :set so=10<CR>
226an 20.440.120 &Edit.&Global\ Settings.&Context\ lines.\ 100\ :set so=100<CR>
227
228an 20.440.130.40 &Edit.&Global\ Settings.&Virtual\ Edit.Never :set ve=<CR>
229an 20.440.130.50 &Edit.&Global\ Settings.&Virtual\ Edit.Block\ Selection :set ve=block<CR>
230an 20.440.130.60 &Edit.&Global\ Settings.&Virtual\ Edit.Insert\ mode :set ve=insert<CR>
231an 20.440.130.70 &Edit.&Global\ Settings.&Virtual\ Edit.Block\ and\ Insert :set ve=block,insert<CR>
232an 20.440.130.80 &Edit.&Global\ Settings.&Virtual\ Edit.Always :set ve=all<CR>
233an 20.440.140 &Edit.&Global\ Settings.Toggle\ Insert\ &Mode<Tab>:set\ im! :set im!<CR>
234an 20.440.145 &Edit.&Global\ Settings.Toggle\ Vi\ C&ompatible<Tab>:set\ cp! :set cp!<CR>
235an <silent> 20.440.150 &Edit.&Global\ Settings.Search\ &Path\.\.\. :call <SID>SearchP()<CR>
236an <silent> 20.440.160 &Edit.&Global\ Settings.Ta&g\ Files\.\.\. :call <SID>TagFiles()<CR>
237"
238" GUI options
239an 20.440.300 &Edit.&Global\ Settings.-SEP1- <Nop>
240an <silent> 20.440.310 &Edit.&Global\ Settings.Toggle\ &Toolbar :call <SID>ToggleGuiOption("T")<CR>
241an <silent> 20.440.320 &Edit.&Global\ Settings.Toggle\ &Bottom\ Scrollbar :call <SID>ToggleGuiOption("b")<CR>
242an <silent> 20.440.330 &Edit.&Global\ Settings.Toggle\ &Left\ Scrollbar :call <SID>ToggleGuiOption("l")<CR>
243an <silent> 20.440.340 &Edit.&Global\ Settings.Toggle\ &Right\ Scrollbar :call <SID>ToggleGuiOption("r")<CR>
244
245fun! s:SearchP()
246 if !exists("g:menutrans_path_dialog")
247 let g:menutrans_path_dialog = "Enter search path for files.\nSeparate directory names with a comma."
248 endif
249 let n = inputdialog(g:menutrans_path_dialog, substitute(&path, '\\ ', ' ', 'g'))
250 if n != ""
251 let &path = substitute(n, ' ', '\\ ', 'g')
252 endif
253endfun
254
255fun! s:TagFiles()
256 if !exists("g:menutrans_tags_dialog")
257 let g:menutrans_tags_dialog = "Enter names of tag files.\nSeparate the names with a comma."
258 endif
259 let n = inputdialog(g:menutrans_tags_dialog, substitute(&tags, '\\ ', ' ', 'g'))
260 if n != ""
261 let &tags = substitute(n, ' ', '\\ ', 'g')
262 endif
263endfun
264
265fun! s:ToggleGuiOption(option)
266 " If a:option is already set in guioptions, then we want to remove it
267 if match(&guioptions, "\\C" . a:option) > -1
268 exec "set go-=" . a:option
269 else
270 exec "set go+=" . a:option
271 endif
272endfun
273
274" Edit/File Settings
275
276" Boolean options
277an 20.440.100 &Edit.F&ile\ Settings.Toggle\ Line\ &Numbering<Tab>:set\ nu! :set nu! nu?<CR>
278an 20.440.110 &Edit.F&ile\ Settings.Toggle\ &List\ Mode<Tab>:set\ list! :set list! list?<CR>
279an 20.440.120 &Edit.F&ile\ Settings.Toggle\ Line\ &Wrap<Tab>:set\ wrap! :set wrap! wrap?<CR>
280an 20.440.130 &Edit.F&ile\ Settings.Toggle\ W&rap\ at\ word<Tab>:set\ lbr! :set lbr! lbr?<CR>
281an 20.440.160 &Edit.F&ile\ Settings.Toggle\ &expand-tab<Tab>:set\ et! :set et! et?<CR>
282an 20.440.170 &Edit.F&ile\ Settings.Toggle\ &auto-indent<Tab>:set\ ai! :set ai! ai?<CR>
283an 20.440.180 &Edit.F&ile\ Settings.Toggle\ &C-indenting<Tab>:set\ cin! :set cin! cin?<CR>
284
285" other options
286an 20.440.600 &Edit.F&ile\ Settings.-SEP2- <Nop>
287an 20.440.610.20 &Edit.F&ile\ Settings.&Shiftwidth.2 :set sw=2 sw?<CR>
288an 20.440.610.30 &Edit.F&ile\ Settings.&Shiftwidth.3 :set sw=3 sw?<CR>
289an 20.440.610.40 &Edit.F&ile\ Settings.&Shiftwidth.4 :set sw=4 sw?<CR>
290an 20.440.610.50 &Edit.F&ile\ Settings.&Shiftwidth.5 :set sw=5 sw?<CR>
291an 20.440.610.60 &Edit.F&ile\ Settings.&Shiftwidth.6 :set sw=6 sw?<CR>
292an 20.440.610.80 &Edit.F&ile\ Settings.&Shiftwidth.8 :set sw=8 sw?<CR>
293
294an 20.440.620.20 &Edit.F&ile\ Settings.Soft\ &Tabstop.2 :set sts=2 sts?<CR>
295an 20.440.620.30 &Edit.F&ile\ Settings.Soft\ &Tabstop.3 :set sts=3 sts?<CR>
296an 20.440.620.40 &Edit.F&ile\ Settings.Soft\ &Tabstop.4 :set sts=4 sts?<CR>
297an 20.440.620.50 &Edit.F&ile\ Settings.Soft\ &Tabstop.5 :set sts=5 sts?<CR>
298an 20.440.620.60 &Edit.F&ile\ Settings.Soft\ &Tabstop.6 :set sts=6 sts?<CR>
299an 20.440.620.80 &Edit.F&ile\ Settings.Soft\ &Tabstop.8 :set sts=8 sts?<CR>
300
301an <silent> 20.440.630 &Edit.F&ile\ Settings.Te&xt\ Width\.\.\. :call <SID>TextWidth()<CR>
302an <silent> 20.440.640 &Edit.F&ile\ Settings.&File\ Format\.\.\. :call <SID>FileFormat()<CR>
303fun! s:TextWidth()
304 if !exists("g:menutrans_textwidth_dialog")
305 let g:menutrans_textwidth_dialog = "Enter new text width (0 to disable formatting): "
306 endif
307 let n = inputdialog(g:menutrans_textwidth_dialog, &tw)
308 if n != ""
309 " remove leading zeros to avoid it being used as an octal number
310 let &tw = substitute(n, "^0*", "", "")
311 endif
312endfun
313
314fun! s:FileFormat()
315 if !exists("g:menutrans_fileformat_dialog")
316 let g:menutrans_fileformat_dialog = "Select format for writing the file"
317 endif
318 if !exists("g:menutrans_fileformat_choices")
319 let g:menutrans_fileformat_choices = "&Unix\n&Dos\n&Mac\n&Cancel"
320 endif
321 if &ff == "dos"
322 let def = 2
323 elseif &ff == "mac"
324 let def = 3
325 else
326 let def = 1
327 endif
328 let n = confirm(g:menutrans_fileformat_dialog, g:menutrans_fileformat_choices, def, "Question")
329 if n == 1
330 set ff=unix
331 elseif n == 2
332 set ff=dos
333 elseif n == 3
334 set ff=mac
335 endif
336endfun
337
338" Setup the Edit.Color Scheme submenu
339let s:n = globpath(&runtimepath, "colors/*.vim")
340let s:idx = 100
341while strlen(s:n) > 0
342 let s:i = stridx(s:n, "\n")
343 if s:i < 0
344 let s:name = s:n
345 let s:n = ""
346 else
347 let s:name = strpart(s:n, 0, s:i)
348 let s:n = strpart(s:n, s:i + 1, 19999)
349 endif
350 " Ignore case for VMS and windows
351 let s:name = substitute(s:name, '\c.*[/\\:\]]\([^/\\:]*\)\.vim', '\1', '')
352 exe "an 20.450." . s:idx . ' &Edit.C&olor\ Scheme.' . s:name . " :colors " . s:name . "<CR>"
353 unlet s:name
354 unlet s:i
355 let s:idx = s:idx + 10
356endwhile
357unlet s:n
358unlet s:idx
359
360" Setup the Edit.Keymap submenu
361if has("keymap")
362 let s:n = globpath(&runtimepath, "keymap/*.vim")
363 if s:n != ""
364 let s:idx = 100
365 an 20.460.90 &Edit.&Keymap.None :set keymap=<CR>
366 while strlen(s:n) > 0
367 let s:i = stridx(s:n, "\n")
368 if s:i < 0
369 let s:name = s:n
370 let s:n = ""
371 else
372 let s:name = strpart(s:n, 0, s:i)
373 let s:n = strpart(s:n, s:i + 1, 19999)
374 endif
375 " Ignore case for VMS and windows
376 let s:name = substitute(s:name, '\c.*[/\\:\]]\([^/\\:_]*\)\(_[0-9a-zA-Z-]*\)\=\.vim', '\1', '')
377 exe "an 20.460." . s:idx . ' &Edit.&Keymap.' . s:name . " :set keymap=" . s:name . "<CR>"
378 unlet s:name
379 unlet s:i
380 let s:idx = s:idx + 10
381 endwhile
382 unlet s:idx
383 endif
384 unlet s:n
385endif
Bram Moolenaardfccaf02004-12-31 20:56:11 +0000386if has("win32") || has("win16") || has("gui_motif") || has("gui_gtk") || has("gui_kde") || has("gui_photon") || has("gui_mac")
Bram Moolenaar071d4272004-06-13 20:20:40 +0000387 an 20.470 &Edit.Select\ Fo&nt\.\.\. :set guifont=*<CR>
388endif
389
390" Programming menu
391if !exists("g:ctags_command")
392 if has("vms")
393 let g:ctags_command = "mc vim:ctags ."
394 else
395 let g:ctags_command = "ctags -R ."
396 endif
397endif
398
399an 40.300 &Tools.&Jump\ to\ this\ tag<Tab>g^] g<C-]>
400vunmenu &Tools.&Jump\ to\ this\ tag<Tab>g^]
401vnoremenu &Tools.&Jump\ to\ this\ tag<Tab>g^] g<C-]>
402an 40.310 &Tools.Jump\ &back<Tab>^T <C-T>
403an 40.320 &Tools.Build\ &Tags\ File :exe "!" . g:ctags_command<CR>
404
405" Tools.Fold Menu
406if has("folding")
407 an 40.330 &Tools.-SEP1- <Nop>
408 " open close folds
409 an 40.340.110 &Tools.&Folding.&Enable/Disable\ folds<Tab>zi zi
410 an 40.340.120 &Tools.&Folding.&View\ Cursor\ Line<Tab>zv zv
411 an 40.340.120 &Tools.&Folding.Vie&w\ Cursor\ Line\ only<Tab>zMzx zMzx
412 an 40.340.130 &Tools.&Folding.C&lose\ more\ folds<Tab>zm zm
413 an 40.340.140 &Tools.&Folding.&Close\ all\ folds<Tab>zM zM
414 an 40.340.150 &Tools.&Folding.O&pen\ more\ folds<Tab>zr zr
415 an 40.340.160 &Tools.&Folding.&Open\ all\ folds<Tab>zR zR
416 " fold method
417 an 40.340.200 &Tools.&Folding.-SEP1- <Nop>
418 an 40.340.210 &Tools.&Folding.Fold\ Met&hod.M&anual :set fdm=manual<CR>
419 an 40.340.210 &Tools.&Folding.Fold\ Met&hod.I&ndent :set fdm=indent<CR>
420 an 40.340.210 &Tools.&Folding.Fold\ Met&hod.E&xpression :set fdm=expr<CR>
421 an 40.340.210 &Tools.&Folding.Fold\ Met&hod.S&yntax :set fdm=syntax<CR>
422 an 40.340.210 &Tools.&Folding.Fold\ Met&hod.&Diff :set fdm=diff<CR>
423 an 40.340.210 &Tools.&Folding.Fold\ Met&hod.Ma&rker :set fdm=marker<CR>
424 " create and delete folds
425 vnoremenu 40.340.220 &Tools.&Folding.Create\ &Fold<Tab>zf zf
426 an 40.340.230 &Tools.&Folding.&Delete\ Fold<Tab>zd zd
427 an 40.340.240 &Tools.&Folding.Delete\ &All\ Folds<Tab>zD zD
428 " moving around in folds
429 an 40.340.300 &Tools.&Folding.-SEP2- <Nop>
430 an 40.340.310.10 &Tools.&Folding.Fold\ col&umn\ width.\ &0\ :set fdc=0<CR>
431 an 40.340.310.20 &Tools.&Folding.Fold\ col&umn\ width.\ &2\ :set fdc=2<CR>
432 an 40.340.310.30 &Tools.&Folding.Fold\ col&umn\ width.\ &3\ :set fdc=3<CR>
433 an 40.340.310.40 &Tools.&Folding.Fold\ col&umn\ width.\ &4\ :set fdc=4<CR>
434 an 40.340.310.50 &Tools.&Folding.Fold\ col&umn\ width.\ &5\ :set fdc=5<CR>
435 an 40.340.310.60 &Tools.&Folding.Fold\ col&umn\ width.\ &6\ :set fdc=6<CR>
436 an 40.340.310.70 &Tools.&Folding.Fold\ col&umn\ width.\ &7\ :set fdc=7<CR>
437 an 40.340.310.80 &Tools.&Folding.Fold\ col&umn\ width.\ &8\ :set fdc=8<CR>
438endif " has folding
439
440if has("diff")
441 an 40.350.100 &Tools.&Diff.&Update :diffupdate<CR>
442 an 40.350.110 &Tools.&Diff.&Get\ Block :diffget<CR>
443 vunmenu &Tools.&Diff.&Get\ Block
444 vnoremenu &Tools.&Diff.&Get\ Block :diffget<CR>
445 an 40.350.120 &Tools.&Diff.&Put\ Block :diffput<CR>
446 vunmenu &Tools.&Diff.&Put\ Block
447 vnoremenu &Tools.&Diff.&Put\ Block :diffput<CR>
448endif
449
450an 40.358 &Tools.-SEP2- <Nop>
451an 40.360 &Tools.&Make<Tab>:make :make<CR>
452an 40.370 &Tools.&List\ Errors<Tab>:cl :cl<CR>
453an 40.380 &Tools.L&ist\ Messages<Tab>:cl! :cl!<CR>
454an 40.390 &Tools.&Next\ Error<Tab>:cn :cn<CR>
455an 40.400 &Tools.&Previous\ Error<Tab>:cp :cp<CR>
456an 40.410 &Tools.&Older\ List<Tab>:cold :colder<CR>
457an 40.420 &Tools.N&ewer\ List<Tab>:cnew :cnewer<CR>
458an 40.430.50 &Tools.Error\ &Window.&Update<Tab>:cwin :cwin<CR>
459an 40.430.60 &Tools.Error\ &Window.&Open<Tab>:copen :copen<CR>
460an 40.430.70 &Tools.Error\ &Window.&Close<Tab>:cclose :cclose<CR>
461
462an 40.520 &Tools.-SEP3- <Nop>
463an <silent> 40.530 &Tools.&Convert\ to\ HEX<Tab>:%!xxd
464 \ :call <SID>XxdConv()<CR>
465an <silent> 40.540 &Tools.Conve&rt\ back<Tab>:%!xxd\ -r
466 \ :call <SID>XxdBack()<CR>
467
468" Use a function to do the conversion, so that it also works with 'insertmode'
469" set.
470func! s:XxdConv()
471 let mod = &mod
472 if has("vms")
473 %!mc vim:xxd
474 else
475 call s:XxdFind()
476 exe '%!"' . g:xxdprogram . '"'
477 endif
478 if getline(1) =~ "^0000000:" " only if it worked
479 set ft=xxd
480 endif
481 let &mod = mod
482endfun
483
484func! s:XxdBack()
485 let mod = &mod
486 if has("vms")
487 %!mc vim:xxd -r
488 else
489 call s:XxdFind()
490 exe '%!"' . g:xxdprogram . '" -r'
491 endif
492 set ft=
493 doautocmd filetypedetect BufReadPost
494 let &mod = mod
495endfun
496
497func! s:XxdFind()
498 if !exists("g:xxdprogram")
499 " On the PC xxd may not be in the path but in the install directory
500 if (has("win32") || has("dos32")) && !executable("xxd")
501 let g:xxdprogram = $VIMRUNTIME . (&shellslash ? '/' : '\') . "xxd.exe"
502 else
503 let g:xxdprogram = "xxd"
504 endif
505 endif
506endfun
507
508" Setup the Tools.Compiler submenu
509let s:n = globpath(&runtimepath, "compiler/*.vim")
510let s:idx = 100
511while strlen(s:n) > 0
512 let s:i = stridx(s:n, "\n")
513 if s:i < 0
514 let s:name = s:n
515 let s:n = ""
516 else
517 let s:name = strpart(s:n, 0, s:i)
518 let s:n = strpart(s:n, s:i + 1, 19999)
519 endif
520 " Ignore case for VMS and windows
521 let s:name = substitute(s:name, '\c.*[/\\:\]]\([^/\\:]*\)\.vim', '\1', '')
522 exe "an 30.440." . s:idx . ' &Tools.&Set\ Compiler.' . s:name . " :compiler " . s:name . "<CR>"
523 unlet s:name
524 unlet s:i
525 let s:idx = s:idx + 10
526endwhile
527unlet s:n
528unlet s:idx
529
530if !exists("no_buffers_menu")
531
532" Buffer list menu -- Setup functions & actions
533
534" wait with building the menu until after loading 'session' files. Makes
535" startup faster.
536let s:bmenu_wait = 1
537
538if !exists("bmenu_priority")
539 let bmenu_priority = 60
540endif
541
542func! s:BMAdd()
543 if s:bmenu_wait == 0
544 " when adding too many buffers, redraw in short format
545 if s:bmenu_count == &menuitems && s:bmenu_short == 0
546 call s:BMShow()
547 else
548 call <SID>BMFilename(expand("<afile>"), expand("<abuf>"))
549 let s:bmenu_count = s:bmenu_count + 1
550 endif
551 endif
552endfunc
553
554func! s:BMRemove()
555 if s:bmenu_wait == 0
556 let name = expand("<afile>")
557 if isdirectory(name)
558 return
559 endif
560 let munge = <SID>BMMunge(name, expand("<abuf>"))
561
562 if s:bmenu_short == 0
563 exe 'silent! aun &Buffers.' . munge
564 else
565 exe 'silent! aun &Buffers.' . <SID>BMHash2(munge) . munge
566 endif
567 let s:bmenu_count = s:bmenu_count - 1
568 endif
569endfunc
570
571" Create the buffer menu (delete an existing one first).
572func! s:BMShow(...)
573 let s:bmenu_wait = 1
574 let s:bmenu_short = 1
575 let s:bmenu_count = 0
576 "
577 " get new priority, if exists
578 if a:0 == 1
579 let g:bmenu_priority = a:1
580 endif
581
582 " remove old menu, if exists; keep one entry to avoid a torn off menu to
583 " disappear.
584 silent! unmenu &Buffers
585 exe 'noremenu ' . g:bmenu_priority . ".1 &Buffers.Dummy l"
586 silent! unmenu! &Buffers
587
588 " create new menu; set 'cpo' to include the <CR>
589 let cpo_save = &cpo
590 set cpo&vim
591 exe 'an <silent> ' . g:bmenu_priority . ".2 &Buffers.&Refresh\\ menu :call <SID>BMShow()<CR>"
592 exe 'an ' . g:bmenu_priority . ".4 &Buffers.&Delete :confirm bd<CR>"
593 exe 'an ' . g:bmenu_priority . ".6 &Buffers.&Alternate :confirm b #<CR>"
594 exe 'an ' . g:bmenu_priority . ".7 &Buffers.&Next :confirm bnext<CR>"
595 exe 'an ' . g:bmenu_priority . ".8 &Buffers.&Previous :confirm bprev<CR>"
596 exe 'an ' . g:bmenu_priority . ".9 &Buffers.-SEP- :"
597 let &cpo = cpo_save
598 unmenu &Buffers.Dummy
599
600 " figure out how many buffers there are
601 let buf = 1
602 while buf <= bufnr('$')
603 if bufexists(buf) && !isdirectory(bufname(buf)) && buflisted(buf)
604 \ && !getbufvar(buf, "&bufsecret")
605 let s:bmenu_count = s:bmenu_count + 1
606 endif
607 let buf = buf + 1
608 endwhile
609 if s:bmenu_count <= &menuitems
610 let s:bmenu_short = 0
611 endif
612
613 " iterate through buffer list, adding each buffer to the menu:
614 let buf = 1
615 while buf <= bufnr('$')
616 if bufexists(buf) && !isdirectory(bufname(buf)) && buflisted(buf)
617 \ && !getbufvar(buf, "&bufsecret")
618 call <SID>BMFilename(bufname(buf), buf)
619 endif
620 let buf = buf + 1
621 endwhile
622 let s:bmenu_wait = 0
623 aug buffer_list
624 au!
625 au BufCreate,BufFilePost * call <SID>BMAdd()
626 au BufDelete,BufFilePre * call <SID>BMRemove()
627 aug END
628endfunc
629
630func! s:BMHash(name)
631 " Make name all upper case, so that chars are between 32 and 96
632 let nm = substitute(a:name, ".*", '\U\0', "")
633 if has("ebcdic")
634 " HACK: Replace all non alphabetics with 'Z'
635 " Just to make it work for now.
636 let nm = substitute(nm, "[^A-Z]", 'Z', "g")
637 let sp = char2nr('A') - 1
638 else
639 let sp = char2nr(' ')
640 endif
641 " convert first six chars into a number for sorting:
642 return (char2nr(nm[0]) - sp) * 0x800000 + (char2nr(nm[1]) - sp) * 0x20000 + (char2nr(nm[2]) - sp) * 0x1000 + (char2nr(nm[3]) - sp) * 0x80 + (char2nr(nm[4]) - sp) * 0x20 + (char2nr(nm[5]) - sp)
643endfunc
644
645func! s:BMHash2(name)
646 let nm = substitute(a:name, ".", '\L\0', "")
647 " Not exactly right for EBCDIC...
648 if nm[0] < 'a' || nm[0] > 'z'
649 return '&others.'
650 elseif nm[0] <= 'd'
651 return '&abcd.'
652 elseif nm[0] <= 'h'
653 return '&efgh.'
654 elseif nm[0] <= 'l'
655 return '&ijkl.'
656 elseif nm[0] <= 'p'
657 return '&mnop.'
658 elseif nm[0] <= 't'
659 return '&qrst.'
660 else
661 return '&u-z.'
662 endif
663endfunc
664
665" insert a buffer name into the buffer menu:
666func! s:BMFilename(name, num)
667 if isdirectory(a:name)
668 return
669 endif
670 let munge = <SID>BMMunge(a:name, a:num)
671 let hash = <SID>BMHash(munge)
672 if s:bmenu_short == 0
673 let name = 'an ' . g:bmenu_priority . '.' . hash . ' &Buffers.' . munge
674 else
675 let name = 'an ' . g:bmenu_priority . '.' . hash . '.' . hash . ' &Buffers.' . <SID>BMHash2(munge) . munge
676 endif
677 " set 'cpo' to include the <CR>
678 let cpo_save = &cpo
679 set cpo&vim
680 exe name . ' :confirm b' . a:num . '<CR>'
681 let &cpo = cpo_save
682endfunc
683
684" Truncate a long path to fit it in a menu item.
685if !exists("g:bmenu_max_pathlen")
686 let g:bmenu_max_pathlen = 35
687endif
688func! s:BMTruncName(fname)
689 let name = a:fname
690 if g:bmenu_max_pathlen < 5
691 let name = ""
692 else
693 let len = strlen(name)
694 if len > g:bmenu_max_pathlen
695 let amountl = (g:bmenu_max_pathlen / 2) - 2
696 let amountr = g:bmenu_max_pathlen - amountl - 3
697 let pattern = '^\(.\{,' . amountl . '}\).\{-}\(.\{,' . amountr . '}\)$'
698 let left = substitute(name, pattern, '\1', '')
699 let right = substitute(name, pattern, '\2', '')
700 if strlen(left) + strlen(right) < len
701 let name = left . '...' . right
702 endif
703 endif
704 endif
705 return name
706endfunc
707
708func! s:BMMunge(fname, bnum)
709 let name = a:fname
710 if name == ''
711 if !exists("g:menutrans_no_file")
712 let g:menutrans_no_file = "[No file]"
713 endif
714 let name = g:menutrans_no_file
715 else
716 let name = fnamemodify(name, ':p:~')
717 endif
718 " detach file name and separate it out:
719 let name2 = fnamemodify(name, ':t')
720 if a:bnum >= 0
721 let name2 = name2 . ' (' . a:bnum . ')'
722 endif
723 let name = name2 . "\t" . <SID>BMTruncName(fnamemodify(name,':h'))
724 let name = escape(name, "\\. \t|")
725 let name = substitute(name, "&", "&&", "g")
726 let name = substitute(name, "\n", "^@", "g")
727 return name
728endfunc
729
730" When just starting Vim, load the buffer menu later
731if has("vim_starting")
732 augroup LoadBufferMenu
733 au! VimEnter * if !exists("no_buffers_menu") | call <SID>BMShow() | endif
734 au VimEnter * au! LoadBufferMenu
735 augroup END
736else
737 call <SID>BMShow()
738endif
739
740endif " !exists("no_buffers_menu")
741
742" Window menu
743an 70.300 &Window.&New<Tab>^Wn <C-W>n
744an 70.310 &Window.S&plit<Tab>^Ws <C-W>s
745an 70.320 &Window.Sp&lit\ To\ #<Tab>^W^^ <C-W><C-^>
746an 70.330 &Window.Split\ &Vertically<Tab>^Wv <C-W>v
747if has("vertsplit")
748 an <silent> 70.332 &Window.Split\ File\ E&xplorer :call MenuExplOpen()<CR>
749 if !exists("*MenuExplOpen")
750 fun MenuExplOpen()
751 if @% == ""
752 20vsp .
753 else
754 exe "20vsp " . expand("%:p:h")
755 endif
756 endfun
757 endif
758endif
759an 70.335 &Window.-SEP1- <Nop>
760an 70.340 &Window.&Close<Tab>^Wc :confirm close<CR>
761an 70.345 &Window.Close\ &Other(s)<Tab>^Wo :confirm only<CR>
762an 70.350 &Window.-SEP2- <Nop>
763an 70.355 &Window.Move\ &To.&Top<Tab>^WK <C-W>K
764an 70.355 &Window.Move\ &To.&Bottom<Tab>^WJ <C-W>J
765an 70.355 &Window.Move\ &To.&Left\ side<Tab>^WH <C-W>H
766an 70.355 &Window.Move\ &To.&Right\ side<Tab>^WL <C-W>L
767an 70.360 &Window.Rotate\ &Up<Tab>^WR <C-W>R
768an 70.362 &Window.Rotate\ &Down<Tab>^Wr <C-W>r
769an 70.365 &Window.-SEP3- <Nop>
770an 70.370 &Window.&Equal\ Size<Tab>^W= <C-W>=
771an 70.380 &Window.&Max\ Height<Tab>^W_ <C-W>_
772an 70.390 &Window.M&in\ Height<Tab>^W1_ <C-W>1_
773an 70.400 &Window.Max\ &Width<Tab>^W\| <C-W>\|
774an 70.410 &Window.Min\ Widt&h<Tab>^W1\| <C-W>1\|
775
776" The popup menu
777an 1.10 PopUp.&Undo u
778an 1.15 PopUp.-SEP1- <Nop>
779vnoremenu 1.20 PopUp.Cu&t "+x
780vnoremenu 1.30 PopUp.&Copy "+y
781cnoremenu 1.30 PopUp.&Copy <C-Y>
782nnoremenu 1.40 PopUp.&Paste "+gP
783cnoremenu 1.40 PopUp.&Paste <C-R>+
784vnoremenu <script> 1.40 PopUp.&Paste <SID>vPaste
785inoremenu <script> 1.40 PopUp.&Paste <SID>iPaste
786vnoremenu 1.50 PopUp.&Delete x
787an 1.55 PopUp.-SEP2- <Nop>
788vnoremenu 1.60 PopUp.Select\ Blockwise <C-V>
Bram Moolenaar293ee4d2004-12-09 21:34:53 +0000789
790nnoremenu 1.70 PopUp.Select\ &Word vaw
791onoremenu 1.70 PopUp.Select\ &Word aw
792vnoremenu 1.70 PopUp.Select\ &Word <C-C>vaw
793inoremenu 1.70 PopUp.Select\ &Word <C-O>vaw
794cnoremenu 1.70 PopUp.Select\ &Word <C-C>vaw
795
796nnoremenu 1.73 PopUp.Select\ &Sentence vas
797onoremenu 1.73 PopUp.Select\ &Sentence as
798vnoremenu 1.73 PopUp.Select\ &Sentence <C-C>vas
799inoremenu 1.73 PopUp.Select\ &Sentence <C-O>vas
800cnoremenu 1.73 PopUp.Select\ &Sentence <C-C>vas
801
802nnoremenu 1.77 PopUp.Select\ Pa&ragraph vap
803onoremenu 1.77 PopUp.Select\ Pa&ragraph ap
804vnoremenu 1.77 PopUp.Select\ Pa&ragraph <C-C>vap
805inoremenu 1.77 PopUp.Select\ Pa&ragraph <C-O>vap
806cnoremenu 1.77 PopUp.Select\ Pa&ragraph <C-C>vap
807
808nnoremenu 1.80 PopUp.Select\ &Line V
809onoremenu 1.80 PopUp.Select\ &Line <C-C>V
810vnoremenu 1.80 PopUp.Select\ &Line <C-C>V
811inoremenu 1.80 PopUp.Select\ &Line <C-O>V
812cnoremenu 1.80 PopUp.Select\ &Line <C-C>V
813
814nnoremenu 1.90 PopUp.Select\ &Block <C-V>
815onoremenu 1.90 PopUp.Select\ &Block <C-C><C-V>
816vnoremenu 1.90 PopUp.Select\ &Block <C-C><C-V>
817inoremenu 1.90 PopUp.Select\ &Block <C-O><C-V>
818cnoremenu 1.90 PopUp.Select\ &Block <C-C><C-V>
819
Bram Moolenaar071d4272004-06-13 20:20:40 +0000820noremenu <script> <silent> 1.100 PopUp.Select\ &All :<C-U>call <SID>SelectAll()<CR>
821inoremenu <script> <silent> 1.100 PopUp.Select\ &All <C-O>:call <SID>SelectAll()<CR>
822cnoremenu <script> <silent> 1.100 PopUp.Select\ &All <C-U>call <SID>SelectAll()<CR>
823
824
825" The GUI toolbar (for MS-Windows and GTK)
826if has("toolbar")
827 an 1.10 ToolBar.Open :browse confirm e<CR>
828 an <silent> 1.20 ToolBar.Save :if expand("%") == ""<Bar>browse confirm w<Bar>else<Bar>confirm w<Bar>endif<CR>
829 an 1.30 ToolBar.SaveAll :browse confirm wa<CR>
830
831 if has("printer")
832 an 1.40 ToolBar.Print :hardcopy<CR>
833 vunmenu ToolBar.Print
834 vnoremenu ToolBar.Print :hardcopy<CR>
835 elseif has("unix")
836 an 1.40 ToolBar.Print :w !lpr<CR>
837 vunmenu ToolBar.Print
838 vnoremenu ToolBar.Print :w !lpr<CR>
839 endif
840
841 an 1.45 ToolBar.-sep1- <Nop>
842 an 1.50 ToolBar.Undo u
843 an 1.60 ToolBar.Redo <C-R>
844
845 an 1.65 ToolBar.-sep2- <Nop>
846 vnoremenu 1.70 ToolBar.Cut "+x
847 vnoremenu 1.80 ToolBar.Copy "+y
848 cnoremenu 1.80 ToolBar.Copy <C-Y>
849 nnoremenu 1.90 ToolBar.Paste "+gP
850 cnoremenu ToolBar.Paste <C-R>+
851 vnoremenu <script> ToolBar.Paste <SID>vPaste
852 inoremenu <script> ToolBar.Paste <SID>iPaste
853
854 if !has("gui_athena")
855 an 1.95 ToolBar.-sep3- <Nop>
856 an 1.100 ToolBar.Find :promptfind<CR>
857 vunmenu ToolBar.Find
858 vnoremenu ToolBar.Find y:promptfind <C-R>"<CR>
859 an 1.110 ToolBar.FindNext n
860 an 1.120 ToolBar.FindPrev N
861 an 1.130 ToolBar.Replace :promptrepl<CR>
862 vunmenu ToolBar.Replace
863 vnoremenu ToolBar.Replace y:promptrepl <C-R>"<CR>
864 endif
865
866if 0 " disabled; These are in the Windows menu
867 an 1.135 ToolBar.-sep4- <Nop>
868 an 1.140 ToolBar.New <C-W>n
869 an 1.150 ToolBar.WinSplit <C-W>s
870 an 1.160 ToolBar.WinMax :resize 200<CR>
871 an 1.170 ToolBar.WinMin :resize 1<CR>
872 an 1.180 ToolBar.WinVSplit <C-W>v
873 an 1.190 ToolBar.WinMaxWidth <C-W>500>
874 an 1.200 ToolBar.WinMinWidth <C-W>1\|
875 an 1.210 ToolBar.WinClose :close<CR>
876endif
877
878 an 1.215 ToolBar.-sep5- <Nop>
879 an <silent> 1.220 ToolBar.LoadSesn :call <SID>LoadVimSesn()<CR>
880 an <silent> 1.230 ToolBar.SaveSesn :call <SID>SaveVimSesn()<CR>
881 an 1.240 ToolBar.RunScript :browse so<CR>
882
883 an 1.245 ToolBar.-sep6- <Nop>
884 an 1.250 ToolBar.Make :make<CR>
885 an 1.270 ToolBar.RunCtags :exe "!" . g:ctags_command<CR>
886 an 1.280 ToolBar.TagJump g<C-]>
887
888 an 1.295 ToolBar.-sep7- <Nop>
889 an 1.300 ToolBar.Help :help<CR>
890 an <silent> 1.310 ToolBar.FindHelp :call <SID>Helpfind()<CR>
891
892" Only set the tooltips here if not done in a language menu file
893if exists("*Do_toolbar_tmenu")
894 call Do_toolbar_tmenu()
895else
896 let did_toolbar_tmenu = 1
897 tmenu ToolBar.Open Open file
898 tmenu ToolBar.Save Save current file
899 tmenu ToolBar.SaveAll Save all files
900 tmenu ToolBar.Print Print
901 tmenu ToolBar.Undo Undo
902 tmenu ToolBar.Redo Redo
903 tmenu ToolBar.Cut Cut to clipboard
904 tmenu ToolBar.Copy Copy to clipboard
905 tmenu ToolBar.Paste Paste from Clipboard
906 if !has("gui_athena")
907 tmenu ToolBar.Find Find...
908 tmenu ToolBar.FindNext Find Next
909 tmenu ToolBar.FindPrev Find Previous
910 tmenu ToolBar.Replace Find / Replace...
911 endif
912 if 0 " disabled; These are in the Windows menu
913 tmenu ToolBar.New New Window
914 tmenu ToolBar.WinSplit Split Window
915 tmenu ToolBar.WinMax Maximise Window
916 tmenu ToolBar.WinMin Minimise Window
917 tmenu ToolBar.WinVSplit Split Window Vertically
918 tmenu ToolBar.WinMaxWidth Maximise Window Width
919 tmenu ToolBar.WinMinWidth Minimise Window Width
920 tmenu ToolBar.WinClose Close Window
921 endif
922 tmenu ToolBar.LoadSesn Load session
923 tmenu ToolBar.SaveSesn Save current session
924 tmenu ToolBar.RunScript Run a Vim Script
925 tmenu ToolBar.Make Make current project
926 tmenu ToolBar.RunCtags Build tags in current directory tree
927 tmenu ToolBar.TagJump Jump to tag under cursor
928 tmenu ToolBar.Help Vim Help
929 tmenu ToolBar.FindHelp Search Vim Help
930endif
931
932" Select a session to load; default to current session name if present
933fun! s:LoadVimSesn()
934 if strlen(v:this_session) > 0
935 let name = v:this_session
936 else
937 let name = "Session.vim"
938 endif
939 execute "browse so " . name
940endfun
941
942" Select a session to save; default to current session name if present
943fun! s:SaveVimSesn()
944 if strlen(v:this_session) == 0
945 let v:this_session = "Session.vim"
946 endif
947 execute "browse mksession! " . v:this_session
948endfun
949
950endif
951
952endif " !exists("did_install_default_menus")
953
954" Define these items always, so that syntax can be switched on when it wasn't.
955" But skip them when the Syntax menu was disabled by the user.
956if !exists("did_install_syntax_menu")
957 an 50.212 &Syntax.&Manual :syn manual<CR>
958 an 50.214 &Syntax.A&utomatic :syn on<CR>
959 an <silent> 50.216 &Syntax.on/off\ for\ &This\ file :call <SID>SynOnOff()<CR>
960 if !exists("*s:SynOnOff")
961 fun s:SynOnOff()
962 if has("syntax_items")
963 syn clear
964 else
965 if !exists("g:syntax_on")
966 syn manual
967 endif
968 set syn=ON
969 endif
970 endfun
971 endif
972endif
973
974
975" Install the Syntax menu only when filetype.vim has been loaded or when
976" manual syntax highlighting is enabled.
977" Avoid installing the Syntax menu twice.
978if (exists("did_load_filetypes") || exists("syntax_on"))
979 \ && !exists("did_install_syntax_menu")
980 let did_install_syntax_menu = 1
981
982" Skip setting up the individual syntax selection menus unless
983" do_syntax_sel_menu is defined (it takes quite a bit of time).
984if exists("do_syntax_sel_menu")
985 runtime! synmenu.vim
986else
987 an 50.10 &Syntax.&Show\ filetypes\ in\ menu :let do_syntax_sel_menu = 1<Bar>runtime! synmenu.vim<Bar>aunmenu &Syntax.&Show\ filetypes\ in\ menu<CR>
988 an 50.195 &Syntax.-SEP1- <Nop>
989endif
990
991an 50.210 &Syntax.&Off :syn off<CR>
992an 50.700 &Syntax.-SEP3- <Nop>
993an 50.710 &Syntax.Co&lor\ test :sp $VIMRUNTIME/syntax/colortest.vim<Bar>so %<CR>
994an 50.720 &Syntax.&Highlight\ test :runtime syntax/hitest.vim<CR>
995an 50.730 &Syntax.&Convert\ to\ HTML :runtime syntax/2html.vim<CR>
996
997endif " !exists("did_install_syntax_menu")
998
999" Restore the previous value of 'cpoptions'.
1000let &cpo = s:cpo_save
1001unlet s:cpo_save
1002
1003" vim: set sw=2 :