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