menu.vim (42935B)
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: The Vim Project <https://github.com/vim/vim> 5 " Last Change: 2026 Jan 19 6 " Former Maintainer: Bram Moolenaar <Bram@vim.org> 7 8 " Note that ":an" (short for ":anoremenu") is often used to make a menu work 9 " in all modes and avoid side effects from mappings defined by the user. 10 11 " Make sure the '<' and 'C' flags are not included in 'cpoptions', otherwise 12 " <CR> would not be recognized. See ":help 'cpoptions'". 13 let s:cpo_save = &cpo 14 set cpo&vim 15 16 " Avoid installing the menus twice 17 if !exists("did_install_default_menus") 18 let did_install_default_menus = 1 19 20 21 if exists("v:lang") || &langmenu != "" 22 " Try to find a menu translation file for the current language. 23 if &langmenu != "" 24 if &langmenu =~ "none" 25 let s:lang = "" 26 else 27 let s:lang = &langmenu 28 endif 29 else 30 let s:lang = v:lang 31 endif 32 " A language name must be at least two characters, don't accept "C" 33 " Also skip "en_US" to avoid picking up "en_gb" translations. 34 if strlen(s:lang) > 1 && s:lang !~? '^en_us' 35 " When the language does not include the charset add 'encoding' 36 if s:lang =~ '^\a\a$\|^\a\a_\a\a$' 37 let s:lang = s:lang . '.' . &enc 38 endif 39 40 " We always use a lowercase name. 41 " Change "iso-8859" to "iso_8859" and "iso8859" to "iso_8859", some 42 " systems appear to use this. 43 " Change spaces to underscores. 44 let s:lang = substitute(tolower(s:lang), '\.iso-', ".iso_", "") 45 let s:lang = substitute(s:lang, '\.iso8859', ".iso_8859", "") 46 let s:lang = substitute(s:lang, " ", "_", "g") 47 " Remove "@euro", otherwise "LC_ALL=de_DE@euro gvim" will show English menus 48 let s:lang = substitute(s:lang, "@euro", "", "") 49 " Change "iso_8859-1" and "iso_8859-15" to "latin1", we always use the 50 " same menu file for them. 51 let s:lang = substitute(s:lang, 'iso_8859-15\=$', "latin1", "") 52 menutrans clear 53 exe "runtime! lang/menu_" . s:lang . ".vim" 54 55 if !exists("did_menu_trans") 56 " There is no exact match, try matching with a wildcard added 57 " (e.g. find menu_de_de.iso_8859-1.vim if s:lang == de_DE). 58 let s:lang = substitute(s:lang, '\.[^.]*', "", "") 59 exe "runtime! lang/menu_" . s:lang . "[^a-z]*vim" 60 61 if !exists("did_menu_trans") && s:lang =~ '_' 62 " If the language includes a region try matching without that region. 63 " (e.g. find menu_de.vim if s:lang == de_DE). 64 let langonly = substitute(s:lang, '_.*', "", "") 65 exe "runtime! lang/menu_" . langonly . "[^a-z]*vim" 66 endif 67 68 if !exists("did_menu_trans") && strlen($LANG) > 1 && s:lang !~ '^en_us' 69 " On windows locale names are complicated, try using $LANG, it might 70 " have been set by set_init_1(). But don't do this for "en" or "en_us". 71 " But don't match "slovak" when $LANG is "sl". 72 exe "runtime! lang/menu_" . tolower($LANG) . "[^a-z]*vim" 73 endif 74 endif 75 endif 76 endif 77 78 79 " Help menu 80 an 9999.10 &Help.&Overview<Tab><F1> :help<CR> 81 an 9999.20 &Help.&User\ Manual :help usr_toc<CR> 82 an 9999.30 &Help.&How-To\ Links :help how-to<CR> 83 an <silent> 9999.40 &Help.&Find\.\.\. :call <SID>Helpfind()<CR> 84 an 9999.45 &Help.-sep1- <Nop> 85 an 9999.50 &Help.&Credits :help credits<CR> 86 an 9999.60 &Help.Co&pying :help copying<CR> 87 an 9999.70 &Help.&Sponsor :help sponsor<CR> 88 an 9999.70 &Help.O&rphans :help kcc<CR> 89 an 9999.75 &Help.-sep2- <Nop> 90 an 9999.80 &Help.&Version :version<CR> 91 an 9999.90 &Help.&About :intro<CR> 92 93 if exists(':tlmenu') 94 tlnoremenu 9999.10 &Help.&Overview<Tab><F1> <C-W>:help<CR> 95 tlnoremenu 9999.20 &Help.&User\ Manual <C-W>:help usr_toc<CR> 96 tlnoremenu 9999.30 &Help.&How-To\ Links <C-W>:help how-to<CR> 97 tlnoremenu <silent> 9999.40 &Help.&Find\.\.\. <C-W>:call <SID>Helpfind()<CR> 98 tlnoremenu 9999.45 &Help.-sep1- <Nop> 99 tlnoremenu 9999.50 &Help.&Credits <C-W>:help credits<CR> 100 tlnoremenu 9999.60 &Help.Co&pying <C-W>:help copying<CR> 101 tlnoremenu 9999.70 &Help.&Sponsor <C-W>:help sponsor<CR> 102 tlnoremenu 9999.70 &Help.O&rphans <C-W>:help kcc<CR> 103 tlnoremenu 9999.75 &Help.-sep2- <Nop> 104 tlnoremenu 9999.80 &Help.&Version <C-W>:version<CR> 105 tlnoremenu 9999.90 &Help.&About <C-W>:intro<CR> 106 endif 107 108 fun! s:Helpfind() 109 if !exists("g:menutrans_help_dialog") 110 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')" 111 endif 112 let h = inputdialog(g:menutrans_help_dialog) 113 if h != "" 114 let v:errmsg = "" 115 silent! exe "help " . h 116 if v:errmsg != "" 117 echo v:errmsg 118 endif 119 endif 120 endfun 121 122 " File menu 123 an 10.310 &File.&Open\.\.\.<Tab>:e :browse confirm e<CR> 124 an 10.320 &File.Sp&lit-Open\.\.\.<Tab>:sp :browse sp<CR> 125 an 10.320 &File.Open\ &Tab\.\.\.<Tab>:tabnew :browse tabnew<CR> 126 an 10.325 &File.&New<Tab>:enew :confirm enew<CR> 127 an <silent> 10.330 &File.&Close<Tab>:close 128 \ :if winheight(2) < 0 && tabpagewinnr(2) == 0 <Bar> 129 \ confirm enew <Bar> 130 \ else <Bar> 131 \ confirm close <Bar> 132 \ endif<CR> 133 an 10.335 &File.-SEP1- <Nop> 134 an <silent> 10.340 &File.&Save<Tab>:w :if expand("%") == ""<Bar>browse confirm w<Bar>else<Bar>confirm w<Bar>endif<CR> 135 an 10.350 &File.Save\ &As\.\.\.<Tab>:sav :browse confirm saveas<CR> 136 137 if has("diff") 138 an 10.400 &File.-SEP2- <Nop> 139 an 10.410 &File.Split\ &Diff\ With\.\.\. :browse vert diffsplit<CR> 140 an 10.420 &File.Split\ Patched\ &By\.\.\. :browse vert diffpatch<CR> 141 endif 142 143 if has("unix") 144 an 10.500 &File.-SEP3- <Nop> 145 an 10.510 &File.&Print :w !lpr<CR> 146 vunmenu &File.&Print 147 vnoremenu &File.&Print :w !lpr<CR> 148 endif 149 an 10.600 &File.-SEP4- <Nop> 150 an 10.610 &File.Sa&ve-Exit<Tab>:wqa :confirm wqa<CR> 151 an 10.620 &File.E&xit<Tab>:qa :confirm qa<CR> 152 153 func s:SelectAll() 154 exe "norm! gg" . (&slm == "" ? "VG" : "gH\<C-O>G") 155 endfunc 156 157 func s:FnameEscape(fname) 158 if exists('*fnameescape') 159 return fnameescape(a:fname) 160 endif 161 return escape(a:fname, " \t\n*?[{`$\\%#'\"|!<") 162 endfunc 163 164 " Edit menu 165 an 20.310 &Edit.&Undo<Tab>u u 166 an 20.320 &Edit.&Redo<Tab>^R <C-R> 167 an 20.330 &Edit.Rep&eat<Tab>\. . 168 169 an 20.335 &Edit.-SEP1- <Nop> 170 vnoremenu 20.340 &Edit.Cu&t<Tab>"+x "+x 171 vnoremenu 20.350 &Edit.&Copy<Tab>"+y "+y 172 cnoremenu 20.350 &Edit.&Copy<Tab>"+y <C-Y> 173 if exists(':tlmenu') 174 tlnoremenu 20.350 &Edit.&Copy<Tab>"+y <C-W>:<C-Y><CR> 175 endif 176 nnoremenu 20.360 &Edit.&Paste<Tab>"+gP "+gP 177 cnoremenu &Edit.&Paste<Tab>"+gP <C-R>+ 178 if exists(':tlmenu') 179 tlnoremenu &Edit.&Paste<Tab>"+gP <C-W>"+ 180 endif 181 exe 'vnoremenu <script> &Edit.&Paste<Tab>"+gP ' . paste#paste_cmd['v'] 182 exe 'inoremenu <script> &Edit.&Paste<Tab>"+gP ' . paste#paste_cmd['i'] 183 nnoremenu 20.370 &Edit.Put\ &Before<Tab>[p [p 184 inoremenu &Edit.Put\ &Before<Tab>[p <C-O>[p 185 nnoremenu 20.380 &Edit.Put\ &After<Tab>]p ]p 186 inoremenu &Edit.Put\ &After<Tab>]p <C-O>]p 187 if has("win32") 188 vnoremenu 20.390 &Edit.&Delete<Tab>x x 189 endif 190 noremenu <script> <silent> 20.400 &Edit.&Select\ All<Tab>ggVG :<C-U>call <SID>SelectAll()<CR> 191 inoremenu <script> <silent> 20.400 &Edit.&Select\ All<Tab>ggVG <C-O>:call <SID>SelectAll()<CR> 192 cnoremenu <script> <silent> 20.400 &Edit.&Select\ All<Tab>ggVG <C-U>call <SID>SelectAll()<CR> 193 194 an 20.405 &Edit.-SEP2- <Nop> 195 if has("win32") || has("gui_gtk") || has("gui_kde") || has("gui_motif") 196 an 20.410 &Edit.&Find\.\.\. :promptfind<CR> 197 vunmenu &Edit.&Find\.\.\. 198 vnoremenu <silent> &Edit.&Find\.\.\. y:promptfind <C-R>=<SID>FixFText()<CR><CR> 199 an 20.420 &Edit.Find\ and\ Rep&lace\.\.\. :promptrepl<CR> 200 vunmenu &Edit.Find\ and\ Rep&lace\.\.\. 201 vnoremenu <silent> &Edit.Find\ and\ Rep&lace\.\.\. y:promptrepl <C-R>=<SID>FixFText()<CR><CR> 202 else 203 an 20.410 &Edit.&Find<Tab>/ / 204 an 20.420 &Edit.Find\ and\ Rep&lace<Tab>:%s :%s/ 205 vunmenu &Edit.Find\ and\ Rep&lace<Tab>:%s 206 vnoremenu &Edit.Find\ and\ Rep&lace<Tab>:s :s/ 207 endif 208 209 an 20.425 &Edit.-SEP3- <Nop> 210 an 20.430 &Edit.Settings\ &Window :options<CR> 211 an 20.435 &Edit.Startup\ &Settings :call <SID>EditVimrc()<CR> 212 213 fun! s:EditVimrc() 214 if $MYVIMRC != '' 215 let fname = $MYVIMRC 216 elseif has("win32") 217 if $HOME != '' 218 let fname = $HOME . "/_vimrc" 219 else 220 let fname = $VIM . "/_vimrc" 221 endif 222 elseif has("amiga") 223 let fname = "s:.vimrc" 224 else 225 let fname = $HOME . "/.vimrc" 226 endif 227 let fname = s:FnameEscape(fname) 228 if &mod 229 exe "split " . fname 230 else 231 exe "edit " . fname 232 endif 233 endfun 234 235 fun! s:FixFText() 236 " Fix text in nameless register to be used with :promptfind. 237 return substitute(@", "[\r\n]", '\\n', 'g') 238 endfun 239 240 " Edit/Global Settings 241 an 20.440.100 &Edit.&Global\ Settings.Toggle\ Pattern\ &Highlight<Tab>:set\ hls! :set hls! hls?<CR> 242 an 20.440.110 &Edit.&Global\ Settings.Toggle\ &Ignoring\ Case<Tab>:set\ ic! :set ic! ic?<CR> 243 an 20.440.110 &Edit.&Global\ Settings.Toggle\ &Showing\ Matched\ Pairs<Tab>:set\ sm! :set sm! sm?<CR> 244 245 an 20.440.120 &Edit.&Global\ Settings.&Context\ Lines.\ 1\ :set so=1<CR> 246 an 20.440.120 &Edit.&Global\ Settings.&Context\ Lines.\ 2\ :set so=2<CR> 247 an 20.440.120 &Edit.&Global\ Settings.&Context\ Lines.\ 3\ :set so=3<CR> 248 an 20.440.120 &Edit.&Global\ Settings.&Context\ Lines.\ 4\ :set so=4<CR> 249 an 20.440.120 &Edit.&Global\ Settings.&Context\ Lines.\ 5\ :set so=5<CR> 250 an 20.440.120 &Edit.&Global\ Settings.&Context\ Lines.\ 7\ :set so=7<CR> 251 an 20.440.120 &Edit.&Global\ Settings.&Context\ Lines.\ 10\ :set so=10<CR> 252 an 20.440.120 &Edit.&Global\ Settings.&Context\ Lines.\ 100\ :set so=100<CR> 253 254 an 20.440.130.40 &Edit.&Global\ Settings.&Virtual\ Edit.Never :set ve=<CR> 255 an 20.440.130.50 &Edit.&Global\ Settings.&Virtual\ Edit.Block\ Selection :set ve=block<CR> 256 an 20.440.130.60 &Edit.&Global\ Settings.&Virtual\ Edit.Insert\ Mode :set ve=insert<CR> 257 an 20.440.130.70 &Edit.&Global\ Settings.&Virtual\ Edit.Block\ and\ Insert :set ve=block,insert<CR> 258 an 20.440.130.80 &Edit.&Global\ Settings.&Virtual\ Edit.Always :set ve=all<CR> 259 an 20.440.140 &Edit.&Global\ Settings.Toggle\ Insert\ &Mode<Tab>:set\ im! :set im!<CR> 260 an 20.440.145 &Edit.&Global\ Settings.Toggle\ Vi\ C&ompatibility<Tab>:set\ cp! :set cp!<CR> 261 an <silent> 20.440.150 &Edit.&Global\ Settings.Search\ &Path\.\.\. :call <SID>SearchP()<CR> 262 an <silent> 20.440.160 &Edit.&Global\ Settings.Ta&g\ Files\.\.\. :call <SID>TagFiles()<CR> 263 " 264 " GUI options 265 an 20.440.300 &Edit.&Global\ Settings.-SEP1- <Nop> 266 an <silent> 20.440.310 &Edit.&Global\ Settings.Toggle\ &Toolbar :call <SID>ToggleGuiOption("T")<CR> 267 an <silent> 20.440.320 &Edit.&Global\ Settings.Toggle\ &Bottom\ Scrollbar :call <SID>ToggleGuiOption("b")<CR> 268 an <silent> 20.440.330 &Edit.&Global\ Settings.Toggle\ &Left\ Scrollbar :call <SID>ToggleGuiOption("l")<CR> 269 an <silent> 20.440.340 &Edit.&Global\ Settings.Toggle\ &Right\ Scrollbar :call <SID>ToggleGuiOption("r")<CR> 270 271 fun! s:SearchP() 272 if !exists("g:menutrans_path_dialog") 273 let g:menutrans_path_dialog = "Enter search path for files.\nSeparate directory names with a comma." 274 endif 275 let n = inputdialog(g:menutrans_path_dialog, substitute(&path, '\\ ', ' ', 'g')) 276 if n != "" 277 let &path = substitute(n, ' ', '\\ ', 'g') 278 endif 279 endfun 280 281 fun! s:TagFiles() 282 if !exists("g:menutrans_tags_dialog") 283 let g:menutrans_tags_dialog = "Enter names of tag files.\nSeparate the names with a comma." 284 endif 285 let n = inputdialog(g:menutrans_tags_dialog, substitute(&tags, '\\ ', ' ', 'g')) 286 if n != "" 287 let &tags = substitute(n, ' ', '\\ ', 'g') 288 endif 289 endfun 290 291 fun! s:ToggleGuiOption(option) 292 " If a:option is already set in guioptions, then we want to remove it 293 if match(&guioptions, "\\C" . a:option) > -1 294 exec "set go-=" . a:option 295 else 296 exec "set go+=" . a:option 297 endif 298 endfun 299 300 " Edit/File Settings 301 302 " Boolean options 303 an 20.440.100 &Edit.F&ile\ Settings.Toggle\ Line\ &Numbering<Tab>:set\ nu! :set nu! nu?<CR> 304 an 20.440.105 &Edit.F&ile\ Settings.Toggle\ Relati&ve\ Line\ Numbering<Tab>:set\ rnu! :set rnu! rnu?<CR> 305 an 20.440.110 &Edit.F&ile\ Settings.Toggle\ &List\ Mode<Tab>:set\ list! :set list! list?<CR> 306 an 20.440.120 &Edit.F&ile\ Settings.Toggle\ Line\ &Wrapping<Tab>:set\ wrap! :set wrap! wrap?<CR> 307 an 20.440.130 &Edit.F&ile\ Settings.Toggle\ W&rapping\ at\ Word<Tab>:set\ lbr! :set lbr! lbr?<CR> 308 an 20.440.160 &Edit.F&ile\ Settings.Toggle\ Tab\ &Expanding<Tab>:set\ et! :set et! et?<CR> 309 an 20.440.170 &Edit.F&ile\ Settings.Toggle\ &Auto\ Indenting<Tab>:set\ ai! :set ai! ai?<CR> 310 an 20.440.180 &Edit.F&ile\ Settings.Toggle\ &C-Style\ Indenting<Tab>:set\ cin! :set cin! cin?<CR> 311 312 " other options 313 an 20.440.600 &Edit.F&ile\ Settings.-SEP2- <Nop> 314 an 20.440.610.20 &Edit.F&ile\ Settings.&Shiftwidth.2 :set sw=2 sw?<CR> 315 an 20.440.610.30 &Edit.F&ile\ Settings.&Shiftwidth.3 :set sw=3 sw?<CR> 316 an 20.440.610.40 &Edit.F&ile\ Settings.&Shiftwidth.4 :set sw=4 sw?<CR> 317 an 20.440.610.50 &Edit.F&ile\ Settings.&Shiftwidth.5 :set sw=5 sw?<CR> 318 an 20.440.610.60 &Edit.F&ile\ Settings.&Shiftwidth.6 :set sw=6 sw?<CR> 319 an 20.440.610.80 &Edit.F&ile\ Settings.&Shiftwidth.8 :set sw=8 sw?<CR> 320 321 an 20.440.620.20 &Edit.F&ile\ Settings.Soft\ &Tabstop.2 :set sts=2 sts?<CR> 322 an 20.440.620.30 &Edit.F&ile\ Settings.Soft\ &Tabstop.3 :set sts=3 sts?<CR> 323 an 20.440.620.40 &Edit.F&ile\ Settings.Soft\ &Tabstop.4 :set sts=4 sts?<CR> 324 an 20.440.620.50 &Edit.F&ile\ Settings.Soft\ &Tabstop.5 :set sts=5 sts?<CR> 325 an 20.440.620.60 &Edit.F&ile\ Settings.Soft\ &Tabstop.6 :set sts=6 sts?<CR> 326 an 20.440.620.80 &Edit.F&ile\ Settings.Soft\ &Tabstop.8 :set sts=8 sts?<CR> 327 328 an <silent> 20.440.630 &Edit.F&ile\ Settings.Te&xt\ Width\.\.\. :call <SID>TextWidth()<CR> 329 an <silent> 20.440.640 &Edit.F&ile\ Settings.&File\ Format\.\.\. :call <SID>FileFormat()<CR> 330 fun! s:TextWidth() 331 if !exists("g:menutrans_textwidth_dialog") 332 let g:menutrans_textwidth_dialog = "Enter new text width (0 to disable formatting): " 333 endif 334 let n = inputdialog(g:menutrans_textwidth_dialog, &tw) 335 if n != "" 336 " Remove leading zeros to avoid it being used as an octal number. 337 " But keep a zero by itself. 338 let tw = substitute(n, "^0*", "", "") 339 let &tw = tw == '' ? 0 : tw 340 endif 341 endfun 342 343 fun! s:FileFormat() 344 if !exists("g:menutrans_fileformat_dialog") 345 let g:menutrans_fileformat_dialog = "Select format for writing the file" 346 endif 347 if !exists("g:menutrans_fileformat_choices") 348 let g:menutrans_fileformat_choices = "&Unix\n&Dos\n&Mac\n&Cancel" 349 endif 350 if &ff == "dos" 351 let def = 2 352 elseif &ff == "mac" 353 let def = 3 354 else 355 let def = 1 356 endif 357 let n = confirm(g:menutrans_fileformat_dialog, g:menutrans_fileformat_choices, def, "Question") 358 if n == 1 359 set ff=unix 360 elseif n == 2 361 set ff=dos 362 elseif n == 3 363 set ff=mac 364 endif 365 endfun 366 367 let s:did_setup_color_schemes = 0 368 369 " Setup the Edit.Color Scheme submenu 370 func s:SetupColorSchemes() abort 371 if s:did_setup_color_schemes 372 return 373 endif 374 let s:did_setup_color_schemes = 1 375 376 let n = globpath(&runtimepath, "colors/*.vim", 1, 1) 377 let n += globpath(&packpath, "pack/*/start/*/colors/*.vim", 1, 1) 378 let n += globpath(&packpath, "pack/*/opt/*/colors/*.vim", 1, 1) 379 380 " Ignore case for VMS and windows, sort on name 381 let names = sort(map(n, 'substitute(v:val, "\\c.*[/\\\\:\\]]\\([^/\\\\:]*\\)\\.vim", "\\1", "")'), 1) 382 383 " define all the submenu entries 384 let idx = 100 385 for name in names 386 exe "an 20.450." . idx . ' &Edit.C&olor\ Scheme.' . name . " :colors " . name . "<CR>" 387 let idx = idx + 10 388 endfor 389 silent! aunmenu &Edit.Show\ C&olor\ Schemes\ in\ Menu 390 endfun 391 if exists("do_no_lazyload_menus") 392 call s:SetupColorSchemes() 393 else 394 an <silent> 20.450 &Edit.Show\ C&olor\ Schemes\ in\ Menu :call <SID>SetupColorSchemes()<CR> 395 endif 396 397 398 " Setup the Edit.Keymap submenu 399 if has("keymap") 400 let s:did_setup_keymaps = 0 401 402 func s:SetupKeymaps() abort 403 if s:did_setup_keymaps 404 return 405 endif 406 let s:did_setup_keymaps = 1 407 408 let n = globpath(&runtimepath, "keymap/*.vim", 1, 1) 409 if !empty(n) 410 let idx = 100 411 an 20.460.90 &Edit.&Keymap.None :set keymap=<CR> 412 for name in n 413 " Ignore case for VMS and windows 414 let name = substitute(name, '\c.*[/\\:\]]\([^/\\:_]*\)\(_[0-9a-zA-Z-]*\)\=\.vim', '\1', '') 415 exe "an 20.460." . idx . ' &Edit.&Keymap.' . name . " :set keymap=" . name . "<CR>" 416 let idx = idx + 10 417 endfor 418 endif 419 silent! aunmenu &Edit.Show\ &Keymaps\ in\ Menu 420 endfun 421 if exists("do_no_lazyload_menus") 422 call s:SetupKeymaps() 423 else 424 an <silent> 20.460 &Edit.Show\ &Keymaps\ in\ Menu :call <SID>SetupKeymaps()<CR> 425 endif 426 endif 427 if has("win32") || has("gui_motif") || has("gui_gtk") || has("gui_kde") || has("gui_photon") || has("gui_mac") 428 an 20.470 &Edit.Select\ Fo&nt\.\.\. :set guifont=*<CR> 429 endif 430 431 " Programming menu 432 if !exists("g:ctags_command") 433 if has("vms") 434 let g:ctags_command = "mc vim:ctags *.*" 435 else 436 let g:ctags_command = "ctags -R ." 437 endif 438 endif 439 440 an 40.300 &Tools.&Jump\ to\ This\ Tag<Tab>g^] g<C-]> 441 vunmenu &Tools.&Jump\ to\ This\ Tag<Tab>g^] 442 vnoremenu &Tools.&Jump\ to\ This\ Tag<Tab>g^] g<C-]> 443 an 40.310 &Tools.Jump\ &Back<Tab>^T <C-T> 444 an 40.320 &Tools.Build\ &Tags\ File :exe "!" . g:ctags_command<CR> 445 446 if has("folding") || has("spell") 447 an 40.330 &Tools.-SEP1- <Nop> 448 endif 449 450 " Tools.Spelling Menu 451 if has("spell") 452 an 40.335.110 &Tools.&Spelling.&Spell\ Check\ On :set spell<CR> 453 an 40.335.120 &Tools.&Spelling.Spell\ Check\ &Off :set nospell<CR> 454 an 40.335.130 &Tools.&Spelling.To\ &Next\ Error<Tab>]s ]s 455 an 40.335.130 &Tools.&Spelling.To\ &Previous\ Error<Tab>[s [s 456 an 40.335.140 &Tools.&Spelling.Suggest\ &Corrections<Tab>z= z= 457 an 40.335.150 &Tools.&Spelling.&Repeat\ Correction<Tab>:spellrepall :spellrepall<CR> 458 an 40.335.200 &Tools.&Spelling.-SEP1- <Nop> 459 an 40.335.210 &Tools.&Spelling.Set\ Language\ to\ "en" :set spl=en spell<CR> 460 an 40.335.220 &Tools.&Spelling.Set\ Language\ to\ "en_au" :set spl=en_au spell<CR> 461 an 40.335.230 &Tools.&Spelling.Set\ Language\ to\ "en_ca" :set spl=en_ca spell<CR> 462 an 40.335.240 &Tools.&Spelling.Set\ Language\ to\ "en_gb" :set spl=en_gb spell<CR> 463 an 40.335.250 &Tools.&Spelling.Set\ Language\ to\ "en_nz" :set spl=en_nz spell<CR> 464 an 40.335.260 &Tools.&Spelling.Set\ Language\ to\ "en_us" :set spl=en_us spell<CR> 465 an <silent> 40.335.270 &Tools.&Spelling.&Find\ More\ Languages :call <SID>SpellLang()<CR> 466 467 let s:undo_spelllang = ['aun &Tools.&Spelling.&Find\ More\ Languages'] 468 func s:SpellLang() 469 for cmd in s:undo_spelllang 470 exe "silent! " . cmd 471 endfor 472 let s:undo_spelllang = [] 473 474 if &enc == "iso-8859-15" 475 let enc = "latin1" 476 else 477 let enc = &enc 478 endif 479 480 if !exists("g:menutrans_set_lang_to") 481 let g:menutrans_set_lang_to = 'Set Language to' 482 endif 483 484 let found = 0 485 let s = globpath(&runtimepath, "spell/*." . enc . ".spl", 1, 1) 486 if !empty(s) 487 let n = 300 488 for f in s 489 let nm = substitute(f, '.*spell[/\\]\(..\)\.[^/\\]*\.spl', '\1', "") 490 if nm != "en" && nm !~ '/' 491 let _nm = nm 492 let found += 1 493 let menuname = '&Tools.&Spelling.' . escape(g:menutrans_set_lang_to, "\\. \t|") . '\ "' . nm . '"' 494 exe 'an 40.335.' . n . ' ' . menuname . ' :set spl=' . nm . ' spell<CR>' 495 let s:undo_spelllang += ['aun ' . menuname] 496 endif 497 let n += 10 498 endfor 499 endif 500 if found == 0 501 echomsg "Could not find other spell files" 502 elseif found == 1 503 echomsg "Found spell file " . _nm 504 else 505 echomsg "Found " . found . " more spell files" 506 endif 507 " Need to redo this when 'encoding' is changed. 508 augroup spellmenu 509 au! EncodingChanged * call <SID>SpellLang() 510 augroup END 511 endfun 512 513 endif 514 515 " Tools.Fold Menu 516 if has("folding") 517 " open close folds 518 an 40.340.110 &Tools.&Folding.&Enable/Disable\ Folds<Tab>zi zi 519 an 40.340.120 &Tools.&Folding.&View\ Cursor\ Line<Tab>zv zv 520 an 40.340.120 &Tools.&Folding.Vie&w\ Cursor\ Line\ Only<Tab>zMzx zMzx 521 inoremenu 40.340.120 &Tools.&Folding.Vie&w\ Cursor\ Line\ Only<Tab>zMzx <C-O>zM<C-O>zx 522 an 40.340.130 &Tools.&Folding.C&lose\ More\ Folds<Tab>zm zm 523 an 40.340.140 &Tools.&Folding.&Close\ All\ Folds<Tab>zM zM 524 an 40.340.150 &Tools.&Folding.O&pen\ More\ Folds<Tab>zr zr 525 an 40.340.160 &Tools.&Folding.&Open\ All\ Folds<Tab>zR zR 526 " fold method 527 an 40.340.200 &Tools.&Folding.-SEP1- <Nop> 528 an 40.340.210 &Tools.&Folding.Fold\ Met&hod.M&anual :set fdm=manual<CR> 529 an 40.340.210 &Tools.&Folding.Fold\ Met&hod.I&ndent :set fdm=indent<CR> 530 an 40.340.210 &Tools.&Folding.Fold\ Met&hod.E&xpression :set fdm=expr<CR> 531 an 40.340.210 &Tools.&Folding.Fold\ Met&hod.S&yntax :set fdm=syntax<CR> 532 an 40.340.210 &Tools.&Folding.Fold\ Met&hod.&Diff :set fdm=diff<CR> 533 an 40.340.210 &Tools.&Folding.Fold\ Met&hod.Ma&rker :set fdm=marker<CR> 534 " create and delete folds 535 vnoremenu 40.340.220 &Tools.&Folding.Create\ &Fold<Tab>zf zf 536 an 40.340.230 &Tools.&Folding.&Delete\ Fold<Tab>zd zd 537 an 40.340.240 &Tools.&Folding.Delete\ &All\ Folds<Tab>zD zD 538 " moving around in folds 539 an 40.340.300 &Tools.&Folding.-SEP2- <Nop> 540 an 40.340.310.10 &Tools.&Folding.Fold\ Col&umn\ Width.\ &0\ :set fdc=0<CR> 541 an 40.340.310.20 &Tools.&Folding.Fold\ Col&umn\ Width.\ &2\ :set fdc=2<CR> 542 an 40.340.310.30 &Tools.&Folding.Fold\ Col&umn\ Width.\ &3\ :set fdc=3<CR> 543 an 40.340.310.40 &Tools.&Folding.Fold\ Col&umn\ Width.\ &4\ :set fdc=4<CR> 544 an 40.340.310.50 &Tools.&Folding.Fold\ Col&umn\ Width.\ &5\ :set fdc=5<CR> 545 an 40.340.310.60 &Tools.&Folding.Fold\ Col&umn\ Width.\ &6\ :set fdc=6<CR> 546 an 40.340.310.70 &Tools.&Folding.Fold\ Col&umn\ Width.\ &7\ :set fdc=7<CR> 547 an 40.340.310.80 &Tools.&Folding.Fold\ Col&umn\ Width.\ &8\ :set fdc=8<CR> 548 endif " has folding 549 550 if has("diff") 551 an 40.350.100 &Tools.&Diff.&Update :diffupdate<CR> 552 an 40.350.110 &Tools.&Diff.&Get\ Block :diffget<CR> 553 vunmenu &Tools.&Diff.&Get\ Block 554 vnoremenu &Tools.&Diff.&Get\ Block :diffget<CR> 555 an 40.350.120 &Tools.&Diff.&Put\ Block :diffput<CR> 556 vunmenu &Tools.&Diff.&Put\ Block 557 vnoremenu &Tools.&Diff.&Put\ Block :diffput<CR> 558 endif 559 560 an 40.358 &Tools.-SEP2- <Nop> 561 an 40.360 &Tools.&Make<Tab>:make :make<CR> 562 an 40.370 &Tools.&List\ Errors<Tab>:cl :cl<CR> 563 an 40.380 &Tools.L&ist\ Messages<Tab>:cl! :cl!<CR> 564 an 40.390 &Tools.&Next\ Error<Tab>:cn :cn<CR> 565 an 40.400 &Tools.&Previous\ Error<Tab>:cp :cp<CR> 566 an 40.410 &Tools.&Older\ List<Tab>:cold :colder<CR> 567 an 40.420 &Tools.N&ewer\ List<Tab>:cnew :cnewer<CR> 568 an 40.430.50 &Tools.Error\ &Window.&Update<Tab>:cwin :cwin<CR> 569 an 40.430.60 &Tools.Error\ &Window.&Open<Tab>:copen :copen<CR> 570 an 40.430.70 &Tools.Error\ &Window.&Close<Tab>:cclose :cclose<CR> 571 572 an 40.520 &Tools.-SEP3- <Nop> 573 an <silent> 40.530 &Tools.&Convert\ to\ HEX<Tab>:%!xxd 574 \ :call <SID>XxdConv()<CR> 575 an <silent> 40.540 &Tools.Conve&rt\ Back<Tab>:%!xxd\ -r 576 \ :call <SID>XxdBack()<CR> 577 578 " Use a function to do the conversion, so that it also works with 'insertmode' 579 " set. 580 func s:XxdConv() 581 let mod = &mod 582 if has("vms") 583 %!mc vim:xxd 584 else 585 call s:XxdFind() 586 exe ':%!' . g:xxdprogram 587 endif 588 if getline(1) =~ "^00000000:" " only if it worked 589 set ft=xxd 590 endif 591 let &mod = mod 592 endfun 593 594 func s:XxdBack() 595 let mod = &mod 596 if has("vms") 597 %!mc vim:xxd -r 598 else 599 call s:XxdFind() 600 exe ':%!' . g:xxdprogram . ' -r' 601 endif 602 set ft= 603 if exists('#filetypedetect') && exists('#BufReadPost') 604 doautocmd filetypedetect BufReadPost 605 endif 606 let &mod = mod 607 endfun 608 609 func s:XxdFind() 610 if !exists("g:xxdprogram") 611 " On the PC xxd may not be in the path but in the install directory 612 if has("win32") && !executable("xxd") 613 let g:xxdprogram = $VIMRUNTIME . (&shellslash ? '/' : '\') . "xxd.exe" 614 if g:xxdprogram =~ ' ' 615 let g:xxdprogram = '"' .. g:xxdprogram .. '"' 616 endif 617 else 618 let g:xxdprogram = "xxd" 619 endif 620 endif 621 endfun 622 623 let s:did_setup_compilers = 0 624 625 " Setup the Tools.Compiler submenu 626 func s:SetupCompilers() abort 627 if s:did_setup_compilers 628 return 629 endif 630 let s:did_setup_compilers = 1 631 632 let n = globpath(&runtimepath, "compiler/*.vim", 1, 1) 633 let idx = 100 634 for name in n 635 " Ignore case for VMS and windows 636 let name = substitute(name, '\c.*[/\\:\]]\([^/\\:]*\)\.vim', '\1', '') 637 exe "an 30.440." . idx . ' &Tools.Se&t\ Compiler.' . name . " :compiler " . name . "<CR>" 638 let idx = idx + 10 639 endfor 640 silent! aunmenu &Tools.Show\ Compiler\ Se&ttings\ in\ Menu 641 endfun 642 if exists("do_no_lazyload_menus") 643 call s:SetupCompilers() 644 else 645 an <silent> 30.440 &Tools.Show\ Compiler\ Se&ttings\ in\ Menu :call <SID>SetupCompilers()<CR> 646 endif 647 648 " Load ColorScheme, Compiler Setting and Keymap menus when idle. 649 if !exists("do_no_lazyload_menus") 650 func s:SetupLazyloadMenus() 651 call s:SetupColorSchemes() 652 call s:SetupCompilers() 653 if has("keymap") 654 call s:SetupKeymaps() 655 endif 656 endfunc 657 augroup SetupLazyloadMenus 658 au! 659 au CursorHold,CursorHoldI * call <SID>SetupLazyloadMenus() | au! SetupLazyloadMenus 660 augroup END 661 endif 662 663 664 if !exists("no_buffers_menu") 665 666 " Buffer list menu -- Setup functions & actions 667 668 " wait with building the menu until after loading 'session' files. Makes 669 " startup faster. 670 let s:bmenu_wait = 1 671 672 " Dictionary of buffer number to name. This helps prevent problems where a 673 " buffer as renamed and we didn't keep track of that. 674 let s:bmenu_items = {} 675 676 if !exists("bmenu_priority") 677 let bmenu_priority = 60 678 endif 679 680 " invoked from a BufCreate or BufFilePost autocommand 681 func s:BMAdd() 682 if s:bmenu_wait == 0 683 " when adding too many buffers, redraw in short format 684 if s:bmenu_count == &menuitems && s:bmenu_short == 0 685 call s:BMShow() 686 else 687 let name = expand("<afile>") 688 let num = expand("<abuf>") + 0 " add zero to convert to a number type 689 if s:BMCanAdd(name, num) 690 call <SID>BMFilename(name, num) 691 let s:bmenu_count += 1 692 endif 693 endif 694 endif 695 endfunc 696 697 " invoked from a BufDelete or BufFilePre autocommand 698 func s:BMRemove() 699 if s:bmenu_wait == 0 700 let bufnum = expand("<abuf>") 701 if s:bmenu_items->has_key(bufnum) 702 let menu_name = s:bmenu_items[bufnum] 703 exe 'silent! aun &Buffers.' . menu_name 704 let s:bmenu_count = s:bmenu_count - 1 705 unlet s:bmenu_items[bufnum] 706 endif 707 endif 708 endfunc 709 710 " Return non-zero if buffer with number "name" / "num" is useful to add in the 711 " buffer menu. 712 func s:BMCanAdd(name, num) 713 " no directory or unlisted buffer 714 if isdirectory(a:name) || !buflisted(a:num) 715 return 0 716 endif 717 718 " no name with control characters 719 if a:name =~ '[\x01-\x1f]' 720 return 0 721 endif 722 723 " no special buffer, such as terminal or popup 724 let buftype = getbufvar(a:num, '&buftype') 725 if buftype != '' && buftype != 'nofile' && buftype != 'nowrite' 726 return 0 727 endif 728 729 " only existing buffers 730 return bufexists(a:num) 731 endfunc 732 733 " Create the buffer menu (delete an existing one first). 734 func s:BMShow(...) 735 let s:bmenu_wait = 1 736 let s:bmenu_short = 1 737 let s:bmenu_count = 0 738 let s:bmenu_items = {} 739 " 740 " get new priority, if exists 741 if a:0 == 1 742 let g:bmenu_priority = a:1 743 endif 744 745 " Remove old menu, if it exists; keep one entry to avoid a torn off menu to 746 " disappear. Use try/catch to avoid setting v:errmsg 747 try 748 unmenu &Buffers 749 catch 750 endtry 751 exe 'noremenu ' .. g:bmenu_priority .. ".1 &Buffers.Dummy l" 752 try 753 unmenu! &Buffers 754 catch 755 endtry 756 757 " create new menu; set 'cpo' to include the <CR> 758 let cpo_save = &cpo 759 set cpo&vim 760 exe 'an <silent> ' .. g:bmenu_priority .. ".2 &Buffers.&Refresh\\ menu :call <SID>BMShow()<CR>" 761 exe 'an ' .. g:bmenu_priority .. ".4 &Buffers.&Delete :confirm bd<CR>" 762 exe 'an ' .. g:bmenu_priority .. ".6 &Buffers.&Alternate :confirm b #<CR>" 763 exe 'an ' .. g:bmenu_priority .. ".7 &Buffers.&Next :confirm bnext<CR>" 764 exe 'an ' .. g:bmenu_priority .. ".8 &Buffers.&Previous :confirm bprev<CR>" 765 exe 'an ' .. g:bmenu_priority .. ".9 &Buffers.-SEP- :" 766 let &cpo = cpo_save 767 unmenu &Buffers.Dummy 768 769 " figure out how many buffers there are 770 let buf = 1 771 while buf <= bufnr('$') 772 if s:BMCanAdd(bufname(buf), buf) 773 let s:bmenu_count = s:bmenu_count + 1 774 endif 775 let buf = buf + 1 776 endwhile 777 if s:bmenu_count <= &menuitems 778 let s:bmenu_short = 0 779 endif 780 781 " iterate through buffer list, adding each buffer to the menu: 782 let buf = 1 783 while buf <= bufnr('$') 784 let name = bufname(buf) 785 if s:BMCanAdd(name, buf) 786 call <SID>BMFilename(name, buf) 787 endif 788 let buf = buf + 1 789 endwhile 790 let s:bmenu_wait = 0 791 aug buffer_list 792 au! 793 au BufCreate,BufFilePost * call <SID>BMAdd() 794 au BufDelete,BufFilePre * call <SID>BMRemove() 795 aug END 796 endfunc 797 798 func s:BMHash(name) 799 " Create a sortable numeric hash of the name. This number has to be within 800 " the bounds of a signed 32-bit integer as this is what Vim GUI uses 801 " internally for the index. 802 803 " Make name all upper case, so that alphanumeric chars are between 32 and 96 804 let nm = toupper(a:name) 805 806 if char2nr(nm->slice(0, 1)) < 32 || char2nr(nm->slice(0, 1)) > 96 807 " We don't have an ASCII character, so just return the raw character value 808 " for first character (clamped to 2^31) and set the high bit to make it 809 " sort after other items. This means only the first character will be 810 " sorted, unfortunately. 811 return or(and(char2nr(nm), 0x7fffffff), 0x40000000) 812 endif 813 814 if has("ebcdic") 815 " HACK: Replace all non alphabetics with 'Z' 816 " Just to make it work for now. 817 let nm = substitute(nm, "[^A-Z]", 'Z', "g") 818 let sp = char2nr('A') - 1 819 else 820 let sp = char2nr(' ') 821 endif 822 " convert first five chars into a number for sorting by compressing each 823 " char into 5 bits (0-63), to a total of 30 bits. If any character is not 824 " ASCII, it will simply be clamped to prevent overflow. 825 " Nvim: no << operator 826 return (max([0, min([63, char2nr(nm->slice(0, 1)) - sp])]) * 0x1000000) + 827 \ (max([0, min([63, char2nr(nm->slice(1, 2)) - sp])]) * 0x40000) + 828 \ (max([0, min([63, char2nr(nm->slice(2, 3)) - sp])]) * 0x1000) + 829 \ (max([0, min([63, char2nr(nm->slice(3, 4)) - sp])]) * 0x40) + 830 \ max([0, min([63, char2nr(nm->slice(4, 5)) - sp])]) 831 endfunc 832 833 func s:BMHash2(name) 834 let nm = tolower(a:name->slice(0, 1)) 835 if nm[0] < 'a' || nm[0] > 'z' 836 return '&others.' 837 elseif nm[0] <= 'd' 838 return '&abcd.' 839 elseif nm[0] <= 'h' 840 return '&efgh.' 841 elseif nm[0] <= 'l' 842 return '&ijkl.' 843 elseif nm[0] <= 'p' 844 return '&mnop.' 845 elseif nm[0] <= 't' 846 return '&qrst.' 847 else 848 return '&u-z.' 849 endif 850 endfunc 851 852 " Insert a buffer name into the buffer menu. 853 func s:BMFilename(name, num) 854 let munge = <SID>BMMunge(a:name, a:num) 855 let hash = <SID>BMHash(munge) 856 if s:bmenu_short == 0 857 let s:bmenu_items[a:num] = munge 858 let cmd = 'an ' . g:bmenu_priority . '.' . hash . ' &Buffers.' . munge 859 else 860 let menu_name = <SID>BMHash2(munge) . munge 861 let s:bmenu_items[a:num] = menu_name 862 let cmd = 'an ' . g:bmenu_priority . '.' . hash . '.' . hash . ' &Buffers.' . menu_name 863 endif 864 " set 'cpo' to include the <CR> 865 let cpo_save = &cpo 866 set cpo&vim 867 exe cmd . ' :confirm b' . a:num . '<CR>' 868 let &cpo = cpo_save 869 endfunc 870 871 " Truncate a long path to fit it in a menu item. 872 if !exists("g:bmenu_max_pathlen") 873 let g:bmenu_max_pathlen = 35 874 endif 875 func s:BMTruncName(fname) 876 let name = a:fname 877 if g:bmenu_max_pathlen < 5 878 let name = "" 879 else 880 let len = strlen(name) 881 if len > g:bmenu_max_pathlen 882 let amountl = (g:bmenu_max_pathlen / 2) - 2 883 let amountr = g:bmenu_max_pathlen - amountl - 3 884 let pattern = '^\(.\{,' . amountl . '}\).\{-}\(.\{,' . amountr . '}\)$' 885 let left = substitute(name, pattern, '\1', '') 886 let right = substitute(name, pattern, '\2', '') 887 if strlen(left) + strlen(right) < len 888 let name = left . '...' . right 889 endif 890 endif 891 endif 892 return name 893 endfunc 894 895 func s:BMMunge(fname, bnum) 896 let name = a:fname 897 if name == '' 898 if !exists("g:menutrans_no_file") 899 let g:menutrans_no_file = "[No Name]" 900 endif 901 let name = g:menutrans_no_file 902 else 903 let name = fnamemodify(name, ':p:~') 904 endif 905 " detach file name and separate it out: 906 let name2 = fnamemodify(name, ':t') 907 if a:bnum >= 0 908 let name2 = name2 . ' (' . a:bnum . ')' 909 endif 910 let name = name2 . "\t" . <SID>BMTruncName(fnamemodify(name,':h')) 911 let name = escape(name, "\\. \t|") 912 let name = substitute(name, "&", "&&", "g") 913 let name = substitute(name, "\n", "^@", "g") 914 return name 915 endfunc 916 917 " When just starting Vim, load the buffer menu later 918 if has("vim_starting") 919 augroup LoadBufferMenu 920 au! VimEnter * if !exists("no_buffers_menu") | call <SID>BMShow() | endif 921 au VimEnter * au! LoadBufferMenu 922 augroup END 923 else 924 call <SID>BMShow() 925 endif 926 927 endif " !exists("no_buffers_menu") 928 929 " Window menu 930 an 70.300 &Window.&New<Tab>^Wn <C-W>n 931 an 70.310 &Window.S&plit<Tab>^Ws <C-W>s 932 an 70.320 &Window.Sp&lit\ To\ #<Tab>^W^^ <C-W><C-^> 933 an 70.330 &Window.Split\ &Vertically<Tab>^Wv <C-W>v 934 an <silent> 70.332 &Window.Split\ File\ E&xplorer :call MenuExplOpen()<CR> 935 if !exists("*MenuExplOpen") 936 fun MenuExplOpen() 937 if @% == "" 938 20vsp . 939 else 940 exe "20vsp " . s:FnameEscape(expand("%:p:h")) 941 endif 942 endfun 943 endif 944 an 70.335 &Window.-SEP1- <Nop> 945 an 70.340 &Window.&Close<Tab>^Wc :confirm close<CR> 946 an 70.345 &Window.Close\ &Other(s)<Tab>^Wo :confirm only<CR> 947 an 70.350 &Window.-SEP2- <Nop> 948 an 70.355 &Window.Move\ &To.&Top<Tab>^WK <C-W>K 949 an 70.355 &Window.Move\ &To.&Bottom<Tab>^WJ <C-W>J 950 an 70.355 &Window.Move\ &To.&Left\ Side<Tab>^WH <C-W>H 951 an 70.355 &Window.Move\ &To.&Right\ Side<Tab>^WL <C-W>L 952 an 70.360 &Window.Rotate\ &Up<Tab>^WR <C-W>R 953 an 70.362 &Window.Rotate\ &Down<Tab>^Wr <C-W>r 954 an 70.365 &Window.-SEP3- <Nop> 955 an 70.370 &Window.&Equal\ Size<Tab>^W= <C-W>= 956 an 70.380 &Window.&Max\ Height<Tab>^W_ <C-W>_ 957 an 70.390 &Window.M&in\ Height<Tab>^W1_ <C-W>1_ 958 an 70.400 &Window.Max\ &Width<Tab>^W\| <C-W>\| 959 an 70.410 &Window.Min\ Widt&h<Tab>^W1\| <C-W>1\| 960 961 " The popup menu 962 an 1.10 PopUp.&Undo u 963 an 1.15 PopUp.-SEP1- <Nop> 964 vnoremenu 1.20 PopUp.Cu&t "+x 965 vnoremenu 1.30 PopUp.&Copy "+y 966 cnoremenu 1.30 PopUp.&Copy <C-Y> 967 nnoremenu 1.40 PopUp.&Paste "+gP 968 cnoremenu 1.40 PopUp.&Paste <C-R>+ 969 exe 'vnoremenu <script> 1.40 PopUp.&Paste ' . paste#paste_cmd['v'] 970 exe 'inoremenu <script> 1.40 PopUp.&Paste ' . paste#paste_cmd['i'] 971 vnoremenu 1.50 PopUp.&Delete x 972 an 1.55 PopUp.-SEP2- <Nop> 973 vnoremenu 1.60 PopUp.Select\ Blockwise <C-V> 974 975 nnoremenu 1.70 PopUp.Select\ &Word vaw 976 onoremenu 1.70 PopUp.Select\ &Word aw 977 vnoremenu 1.70 PopUp.Select\ &Word <C-C>vaw 978 inoremenu 1.70 PopUp.Select\ &Word <C-O>vaw 979 cnoremenu 1.70 PopUp.Select\ &Word <C-C>vaw 980 981 nnoremenu 1.73 PopUp.Select\ &Sentence vas 982 onoremenu 1.73 PopUp.Select\ &Sentence as 983 vnoremenu 1.73 PopUp.Select\ &Sentence <C-C>vas 984 inoremenu 1.73 PopUp.Select\ &Sentence <C-O>vas 985 cnoremenu 1.73 PopUp.Select\ &Sentence <C-C>vas 986 987 nnoremenu 1.77 PopUp.Select\ Pa&ragraph vap 988 onoremenu 1.77 PopUp.Select\ Pa&ragraph ap 989 vnoremenu 1.77 PopUp.Select\ Pa&ragraph <C-C>vap 990 inoremenu 1.77 PopUp.Select\ Pa&ragraph <C-O>vap 991 cnoremenu 1.77 PopUp.Select\ Pa&ragraph <C-C>vap 992 993 nnoremenu 1.80 PopUp.Select\ &Line V 994 onoremenu 1.80 PopUp.Select\ &Line <C-C>V 995 vnoremenu 1.80 PopUp.Select\ &Line <C-C>V 996 inoremenu 1.80 PopUp.Select\ &Line <C-O>V 997 cnoremenu 1.80 PopUp.Select\ &Line <C-C>V 998 999 nnoremenu 1.90 PopUp.Select\ &Block <C-V> 1000 onoremenu 1.90 PopUp.Select\ &Block <C-C><C-V> 1001 vnoremenu 1.90 PopUp.Select\ &Block <C-C><C-V> 1002 inoremenu 1.90 PopUp.Select\ &Block <C-O><C-V> 1003 cnoremenu 1.90 PopUp.Select\ &Block <C-C><C-V> 1004 1005 noremenu <script> <silent> 1.100 PopUp.Select\ &All :<C-U>call <SID>SelectAll()<CR> 1006 inoremenu <script> <silent> 1.100 PopUp.Select\ &All <C-O>:call <SID>SelectAll()<CR> 1007 cnoremenu <script> <silent> 1.100 PopUp.Select\ &All <C-U>call <SID>SelectAll()<CR> 1008 1009 if has("spell") 1010 " Spell suggestions in the popup menu. Note that this will slow down the 1011 " appearance of the menu! 1012 func s:SpellPopup() 1013 if exists("s:changeitem") && s:changeitem != '' 1014 call <SID>SpellDel() 1015 endif 1016 1017 " Return quickly if spell checking is not enabled. 1018 if !&spell || &spelllang == '' 1019 return 1020 endif 1021 1022 let curcol = col('.') 1023 let [w, a] = spellbadword() 1024 if col('.') > curcol " don't use word after the cursor 1025 let w = '' 1026 endif 1027 if w != '' 1028 if a == 'caps' 1029 let s:suglist = [substitute(w, '.*', '\u&', '')] 1030 else 1031 let s:suglist = spellsuggest(w, 10) 1032 endif 1033 if len(s:suglist) > 0 1034 if !exists("g:menutrans_spell_change_ARG_to") 1035 let g:menutrans_spell_change_ARG_to = 'Change\ "%s"\ to' 1036 endif 1037 let s:changeitem = printf(g:menutrans_spell_change_ARG_to, escape(w, ' .')) 1038 let s:fromword = w 1039 let pri = 1 1040 " set 'cpo' to include the <CR> 1041 let cpo_save = &cpo 1042 set cpo&vim 1043 for sug in s:suglist 1044 exe 'anoremenu 1.5.' . pri . ' PopUp.' . s:changeitem . '.' . escape(sug, ' .') 1045 \ . ' :call <SID>SpellReplace(' . pri . ')<CR>' 1046 let pri += 1 1047 endfor 1048 1049 if !exists("g:menutrans_spell_add_ARG_to_word_list") 1050 let g:menutrans_spell_add_ARG_to_word_list = 'Add\ "%s"\ to\ Word\ List' 1051 endif 1052 let s:additem = printf(g:menutrans_spell_add_ARG_to_word_list, escape(w, ' .')) 1053 exe 'anoremenu 1.6 PopUp.' . s:additem . ' :spellgood ' . w . '<CR>' 1054 1055 if !exists("g:menutrans_spell_ignore_ARG") 1056 let g:menutrans_spell_ignore_ARG = 'Ignore\ "%s"' 1057 endif 1058 let s:ignoreitem = printf(g:menutrans_spell_ignore_ARG, escape(w, ' .')) 1059 exe 'anoremenu 1.7 PopUp.' . s:ignoreitem . ' :spellgood! ' . w . '<CR>' 1060 1061 anoremenu 1.8 PopUp.-SpellSep- : 1062 let &cpo = cpo_save 1063 endif 1064 endif 1065 call cursor(0, curcol) " put the cursor back where it was 1066 endfunc 1067 1068 func s:SpellReplace(n) 1069 let l = getline('.') 1070 " Move the cursor to the start of the word. 1071 call spellbadword() 1072 call setline('.', strpart(l, 0, col('.') - 1) . s:suglist[a:n - 1] 1073 \ . strpart(l, col('.') + len(s:fromword) - 1)) 1074 endfunc 1075 1076 func s:SpellDel() 1077 exe "aunmenu PopUp." . s:changeitem 1078 exe "aunmenu PopUp." . s:additem 1079 exe "aunmenu PopUp." . s:ignoreitem 1080 aunmenu PopUp.-SpellSep- 1081 let s:changeitem = '' 1082 endfun 1083 1084 augroup SpellPopupMenu 1085 au! MenuPopup * call <SID>SpellPopup() 1086 augroup END 1087 endif 1088 1089 " The GUI toolbar (for MS-Windows and GTK) 1090 if has("toolbar") 1091 an 1.10 ToolBar.Open :browse confirm e<CR> 1092 an <silent> 1.20 ToolBar.Save :if expand("%") == ""<Bar>browse confirm w<Bar>else<Bar>confirm w<Bar>endif<CR> 1093 an 1.30 ToolBar.SaveAll :browse confirm wa<CR> 1094 1095 if has("unix") 1096 an 1.40 ToolBar.Print :w !lpr<CR> 1097 vunmenu ToolBar.Print 1098 vnoremenu ToolBar.Print :w !lpr<CR> 1099 endif 1100 1101 an 1.45 ToolBar.-sep1- <Nop> 1102 an 1.50 ToolBar.Undo u 1103 an 1.60 ToolBar.Redo <C-R> 1104 1105 an 1.65 ToolBar.-sep2- <Nop> 1106 vnoremenu 1.70 ToolBar.Cut "+x 1107 vnoremenu 1.80 ToolBar.Copy "+y 1108 cnoremenu 1.80 ToolBar.Copy <C-Y> 1109 nnoremenu 1.90 ToolBar.Paste "+gP 1110 cnoremenu ToolBar.Paste <C-R>+ 1111 exe 'vnoremenu <script> ToolBar.Paste ' . paste#paste_cmd['v'] 1112 exe 'inoremenu <script> ToolBar.Paste ' . paste#paste_cmd['i'] 1113 1114 if !has("gui_athena") 1115 an 1.95 ToolBar.-sep3- <Nop> 1116 an 1.100 ToolBar.Replace :promptrepl<CR> 1117 vunmenu ToolBar.Replace 1118 vnoremenu ToolBar.Replace y:promptrepl <C-R>=<SID>FixFText()<CR><CR> 1119 an 1.110 ToolBar.FindNext n 1120 an 1.120 ToolBar.FindPrev N 1121 endif 1122 1123 an 1.215 ToolBar.-sep5- <Nop> 1124 an <silent> 1.220 ToolBar.LoadSesn :call <SID>LoadVimSesn()<CR> 1125 an <silent> 1.230 ToolBar.SaveSesn :call <SID>SaveVimSesn()<CR> 1126 an 1.240 ToolBar.RunScript :browse so<CR> 1127 1128 an 1.245 ToolBar.-sep6- <Nop> 1129 an 1.250 ToolBar.Make :make<CR> 1130 an 1.270 ToolBar.RunCtags :exe "!" . g:ctags_command<CR> 1131 an 1.280 ToolBar.TagJump g<C-]> 1132 1133 an 1.295 ToolBar.-sep7- <Nop> 1134 an 1.300 ToolBar.Help :help<CR> 1135 an <silent> 1.310 ToolBar.FindHelp :call <SID>Helpfind()<CR> 1136 1137 " Only set the tooltips here if not done in a language menu file 1138 if exists("*Do_toolbar_tmenu") 1139 call Do_toolbar_tmenu() 1140 else 1141 let did_toolbar_tmenu = 1 1142 tmenu ToolBar.Open Open file 1143 tmenu ToolBar.Save Save current file 1144 tmenu ToolBar.SaveAll Save all files 1145 tmenu ToolBar.Print Print 1146 tmenu ToolBar.Undo Undo 1147 tmenu ToolBar.Redo Redo 1148 tmenu ToolBar.Cut Cut to clipboard 1149 tmenu ToolBar.Copy Copy to clipboard 1150 tmenu ToolBar.Paste Paste from Clipboard 1151 if !has("gui_athena") 1152 tmenu ToolBar.Replace Find / Replace... 1153 tmenu ToolBar.FindNext Find Next 1154 tmenu ToolBar.FindPrev Find Previous 1155 endif 1156 tmenu ToolBar.LoadSesn Choose a session to load 1157 tmenu ToolBar.SaveSesn Save current session 1158 tmenu ToolBar.RunScript Choose a Vim script to run 1159 tmenu ToolBar.Make Make current project (:make) 1160 tmenu ToolBar.RunCtags Build tags in current directory tree (!ctags -R .) 1161 tmenu ToolBar.TagJump Jump to tag under cursor 1162 tmenu ToolBar.Help Vim Help 1163 tmenu ToolBar.FindHelp Search Vim Help 1164 endif 1165 1166 " Select a session to load; default to current session name if present 1167 fun! s:LoadVimSesn() 1168 if strlen(v:this_session) > 0 1169 let name = s:FnameEscape(v:this_session) 1170 else 1171 let name = "Session.vim" 1172 endif 1173 execute "browse so " . name 1174 endfun 1175 1176 " Select a session to save; default to current session name if present 1177 fun! s:SaveVimSesn() 1178 if strlen(v:this_session) == 0 1179 let v:this_session = "Session.vim" 1180 endif 1181 execute "browse mksession! " . s:FnameEscape(v:this_session) 1182 endfun 1183 1184 endif 1185 1186 endif " !exists("did_install_default_menus") 1187 1188 " Define these items always, so that syntax can be switched on when it wasn't. 1189 " But skip them when the Syntax menu was disabled by the user. 1190 if !exists("did_install_syntax_menu") 1191 an 50.212 &Syntax.&Manual :syn manual<CR> 1192 an 50.214 &Syntax.A&utomatic :syn on<CR> 1193 an <silent> 50.216 &Syntax.On/Off\ for\ &This\ File :call <SID>SynOnOff()<CR> 1194 if !exists("*s:SynOnOff") 1195 fun s:SynOnOff() 1196 if has("syntax_items") 1197 syn clear 1198 else 1199 if !exists("g:syntax_on") 1200 syn manual 1201 endif 1202 set syn=ON 1203 endif 1204 endfun 1205 endif 1206 endif 1207 1208 1209 " Install the Syntax menu only when filetype.vim has been loaded or when 1210 " manual syntax highlighting is enabled. 1211 " Avoid installing the Syntax menu twice. 1212 if (exists("did_load_filetypes") || exists("syntax_on")) 1213 \ && !exists("did_install_syntax_menu") 1214 let did_install_syntax_menu = 1 1215 1216 " Skip setting up the individual syntax selection menus unless 1217 " do_syntax_sel_menu is defined (it takes quite a bit of time). 1218 if exists("do_syntax_sel_menu") 1219 runtime! synmenu.vim 1220 else 1221 an <silent> 50.10 &Syntax.&Show\ File\ Types\ in\ Menu :let do_syntax_sel_menu = 1<Bar>runtime! synmenu.vim<Bar>aunmenu &Syntax.&Show\ File\ Types\ in\ Menu<CR> 1222 an 50.195 &Syntax.-SEP1- <Nop> 1223 endif 1224 1225 an 50.210 &Syntax.&Off :syn off<CR> 1226 an 50.700 &Syntax.-SEP3- <Nop> 1227 an 50.710 &Syntax.Co&lor\ Test :sp $VIMRUNTIME/syntax/colortest.vim<Bar>so %<CR> 1228 an 50.720 &Syntax.&Highlight\ Test :runtime syntax/hitest.vim<CR> 1229 an 50.730 &Syntax.&Convert\ to\ HTML :runtime syntax/2html.vim<CR> 1230 1231 endif " !exists("did_install_syntax_menu") 1232 1233 " Restore the previous value of 'cpoptions'. 1234 let &cpo = s:cpo_save 1235 unlet s:cpo_save 1236 1237 " vim: set sw=2 :