/usr/share/doc/vim/html/gui.html is in vim-doc 2:8.0.1453-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 | <HTML>
<HEAD>
<META HTTP-EQUIV="Content-type" content="text/html; charset=ISO-8859-1">
<TITLE>Vim documentation: gui</TITLE>
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>Vim documentation: gui</H1>
<A NAME="top"></A>
<A HREF="index.html">main help file</A>
<HR>
<PRE>
*<A NAME="gui.txt"></A><B>gui.txt</B>* For Vim version 8.0. Last change: 2017 Nov 09
VIM REFERENCE MANUAL by <A HREF="intro.html#Bram">Bram</A> <A HREF="intro.html#Moolenaar">Moolenaar</A>
Vim's Graphical <A HREF="autocmd.html#User">User</A> Interface *<A NAME="gui"></A><B>gui</B>* *<A NAME="GUI"></A><B>GUI</B>*
1. Starting the <A HREF="#GUI">GUI</A> |<A HREF="#gui-start">gui-start</A>|
2. Scrollbars |<A HREF="#gui-scrollbars">gui-scrollbars</A>|
3. Mouse Control |<A HREF="#gui-mouse">gui-mouse</A>|
4. Making <A HREF="#GUI">GUI</A> Selections |<A HREF="#gui-selections">gui-selections</A>|
5. Menus |<A HREF="#menus">menus</A>|
6. Extras |<A HREF="#gui-extras">gui-extras</A>|
7. Shell Commands |<A HREF="#gui-shell">gui-shell</A>|
Other <A HREF="#GUI">GUI</A> documentation:
|<A HREF="gui_x11.html">gui_x11.txt</A>| For specific items of the <A HREF="options.html#X11">X11</A> <A HREF="#GUI">GUI</A>.
|<A HREF="gui_w32.html">gui_w32.txt</A>| For specific items of the <A HREF="os_win32.html#Win32">Win32</A> <A HREF="#GUI">GUI</A>.
{Vi does not have any of these commands}
==============================================================================
1. Starting the <A HREF="#GUI">GUI</A> *<A NAME="gui-start"></A><B>gui-start</B>* *<A NAME="E229"></A><B>E229</B>* *<A NAME="E233"></A><B>E233</B>*
First you must make sure you actually have a version of Vim with the <A HREF="#GUI">GUI</A> code
included. You can check this with the "<A HREF="various.html#:version">:version</A>" command, <A HREF="motion.html#it">it</A> says "with xxx
GUI", where "xxx" is X11-Motif, X11-Athena, Photon, GTK2, <A HREF="gui_x11.html#GTK3">GTK3</A>, etc., or
"<A HREF="os_win32.html#MS-Windows">MS-Windows</A> 32 bit <A HREF="#GUI">GUI</A> version".
How to start the <A HREF="#GUI">GUI</A> depends on the system used. Mostly you can run the
<A HREF="#GUI">GUI</A> version of Vim with:
<A HREF="starting.html#gvim">gvim</A> [options] [files...]
The <A HREF="options.html#X11">X11</A> version of Vim can run both in <A HREF="#GUI">GUI</A> and in non-GUI mode. See
|<A HREF="gui_x11.html#gui-x11-start">gui-x11-start</A>|.
*<A NAME="gui-init"></A><B>gui-init</B>* *<A NAME="gvimrc"></A><B>gvimrc</B>* *<A NAME=".gvimrc"></A><B>.gvimrc</B>* *<A NAME="_gvimrc"></A><B>_gvimrc</B>* *<A NAME="$MYGVIMRC"></A><B>$MYGVIMRC</B>*
The <A HREF="#gvimrc">gvimrc</A> file is where GUI-specific <A HREF="starting.html#startup">startup</A> commands should be placed. It
is always sourced after the |<A HREF="starting.html#vimrc">vimrc</A>| file. If you have one then the <A HREF="#$MYGVIMRC">$MYGVIMRC</A>
environment variable has its name.
When the <A HREF="#GUI">GUI</A> starts up initializations are carried out, in this order:
- The <A HREF="options.html#'term'">'term'</A> option is set to "builtin_gui" and <A HREF="terminal.html#terminal">terminal</A> <A HREF="options.html#options">options</A> are reset to
their default value for the <A HREF="#GUI">GUI</A> |<A HREF="term.html#terminal-options">terminal-options</A>|.
- If the system menu file exists, <A HREF="motion.html#it">it</A> is sourced. The name of this file is
normally "$VIMRUNTIME/menu.vim". You can check this with "<A HREF="various.html#:version">:version</A>". Also
see |<A HREF="starting.html#$VIMRUNTIME">$VIMRUNTIME</A>|. To skip loading the system menu include 'M' in
<A HREF="options.html#'guioptions'">'guioptions'</A>. *<A NAME="buffers-menu"></A><B>buffers-menu</B>* *<A NAME="no_buffers_menu"></A><B>no_buffers_menu</B>*
The system menu file includes a "Buffers" menu. If you don't want this, set
the "<A HREF="#no_buffers_menu">no_buffers_menu</A>" variable in your <A HREF="starting.html#.vimrc">.vimrc</A> (not .gvimrc!):
<B> :let no_buffers_menu = 1</B>
NOTE: Switching on <A HREF="syntax.html#syntax">syntax</A> highlighting also loads the menu file, thus
disabling the Buffers menu must be done before "<A HREF="syntax.html#:syntax">:syntax</A> on".
The path names are truncated to 35 characters. You can truncate them at a
different length, for example 50, like this:
<B> :let bmenu_max_pathlen = 50</B>
- If the "<A HREF="starting.html#-U">-U</A> {gvimrc}" command-line option has been used when starting Vim,
the {gvimrc} file will be read for initializations. The following
initializations are skipped. When {gvimrc} is "NONE" no file will be read
for initializations.
- For <A HREF="os_unix.html#Unix">Unix</A> and <A HREF="os_win32.html#MS-Windows">MS-Windows</A>, if the system <A HREF="#gvimrc">gvimrc</A> exists, <A HREF="motion.html#it">it</A> is sourced. The
name of this file is normally "$VIM/gvimrc". You can check this with
"<A HREF="various.html#:version">:version</A>". Also see |<A HREF="starting.html#$VIM">$VIM</A>|.
- The following are tried, and only the first one that exists is used:
- If the GVIMINIT environment variable exists and is not empty, <A HREF="motion.html#it">it</A> is
executed <A HREF="motion.html#as">as</A> an <A HREF="intro.html#Ex">Ex</A> command.
- If the user <A HREF="#gvimrc">gvimrc</A> file exists, <A HREF="motion.html#it">it</A> is sourced. The name of this file is
normally "$HOME/.gvimrc". You can check this with "<A HREF="various.html#:version">:version</A>".
- For <A HREF="os_win32.html#Win32">Win32</A>, $HOME is set by Vim if needed, see |<A HREF="options.html#$HOME-windows">$HOME-windows</A>|.
- When a "<A HREF="#_gvimrc">_gvimrc</A>" file is not found, "<A HREF="#.gvimrc">.gvimrc</A>" is tried too. And vice
versa.
The name of the first file found is stored in <A HREF="#$MYGVIMRC">$MYGVIMRC</A>, unless <A HREF="motion.html#it">it</A> was
already set.
- If the <A HREF="options.html#'exrc'">'exrc'</A> option is set (which is NOT the default) the file ./.gvimrc
is sourced, if <A HREF="motion.html#it">it</A> exists and isn't the same file <A HREF="motion.html#as">as</A> the system or user
<A HREF="#gvimrc">gvimrc</A> file. If this file is not owned by you, some security restrictions
apply. When "<A HREF="#.gvimrc">.gvimrc</A>" is not found, "<A HREF="#_gvimrc">_gvimrc</A>" is tried too. For <A HREF="os_mac.html#Macintosh">Macintosh</A>
and DOS/Win32 "<A HREF="#_gvimrc">_gvimrc</A>" is tried first.
NOTE: All but the first one are not carried out if Vim was started with
"<A HREF="starting.html#-u">-u</A> NONE" or "<A HREF="starting.html#-u">-u</A> DEFAULTS" and no "<A HREF="starting.html#-U">-U</A>" argument was given, or when started
with "<A HREF="starting.html#-U">-U</A> NONE".
All this happens AFTER the normal Vim initializations, like reading your
<A HREF="starting.html#.vimrc">.vimrc</A> file. See |<A HREF="starting.html#initialization">initialization</A>|.
But the <A HREF="#GUI">GUI</A> <A HREF="windows.html#window">window</A> is only opened after all the initializations have been
carried out. If you want some commands to be executed just after opening the
GUI <A HREF="windows.html#window">window</A>, use the |<A HREF="autocmd.html#GUIEnter">GUIEnter</A>| <A HREF="autocmd.html#autocommand">autocommand</A> event. Example:
<B> :autocmd GUIEnter * winpos 100 50</B>
You can use the <A HREF="#gvimrc">gvimrc</A> files to set up your own customized <A HREF="#menus">menus</A> (see |<A HREF="#:menu">:menu</A>|)
and initialize other things that you may want to set up differently from the
<A HREF="terminal.html#terminal">terminal</A> version.
Recommended place for your personal <A HREF="#GUI">GUI</A> initializations:
<A HREF="os_unix.html#Unix">Unix</A> $HOME/.gvimrc or $HOME/.vim/gvimrc
<A HREF="os_os2.html#OS/2">OS/2</A> $HOME/.gvimrc, $HOME/vimfiles/gvimrc
or $VIM/.gvimrc
<A HREF="os_msdos.html#MS-DOS">MS-DOS</A> and <A HREF="os_win32.html#Win32">Win32</A> $HOME/_gvimrc, $HOME/vimfiles/gvimrc
or $VIM/_gvimrc
<A HREF="os_amiga.html#Amiga">Amiga</A> s:.gvimrc, home:.gvimrc, home:vimfiles:gvimrc
or $VIM/.gvimrc
The personal <A HREF="starting.html#initialization">initialization</A> files are searched in the order specified above
and only the first one that is found is read.
There are a number of <A HREF="options.html#options">options</A> which only have meaning in the <A HREF="#GUI">GUI</A> version of
Vim. These are <A HREF="options.html#'guicursor'">'guicursor'</A>, <A HREF="options.html#'guifont'">'guifont'</A>, <A HREF="options.html#'guipty'">'guipty'</A> and <A HREF="options.html#'guioptions'">'guioptions'</A>. They are
documented in |<A HREF="options.html">options.txt</A>| with all the other options.
If using the <A HREF="gui_x11.html#Motif">Motif</A> or <A HREF="gui_x11.html#Athena">Athena</A> version of the <A HREF="#GUI">GUI</A> (but not for the <A HREF="gui_x11.html#GTK+">GTK+</A> or
<A HREF="os_win32.html#Win32">Win32</A> version), a number of X resources are available. See |<A HREF="gui_x11.html#gui-resources">gui-resources</A>|.
Another way to set the colors for different occasions is with highlight
groups. The "<A HREF="intro.html#Normal">Normal</A>" group is used to set the background and foreground
colors. Example (which looks nice):
<B> :highlight Normal guibg=grey90</B>
The "guibg" and "guifg" settings override the normal background and
foreground settings. The other settings for the <A HREF="intro.html#Normal">Normal</A> highlight group are
not used. Use the <A HREF="options.html#'guifont'">'guifont'</A> option to set the font.
Also check out the <A HREF="options.html#'guicursor'">'guicursor'</A> option, to set the colors for the cursor in
various modes.
Vim tries to make the <A HREF="windows.html#window">window</A> fit on the screen when <A HREF="motion.html#it">it</A> starts up. This avoids
that you can't see part of <A HREF="motion.html#it">it</A>. On the X Window System this requires a bit of
guesswork. You can change the height that is used for the <A HREF="windows.html#window">window</A> title and a
task <A HREF="motion.html#bar">bar</A> with the <A HREF="options.html#'guiheadroom'">'guiheadroom'</A> option.
*<A NAME=":winp"></A><B>:winp</B>* *<A NAME=":winpos"></A><B>:winpos</B>* *<A NAME="E188"></A><B>E188</B>*
:winp[os]
Display current position of the top left corner of the <A HREF="#GUI">GUI</A> vim
<A HREF="windows.html#window">window</A> in pixels. Does not work in all versions.
Also see |<A HREF="eval.html#getwinposx()">getwinposx()</A>| and |<A HREF="eval.html#getwinposy()">getwinposy()</A>|.
:winp[os] {X} {Y} *<A NAME="E466"></A><B>E466</B>*
Put the <A HREF="#GUI">GUI</A> vim <A HREF="windows.html#window">window</A> at the given {X} and {Y} coordinates.
The coordinates should specify the position in pixels of the
top left corner of the <A HREF="windows.html#window">window</A>. Does not work in all versions.
Does work in an (new) xterm |<A HREF="syntax.html#xterm-color">xterm-color</A>|.
When the <A HREF="#GUI">GUI</A> <A HREF="windows.html#window">window</A> has not been opened yet, the values are
remembered until the <A HREF="windows.html#window">window</A> is opened. The position is
adjusted to make the <A HREF="windows.html#window">window</A> fit on the screen (if possible).
*<A NAME=":win"></A><B>:win</B>* *<A NAME=":winsize"></A><B>:winsize</B>* *<A NAME="E465"></A><B>E465</B>*
:win[size] {width} {height}
Set the <A HREF="windows.html#window">window</A> height to {width} by {height} characters.
Obsolete, use "<A HREF="options.html#:set">:set</A> <A HREF="options.html#'lines'">lines</A>=11 columns=22".
If you get <A HREF="various.html#less">less</A> lines than expected, check the <A HREF="options.html#'guiheadroom'">'guiheadroom'</A>
option.
If you are running the X Window System, you can get information about the
<A HREF="windows.html#window">window</A> Vim is running in with these commands:
<B> :!xwininfo -id $WINDOWID</B>
<B> :!xprop -id $WINDOWID</B>
<B> :execute '!xwininfo -id ' . v:windowid</B>
<B> :execute '!xprop -id ' . v:windowid</B>
*<A NAME="gui-IME"></A><B>gui-IME</B>* *<A NAME="iBus"></A><B>iBus</B>*
Input methods for international characters in X that rely on the <A HREF="mbyte.html#XIM">XIM</A>
framework, most notably <A HREF="#iBus">iBus</A>, have been known to produce undesirable results
in <A HREF="starting.html#gvim">gvim</A>. These may include an inability to enter spaces, or long delays
between typing a character and <A HREF="motion.html#it">it</A> being recognized by the application.
One workaround that has been successful, for unknown reasons, is to prevent
<A HREF="starting.html#gvim">gvim</A> from forking into the background by starting <A HREF="motion.html#it">it</A> with the |<A HREF="starting.html#-f">-f</A>| argument.
==============================================================================
2. Scrollbars *<A NAME="gui-scrollbars"></A><B>gui-scrollbars</B>*
There are vertical scrollbars and a horizontal scrollbar. You may
configure which ones appear with the <A HREF="options.html#'guioptions'">'guioptions'</A> option.
The interface looks like this (with "<A HREF="options.html#:set">:set</A> <A HREF="options.html#'guioptions'">guioptions</A>=mlrb"):
+------------------------------+ `
| File Edit Help | <- Menu <A HREF="motion.html#bar">bar</A> (m) `
+-+--------------------------+-+ `
|^| |^| `
|#| Text area. |#| `
| | | | `
|v|__________________________|v| `
<A HREF="intro.html#Normal">Normal</A> status line -> |-+ File.c 5,2 +-| `
between Vim <A HREF="windows.html#windows">windows</A> |^|""""""""""""""""""""""""""|^| `
| | | | `
| | Another file buffer. | | `
| | | | `
|#| |#| `
Left scrollbar (l) -> |#| |#| <- Right `
|#| |#| scrollbar (r) `
| | | | `
|v| |v| `
+-+--------------------------+-+ `
| |< #### >| | <- Bottom `
+-+--------------------------+-+ scrollbar (b) `
Any of the scrollbar or menu components may be turned off by not putting the
appropriate <A HREF="print.html#letter">letter</A> in the <A HREF="options.html#'guioptions'">'guioptions'</A> <A HREF="eval.html#string">string</A>. The bottom scrollbar is
only useful when <A HREF="options.html#'nowrap'">'nowrap'</A> is set.
VERTICAL SCROLLBARS *<A NAME="gui-vert-scroll"></A><B>gui-vert-scroll</B>*
Each Vim <A HREF="windows.html#window">window</A> has a scrollbar next to <A HREF="motion.html#it">it</A> which may be scrolled up and down
to move through the text in that buffer. The size of the scrollbar-thumb
indicates the fraction of the buffer which can be seen in the <A HREF="windows.html#window">window</A>.
When the scrollbar is dragged all the way down, the last line of the file
will appear in the top of the <A HREF="windows.html#window">window</A>.
If a <A HREF="windows.html#window">window</A> is shrunk to zero height (by the growth of another <A HREF="windows.html#window">window</A>) its
scrollbar disappears. It reappears when the <A HREF="windows.html#window">window</A> is restored.
If a <A HREF="windows.html#window">window</A> is vertically split, <A HREF="motion.html#it">it</A> will get a scrollbar when <A HREF="motion.html#it">it</A> is the
current <A HREF="windows.html#window">window</A> and when, taking the middle of the current <A HREF="windows.html#window">window</A> and drawing a
vertical line, this line goes through the <A HREF="windows.html#window">window</A>.
When there are scrollbars on both sides, and the middle of the current <A HREF="windows.html#window">window</A>
is on the left half, the right scrollbar column will contain scrollbars for
the rightmost <A HREF="windows.html#windows">windows</A>. The same happens on the other side.
HORIZONTAL SCROLLBARS *<A NAME="gui-horiz-scroll"></A><B>gui-horiz-scroll</B>*
The horizontal scrollbar (at the bottom of the Vim <A HREF="#GUI">GUI</A>) may be used to
scroll text sideways when the <A HREF="options.html#'wrap'">'wrap'</A> option is turned off. The
scrollbar-thumb size is such that the text of the longest visible line may be
scrolled <A HREF="motion.html#as">as</A> far <A HREF="motion.html#as">as</A> possible left and right. The cursor is moved when
necessary, <A HREF="motion.html#it">it</A> must remain on a visible character (unless <A HREF="options.html#'virtualedit'">'virtualedit'</A> is
set).
Computing the length of the longest visible line takes quite a bit of
computation, and <A HREF="motion.html#it">it</A> has to be done every time something changes. If this
takes too much time or you don't like the cursor jumping to another line,
include the '<A HREF="motion.html#h">h</A>' flag in <A HREF="options.html#'guioptions'">'guioptions'</A>. Then the <A HREF="scroll.html#scrolling">scrolling</A> is limited by the
text of the current cursor line.
*<A NAME="athena-intellimouse"></A><B>athena-intellimouse</B>*
If you have an Intellimouse and an X server that supports using the wheel,
then you can use the wheel to scroll the text up and down in <A HREF="starting.html#gvim">gvim</A>. This works
with XFree86 4.0 and later, and with some older versions when you add patches.
See |<A HREF="scroll.html#scroll-mouse-wheel">scroll-mouse-wheel</A>|.
For older versions of XFree86 you must patch your X server. The following
page has a bit of information about using the Intellimouse on Linux <A HREF="motion.html#as">as</A> well <A HREF="motion.html#as">as</A>
links to the patches and X server binaries (may not have the one you need
though):
<A HREF="http://www.inria.fr/koala/colas/mouse-wheel-scroll/">http://www.inria.fr/koala/colas/mouse-wheel-scroll/</A>
==============================================================================
3. Mouse Control *<A NAME="gui-mouse"></A><B>gui-mouse</B>*
The mouse only works if the appropriate flag in the <A HREF="options.html#'mouse'">'mouse'</A> option is set.
When the <A HREF="#GUI">GUI</A> is switched on, and <A HREF="options.html#'mouse'">'mouse'</A> wasn't set yet, the <A HREF="options.html#'mouse'">'mouse'</A> option is
automatically set to "<A HREF="insert.html#a">a</A>", enabling <A HREF="motion.html#it">it</A> for all modes except for the
|<A HREF="message.html#hit-enter">hit-enter</A>| prompt. If you don't want this, a good place to change the
<A HREF="options.html#'mouse'">'mouse'</A> option is the "<A HREF="#gvimrc">gvimrc</A>" file.
Other <A HREF="options.html#options">options</A> that are relevant:
<A HREF="options.html#'mousefocus'">'mousefocus'</A> <A HREF="windows.html#window">window</A> focus follows mouse pointer |<A HREF="#gui-mouse-focus">gui-mouse-focus</A>|
<A HREF="options.html#'mousemodel'">'mousemodel'</A> what mouse button does which action
<A HREF="options.html#'mousehide'">'mousehide'</A> hide mouse pointer while typing text
<A HREF="options.html#'selectmode'">'selectmode'</A> whether to start <A HREF="visual.html#Select">Select</A> mode or <A HREF="visual.html#Visual">Visual</A> mode
A quick way to set these is with the "<A HREF="#:behave">:behave</A>" command.
*<A NAME=":behave"></A><B>:behave</B>* *<A NAME=":be"></A><B>:be</B>*
:be[have] {model} Set behavior for mouse and selection. Valid
arguments are:
mswin <A HREF="os_win32.html#MS-Windows">MS-Windows</A> behavior
xterm Xterm behavior
Using "<A HREF="#:behave">:behave</A>" changes these <A HREF="options.html#options">options</A>:
<B><FONT COLOR="PURPLE"> option mswin xterm </FONT></B>
<A HREF="options.html#'selectmode'">'selectmode'</A> "mouse,key" ""
<A HREF="options.html#'mousemodel'">'mousemodel'</A> "popup" "extend"
<A HREF="options.html#'keymodel'">'keymodel'</A> "startsel,stopsel" ""
<A HREF="options.html#'selection'">'selection'</A> "<A HREF="motion.html#exclusive">exclusive</A>" "<A HREF="motion.html#inclusive">inclusive</A>"
In the <A HREF="starting.html#$VIMRUNTIME">$VIMRUNTIME</A> directory, there is a <A HREF="usr_41.html#script">script</A> called |<A HREF="mswin.html">mswin.vim</A>|, which will
also map a few keys to the <A HREF="os_win32.html#MS-Windows">MS-Windows</A> cut/copy/paste commands. This is NOT
compatible, since <A HREF="motion.html#it">it</A> uses the <A HREF="visual.html#CTRL-V">CTRL-V</A>, <A HREF="change.html#CTRL-X">CTRL-X</A> and <A HREF="pattern.html#CTRL-C">CTRL-C</A> keys. If you don't
mind, use this command:
<B> :so $VIMRUNTIME/mswin.vim</B>
For <A HREF="scroll.html#scrolling">scrolling</A> with a wheel on a mouse, see |<A HREF="scroll.html#scroll-mouse-wheel">scroll-mouse-wheel</A>|.
3.1 Moving Cursor with Mouse *<A NAME="gui-mouse-move"></A><B>gui-mouse-move</B>*
Click the left mouse button somewhere in a text buffer where you want the
cursor to go, and <A HREF="motion.html#it">it</A> does!
<B><FONT COLOR="PURPLE">This works in when 'mouse' contains </FONT></B>
<A HREF="intro.html#Normal">Normal</A> mode '<A HREF="pattern.html#n">n</A>' or '<A HREF="insert.html#a">a</A>'
<A HREF="visual.html#Visual">Visual</A> mode '<A HREF="visual.html#v">v</A>' or '<A HREF="insert.html#a">a</A>'
<A HREF="insert.html#Insert">Insert</A> mode '<A HREF="insert.html#i">i</A>' or '<A HREF="insert.html#a">a</A>'
<A HREF="visual.html#Select">Select</A> mode is handled like <A HREF="visual.html#Visual">Visual</A> mode.
You may use this with an <A HREF="motion.html#operator">operator</A> such <A HREF="motion.html#as">as</A> '<A HREF="change.html#d">d</A>' to delete text from the current
cursor position to the position you point to with the mouse. That is, you hit
'<A HREF="change.html#d">d</A>' and then click the mouse somewhere.
*<A NAME="gui-mouse-focus"></A><B>gui-mouse-focus</B>*
The <A HREF="options.html#'mousefocus'">'mousefocus'</A> option can be set to make the keyboard focus follow the
mouse pointer. This means that the <A HREF="windows.html#window">window</A> where the mouse pointer is, is the
active <A HREF="windows.html#window">window</A>. Warning: this doesn't work very well when using a menu,
because the menu command will always be applied to the top <A HREF="windows.html#window">window</A>.
If you are on the '<A HREF="cmdline.html#:">:</A>' line (or '<A HREF="pattern.html#/">/</A>' or '?'), then clicking the left or right
mouse button will position the cursor on the '<A HREF="cmdline.html#:">:</A>' line (if <A HREF="options.html#'mouse'">'mouse'</A> contains
'<A HREF="change.html#c">c</A>', '<A HREF="insert.html#a">a</A>' or 'A').
In any situation the middle mouse button may be clicked to paste the current
selection.
3.2 Selection with Mouse *<A NAME="gui-mouse-select"></A><B>gui-mouse-select</B>*
The mouse can be used to start a selection. How depends on the <A HREF="options.html#'mousemodel'">'mousemodel'</A>
option:
<A HREF="options.html#'mousemodel'">'mousemodel'</A> is "extend": use the right mouse button
<A HREF="options.html#'mousemodel'">'mousemodel'</A> is "popup": use the left mouse button, while keeping the Shift
key pressed.
If there was no selection yet, this starts a selection from the old cursor
position to the position pointed to with the mouse. If there already is a
selection then the closest end will be extended.
If <A HREF="options.html#'selectmode'">'selectmode'</A> contains "mouse", then the selection will be in <A HREF="visual.html#Select">Select</A> mode.
This means that typing normal text will replace the selection. See
|<A HREF="visual.html#Select-mode">Select-mode</A>|. Otherwise, the selection will be in <A HREF="visual.html#Visual">Visual</A> mode.
Double clicking may be done to make the selection word-wise, triple clicking
makes <A HREF="motion.html#it">it</A> line-wise, and quadruple clicking makes <A HREF="motion.html#it">it</A> rectangular block-wise.
See |<A HREF="#gui-selections">gui-selections</A>| on how the selection is used.
3.3 Other Text Selection with Mouse *<A NAME="gui-mouse-modeless"></A><B>gui-mouse-modeless</B>*
*<A NAME="modeless-selection"></A><B>modeless-selection</B>*
A different kind of selection is used when:
- in <A HREF="cmdline.html#Command-line">Command-line</A> mode
- in the <A HREF="cmdline.html#Command-line">Command-line</A> <A HREF="windows.html#window">window</A> and pointing in another <A HREF="windows.html#window">window</A>
- at the |<A HREF="message.html#hit-enter">hit-enter</A>| prompt
- whenever the current mode is not in the <A HREF="options.html#'mouse'">'mouse'</A> option
- when holding the CTRL and SHIFT keys in the <A HREF="#GUI">GUI</A>
Since Vim continues like the selection isn't there, and there is no mode
associated with the selection, this is called modeless selection. Any text in
the Vim <A HREF="windows.html#window">window</A> can be selected. <A HREF="visual.html#Select">Select</A> the text by pressing the left mouse
button at the start, drag to the end and release. To extend the selection,
use the right mouse button when <A HREF="options.html#'mousemodel'">'mousemodel'</A> is "extend", or the left mouse
button with the <A HREF="intro.html#shift">shift</A> key pressed when <A HREF="options.html#'mousemodel'">'mousemodel'</A> is "popup".
The selection is removed when the selected text is scrolled or changed.
On the command line <A HREF="scroll.html#CTRL-Y">CTRL-Y</A> can be used to copy the selection into the
<A HREF="#clipboard">clipboard</A>. To <A HREF="diff.html#do">do</A> this from <A HREF="insert.html#Insert">Insert</A> mode, use <A HREF="motion.html#CTRL-O">CTRL-O</A> : <A HREF="scroll.html#CTRL-Y">CTRL-Y</A> <A HREF="motion.html#<CR>"><CR></A>. When
<A HREF="options.html#'guioptions'">'guioptions'</A> contains a or A (default on X11), the selection is automatically
copied to the "* <A HREF="sponsor.html#register">register</A>.
The middle mouse button can then paste the text. On non-X11 systems, you can
use <A HREF="undo.html#CTRL-R">CTRL-R</A> +.
3.4 Using Mouse on Status Lines *<A NAME="gui-mouse-status"></A><B>gui-mouse-status</B>*
Clicking the left or right mouse button on the status line below a Vim
<A HREF="windows.html#window">window</A> makes that <A HREF="windows.html#window">window</A> the current <A HREF="windows.html#window">window</A>. This actually happens on button
release (to be able to distinguish a click from a drag action).
With the left mouse button a status line can be dragged up and down, thus
resizing the <A HREF="windows.html#windows">windows</A> above and below <A HREF="motion.html#it">it</A>. This does not change <A HREF="windows.html#window">window</A> focus.
The same can be used on the vertical separator: click to give the <A HREF="windows.html#window">window</A> left
of <A HREF="motion.html#it">it</A> focus, drag left and right to make <A HREF="windows.html#windows">windows</A> wider and narrower.
3.5 Various Mouse Clicks *<A NAME="gui-mouse-various"></A><B>gui-mouse-various</B>*
<A HREF="term.html#<S-LeftMouse>"><S-LeftMouse></A> Search forward for the <A HREF="motion.html#word">word</A> under the mouse click.
When <A HREF="options.html#'mousemodel'">'mousemodel'</A> is "popup" this starts or extends a
selection.
<A HREF="term.html#<S-RightMouse>"><S-RightMouse></A> Search backward for the <A HREF="motion.html#word">word</A> under the mouse click.
<A HREF="tagsrch.html#<C-LeftMouse>"><C-LeftMouse></A> Jump to the <A HREF="tagsrch.html#tag">tag</A> name under the mouse click.
<A HREF="tagsrch.html#<C-RightMouse>"><C-RightMouse></A> Jump back to position before the previous <A HREF="tagsrch.html#tag">tag</A> jump
(same <A HREF="motion.html#as">as</A> "<A HREF="tagsrch.html#CTRL-T">CTRL-T</A>")
3.6 Mouse Mappings *<A NAME="gui-mouse-mapping"></A><B>gui-mouse-mapping</B>*
The mouse events, complete with modifiers, may be mapped. Eg:
<B> :map <S-LeftMouse> <RightMouse></B>
<B> :map <S-LeftDrag> <RightDrag></B>
<B> :map <S-LeftRelease> <RightRelease></B>
<B> :map <2-S-LeftMouse> <2-RightMouse></B>
<B> :map <2-S-LeftDrag> <2-RightDrag></B>
<B> :map <2-S-LeftRelease> <2-RightRelease></B>
<B> :map <3-S-LeftMouse> <3-RightMouse></B>
<B> :map <3-S-LeftDrag> <3-RightDrag></B>
<B> :map <3-S-LeftRelease> <3-RightRelease></B>
<B> :map <4-S-LeftMouse> <4-RightMouse></B>
<B> :map <4-S-LeftDrag> <4-RightDrag></B>
<B> :map <4-S-LeftRelease> <4-RightRelease></B>
These mappings make selection work the way <A HREF="motion.html#it">it</A> probably should in a <A HREF="gui_x11.html#Motif">Motif</A>
application, with shift-left mouse allowing for extending the visual area
rather than the right mouse button.
Mouse <A HREF="map.html#mapping">mapping</A> with modifiers does not work for modeless selection.
3.7 Drag and drop *<A NAME="drag-n-drop"></A><B>drag-n-drop</B>*
You can drag and drop one or more files into the Vim <A HREF="windows.html#window">window</A>, where they will
be opened <A HREF="motion.html#as">as</A> if a |<A HREF="windows.html#:drop">:drop</A>| command was used.
If you hold down Shift while doing this, Vim changes to the first dropped
file's directory. If you hold Ctrl Vim will always split a new <A HREF="windows.html#window">window</A> for the
file. Otherwise it's only done if the current buffer has been changed.
You can also drop a directory on Vim. This starts the explorer <A HREF="usr_05.html#plugin">plugin</A> for
that directory (assuming <A HREF="motion.html#it">it</A> was enabled, otherwise you'll get an error
message). Keep Shift pressed to change to the directory instead.
If Vim happens to be editing a command line, the names of the dropped files
and directories will be inserted at the cursor. This allows you to use these
names with any <A HREF="intro.html#Ex">Ex</A> command. <A HREF="eval.html#Special">Special</A> characters (space, <A HREF="intro.html#tab">tab</A>, double <A HREF="change.html#quote">quote</A> and
'|'; <A HREF="intro.html#backslash">backslash</A> on non-MS-Windows systems) will be escaped.
==============================================================================
4. Making <A HREF="#GUI">GUI</A> Selections *<A NAME="gui-selections"></A><B>gui-selections</B>*
*<A NAME="quotestar"></A><B>quotestar</B>*
You may make selections with the mouse (see |<A HREF="#gui-mouse-select">gui-mouse-select</A>|), or by using
Vim's <A HREF="visual.html#Visual">Visual</A> mode (see |<A HREF="visual.html#v">v</A>|). If '<A HREF="insert.html#a">a</A>' is present in <A HREF="options.html#'guioptions'">'guioptions'</A>, then
whenever a selection is started (Visual or <A HREF="visual.html#Select">Select</A> mode), or when the selection
is changed, Vim becomes the owner of the windowing system's primary selection
(on <A HREF="os_win32.html#MS-Windows">MS-Windows</A> the |<A HREF="gui_w32.html#gui-clipboard">gui-clipboard</A>| is used; under <A HREF="options.html#X11">X11</A>, the |<A HREF="gui_x11.html#x11-selection">x11-selection</A>| is
used - you should read whichever of these is appropriate now).
*<A NAME="clipboard"></A><B>clipboard</B>*
There is a special <A HREF="sponsor.html#register">register</A> for storing this selection, <A HREF="motion.html#it">it</A> is the "*
<A HREF="sponsor.html#register">register</A>. Nothing is put in here unless the information about what text is
selected is about to change (e.g. with a left mouse click somewhere), or when
another application wants to paste the selected text. Then the text is put
in the "* <A HREF="sponsor.html#register">register</A>. For example, to cut a line and make <A HREF="motion.html#it">it</A> the current
selection/put <A HREF="motion.html#it">it</A> on the <A HREF="#clipboard">clipboard</A>:
<B> "*dd</B>
Similarly, when you want to paste a selection from another application, e.g.,
by clicking the middle mouse button, the selection is put in the "* <A HREF="sponsor.html#register">register</A>
first, and then 'put' like any other <A HREF="sponsor.html#register">register</A>. For example, to put the
selection (contents of the clipboard):
<B> "*p</B>
When using this <A HREF="sponsor.html#register">register</A> under <A HREF="options.html#X11">X11</A>, also see |<A HREF="gui_x11.html#x11-selection">x11-selection</A>|. This also
explains the related "<A HREF="motion.html#+">+</A> <A HREF="sponsor.html#register">register</A>.
Note that when pasting text from one Vim into another separate Vim, the type
of selection (character, line, or block) will also be copied. For other
applications the type is always character. However, if the text gets
transferred via the |<A HREF="gui_x11.html#x11-cut-buffer">x11-cut-buffer</A>|, the selection type is ALWAYS lost.
When the "unnamed" <A HREF="eval.html#string">string</A> is included in the <A HREF="options.html#'clipboard'">'clipboard'</A> option, the unnamed
<A HREF="sponsor.html#register">register</A> is the same <A HREF="motion.html#as">as</A> the "* <A HREF="sponsor.html#register">register</A>. Thus you can <A HREF="change.html#yank">yank</A> to and paste the
selection without prepending "* to commands.
==============================================================================
5. Menus *<A NAME="menus"></A><B>menus</B>*
For an introduction see |<A HREF="usr_42.html">usr_42.txt</A>| in the user manual.
5.1 Using Menus *<A NAME="using-menus"></A><B>using-menus</B>*
Basically, <A HREF="#menus">menus</A> can be used just like mappings. You can define your own
<A HREF="#menus">menus</A>, <A HREF="motion.html#as">as</A> many <A HREF="motion.html#as">as</A> you like.
Long-time Vim users won't use <A HREF="#menus">menus</A> much. But the power is in adding your own
<A HREF="#menus">menus</A> and menu items. They are most useful for things that you can't remember
what the key sequence was.
For creating <A HREF="#menus">menus</A> in a different language, see |<A HREF="mlang.html#:menutrans">:menutrans</A>|.
If you don't want to use <A HREF="#menus">menus</A> at all, see |<A HREF="options.html#'go-M'">'go-M'</A>|.
*<A NAME="menu.vim"></A><B>menu.vim</B>*
The default <A HREF="#menus">menus</A> are read from the file "$VIMRUNTIME/menu.vim". See
|<A HREF="starting.html#$VIMRUNTIME">$VIMRUNTIME</A>| for where the path comes from. You can set up your own <A HREF="#menus">menus</A>.
Starting off with the default set is a good idea. You can add more items, or,
if you don't like the defaults at all, start with removing all <A HREF="#menus">menus</A>
|<A HREF="#:unmenu-all">:unmenu-all</A>|. You can also avoid the default <A HREF="#menus">menus</A> being loaded by adding
this line to your <A HREF="starting.html#.vimrc">.vimrc</A> file (NOT your <A HREF="#.gvimrc">.gvimrc</A> file!):
<B> :let did_install_default_menus = 1</B>
If you also want to avoid the <A HREF="autocmd.html#Syntax">Syntax</A> menu:
<B> :let did_install_syntax_menu = 1</B>
The first item in the <A HREF="autocmd.html#Syntax">Syntax</A> menu can be used to show all available <A HREF="filetype.html#filetypes">filetypes</A>
in the menu (which can take a bit of time to load). If you want to have all
<A HREF="filetype.html#filetypes">filetypes</A> already present at <A HREF="starting.html#startup">startup</A>, add:
<B> :let do_syntax_sel_menu = 1</B>
The following menuitems show all available color schemes, keymaps and compiler
settings:
<B><FONT COLOR="PURPLE"> Edit > Color Scheme </FONT></B>
<B><FONT COLOR="PURPLE"> Edit > Keymap </FONT></B>
<B><FONT COLOR="PURPLE"> Tools > Set Compiler </FONT></B>
However, they can also take a bit of time to load, because they search all
related files from the directories in <A HREF="options.html#'runtimepath'">'runtimepath'</A>. Therefore they are
loaded lazily (by the |<A HREF="autocmd.html#CursorHold">CursorHold</A>| event), or you can also load them manually.
If you want to have all these items already present at <A HREF="starting.html#startup">startup</A>, add:
<B> :let do_no_lazyload_menus = 1</B>
Note that the <A HREF="#menu.vim">menu.vim</A> is sourced when `:syntax on` or `:filetype on` is
executed or after your <A HREF="starting.html#.vimrc">.vimrc</A> file is sourced. This means that the <A HREF="options.html#'encoding'">'encoding'</A>
option and the language of <A HREF="message.html#messages">messages</A> (`:language messages`) must be set before
that (if you want to change them).
*<A NAME="console-menus"></A><B>console-menus</B>*
Although this documentation is in the <A HREF="#GUI">GUI</A> section, you can actually use <A HREF="#menus">menus</A>
in console mode too. You will have to load |<A HREF="menu.html">menu.vim</A>| explicitly then, <A HREF="motion.html#it">it</A> is
not done by default. You can use the |<A HREF="#:emenu">:emenu</A>| command and command-line
completion with <A HREF="options.html#'wildmenu'">'wildmenu'</A> to access the menu entries almost like a real menu
system. To <A HREF="diff.html#do">do</A> this, put these commands in your <A HREF="starting.html#.vimrc">.vimrc</A> file:
<B> :source $VIMRUNTIME/menu.vim</B>
<B> :set wildmenu</B>
<B> :set cpo-=<</B>
<B> :set wcm=<C-Z></B>
<B> :map <F4> :emenu <C-Z></B>
Pressing <A HREF="term.html#<F4>"><F4></A> will start the menu. You can now use the cursor keys to select
a menu entry. Hit <A HREF="intro.html#<Enter>"><Enter></A> to execute <A HREF="motion.html#it">it</A>. Hit <A HREF="intro.html#<Esc>"><Esc></A> if you want to cancel.
This does require the |<A HREF="various.html#+menu">+menu</A>| feature enabled at compile time.
*<A NAME="tear-off-menus"></A><B>tear-off-menus</B>*
<A HREF="gui_x11.html#GTK+">GTK+</A> 2 and <A HREF="gui_x11.html#Motif">Motif</A> support Tear-off <A HREF="#menus">menus</A>. These are sort of sticky <A HREF="#menus">menus</A> or
pop-up <A HREF="#menus">menus</A> that are present all the time. If the resizing does not work
correctly, this may be caused by using something like "Vim*geometry" in the
defaults. Use "Vim.geometry" instead.
As to <A HREF="gui_x11.html#GTK+">GTK+</A> 3, tear-off <A HREF="#menus">menus</A> have been deprecated since <A HREF="gui_x11.html#GTK+">GTK+</A> 3.4.
Accordingly, they are disabled if <A HREF="starting.html#gvim">gvim</A> is linked against <A HREF="gui_x11.html#GTK+">GTK+</A> 3.4 or later.
The <A HREF="os_win32.html#Win32">Win32</A> <A HREF="#GUI">GUI</A> version emulates Motif's tear-off <A HREF="#menus">menus</A>. Actually, a <A HREF="gui_x11.html#Motif">Motif</A> user
will spot the differences easily, but hopefully they're just <A HREF="motion.html#as">as</A> useful. You
can also use the |<A HREF="gui_w32.html#:tearoff">:tearoff</A>| command together with |<A HREF="#hidden-menus">hidden-menus</A>| to create
floating <A HREF="#menus">menus</A> that <A HREF="diff.html#do">do</A> not appear on the main menu <A HREF="motion.html#bar">bar</A>.
5.2 Creating New Menus *<A NAME="creating-menus"></A><B>creating-menus</B>*
*<A NAME=":me"></A><B>:me</B>* *<A NAME=":menu"></A><B>:menu</B>* *<A NAME=":noreme"></A><B>:noreme</B>* *<A NAME=":noremenu"></A><B>:noremenu</B>*
*<A NAME=":am"></A><B>:am</B>* *<A NAME=":amenu"></A><B>:amenu</B>* *<A NAME=":an"></A><B>:an</B>* *<A NAME=":anoremenu"></A><B>:anoremenu</B>*
*<A NAME=":nme"></A><B>:nme</B>* *<A NAME=":nmenu"></A><B>:nmenu</B>* *<A NAME=":nnoreme"></A><B>:nnoreme</B>* *<A NAME=":nnoremenu"></A><B>:nnoremenu</B>*
*<A NAME=":ome"></A><B>:ome</B>* *<A NAME=":omenu"></A><B>:omenu</B>* *<A NAME=":onoreme"></A><B>:onoreme</B>* *<A NAME=":onoremenu"></A><B>:onoremenu</B>*
*<A NAME=":vme"></A><B>:vme</B>* *<A NAME=":vmenu"></A><B>:vmenu</B>* *<A NAME=":vnoreme"></A><B>:vnoreme</B>* *<A NAME=":vnoremenu"></A><B>:vnoremenu</B>*
*<A NAME=":xme"></A><B>:xme</B>* *<A NAME=":xmenu"></A><B>:xmenu</B>* *<A NAME=":xnoreme"></A><B>:xnoreme</B>* *<A NAME=":xnoremenu"></A><B>:xnoremenu</B>*
*<A NAME=":sme"></A><B>:sme</B>* *<A NAME=":smenu"></A><B>:smenu</B>* *<A NAME=":snoreme"></A><B>:snoreme</B>* *<A NAME=":snoremenu"></A><B>:snoremenu</B>*
*<A NAME=":ime"></A><B>:ime</B>* *<A NAME=":imenu"></A><B>:imenu</B>* *<A NAME=":inoreme"></A><B>:inoreme</B>* *<A NAME=":inoremenu"></A><B>:inoremenu</B>*
*<A NAME=":cme"></A><B>:cme</B>* *<A NAME=":cmenu"></A><B>:cmenu</B>* *<A NAME=":cnoreme"></A><B>:cnoreme</B>* *<A NAME=":cnoremenu"></A><B>:cnoremenu</B>*
*<A NAME="E330"></A><B>E330</B>* *<A NAME="E327"></A><B>E327</B>* *<A NAME="E331"></A><B>E331</B>* *<A NAME="E336"></A><B>E336</B>* *<A NAME="E333"></A><B>E333</B>*
*<A NAME="E328"></A><B>E328</B>* *<A NAME="E329"></A><B>E329</B>* *<A NAME="E337"></A><B>E337</B>* *<A NAME="E792"></A><B>E792</B>*
To create a new menu item, use the "<A HREF="#:menu">:menu</A>" commands. They are mostly like
the "<A HREF="map.html#:map">:map</A>" set of commands but the first argument is a menu item name, given
<A HREF="motion.html#as">as</A> a path of <A HREF="#menus">menus</A> and submenus with a '<A HREF="repeat.html#.">.</A>' between them, e.g.:
<B> :menu File.Save :w<CR></B>
<B> :inoremenu File.Save <C-O>:w<CR></B>
<B> :menu Edit.Big\ Changes.Delete\ All\ Spaces :%s/[ ^I]//g<CR></B>
This last one will create a new item in the menu <A HREF="motion.html#bar">bar</A> called "Edit", holding
the mouse button down on this will pop up a menu containing the item
"Big Changes", which is a sub-menu containing the item "Delete All Spaces",
which when selected, performs the operation.
<A HREF="eval.html#Special">Special</A> characters in a menu name:
<A HREF="change.html#&">&</A> The next character is the shortcut key. Make sure each
shortcut key is only used once in a (sub)menu. If you want to
insert a literal "<A HREF="change.html#&">&</A>" in the menu name use "&&".
<A HREF="motion.html#<Tab>"><Tab></A> Separates the menu name from right-aligned text. This can be
used to show the equivalent typed command. The text "<A HREF="motion.html#<Tab>"><Tab></A>"
can be used here for convenience. If you are using a real
<A HREF="intro.html#tab">tab</A>, don't forget to put a <A HREF="intro.html#backslash">backslash</A> before <A HREF="motion.html#it">it</A>!
Example:
<B> :amenu &File.&Open<Tab>:e :browse e<CR></B>
[typed literally]
With the shortcut "<A HREF="motion.html#F">F</A>" (while keeping the <Alt> key pressed), and then "<A HREF="insert.html#O">O</A>",
this menu can be used. The second part is shown <A HREF="motion.html#as">as</A> "Open :e". The "<A HREF="editing.html#:e">:e</A>"
is right aligned, and the "<A HREF="insert.html#O">O</A>" is underlined, to indicate <A HREF="motion.html#it">it</A> is the shortcut.
The "<A HREF="#:amenu">:amenu</A>" command can be used to define menu entries for all modes at once.
To make the command work correctly, a character is automatically inserted for
some modes:
<B><FONT COLOR="PURPLE"> mode inserted appended </FONT></B>
<A HREF="intro.html#Normal">Normal</A> nothing nothing
<A HREF="visual.html#Visual">Visual</A> <C-C> <C-\><C-G>
<A HREF="insert.html#Insert">Insert</A> <C-\><C-O>
<A HREF="cmdline.html#Cmdline">Cmdline</A> <C-C> <C-\><C-G>
Op-pending <C-C> <C-\><C-G>
Appending CTRL-\ <A HREF="editing.html#CTRL-G">CTRL-G</A> is for going back to insert mode when <A HREF="options.html#'insertmode'">'insertmode'</A> is
set. |<A HREF="intro.html#CTRL-\_CTRL-G">CTRL-\_CTRL-G</A>|
Example:
<B> :amenu File.Next :next^M</B>
is equal to:
<B> :nmenu File.Next :next^M</B>
<B> :vmenu File.Next ^C:next^M^\^G</B>
<B> :imenu File.Next ^\^O:next^M</B>
<B> :cmenu File.Next ^C:next^M^\^G</B>
<B> :omenu File.Next ^C:next^M^\^G</B>
Careful: In <A HREF="insert.html#Insert">Insert</A> mode this only works for a SINGLE <A HREF="intro.html#Normal">Normal</A> mode command,
because of the <A HREF="motion.html#CTRL-O">CTRL-O</A>. If you have two or more commands, you will need to use
the "<A HREF="#:imenu">:imenu</A>" command. For <A HREF="insert.html#inserting">inserting</A> text in any mode, you can use the
<A HREF="eval.html#expression">expression</A> <A HREF="sponsor.html#register">register</A>:
<B> :amenu Insert.foobar "='foobar'<CR>P</B>
Note that the '<A HREF="change.html#<"><</A>' and '<A HREF="motion.html#k">k</A>' flags in <A HREF="options.html#'cpoptions'">'cpoptions'</A> also apply here (when
included they make the <A HREF="intro.html#<>"><></A> form and raw key codes not being recognized).
Note that <A HREF="intro.html#<Esc>"><Esc></A> in <A HREF="cmdline.html#Cmdline">Cmdline</A> mode executes the command, like in a <A HREF="map.html#mapping">mapping</A>. This
is <A HREF="intro.html#Vi">Vi</A> compatible. Use <A HREF="pattern.html#CTRL-C">CTRL-C</A> to quit <A HREF="cmdline.html#Cmdline">Cmdline</A> mode.
*<A NAME=":menu-<silent>"></A><B>:menu-<silent></B>* *<A NAME=":menu-silent"></A><B>:menu-silent</B>*
To define a menu which will not be echoed on the command line, add
"<silent>" <A HREF="motion.html#as">as</A> the first argument. Example:
<B> :menu <silent> Settings.Ignore\ case :set ic<CR></B>
The "<A HREF="options.html#:set">:set</A> <A HREF="options.html#'ic'">ic</A>" will not be echoed when using this menu. Messages from the
executed command are still given though. To shut them up too, add a "<A HREF="various.html#:silent">:silent</A>"
in the executed command:
<B> :menu <silent> Search.Header :exe ":silent normal /Header\r"<CR></B>
"<silent>" may also appear just after "<special>" or "<script>".
*<A NAME=":menu-<special>"></A><B>:menu-<special></B>* *<A NAME=":menu-special"></A><B>:menu-special</B>*
Define a menu with <A HREF="intro.html#<>"><></A> <A HREF="intro.html#notation">notation</A> for special keys, even though the "<A HREF="change.html#<"><</A>" flag
may appear in <A HREF="options.html#'cpoptions'">'cpoptions'</A>. This is useful if the side effect of setting
<A HREF="options.html#'cpoptions'">'cpoptions'</A> is not desired. Example:
<B> :menu <special> Search.Header /Header<CR></B>
"<special>" must appear <A HREF="motion.html#as">as</A> the very first argument to the "<A HREF="#:menu">:menu</A>" command or
just after "<silent>" or "<script>".
*<A NAME=":menu-<script>"></A><B>:menu-<script></B>* *<A NAME=":menu-script"></A><B>:menu-script</B>*
The "to" part of the menu will be inspected for mappings. If you don't want
this, use the "<A HREF="#:noremenu">:noremenu</A>" command (or the similar one for a specific mode).
If you <A HREF="diff.html#do">do</A> want to use <A HREF="map.html#script-local">script-local</A> mappings, add "<script>" <A HREF="motion.html#as">as</A> the very first
argument to the "<A HREF="#:menu">:menu</A>" command or just after "<silent>" or "<special>".
*<A NAME="menu-priority"></A><B>menu-priority</B>*
You can give a priority to a menu. Menus with a higher priority go more to
the right. The priority is given <A HREF="motion.html#as">as</A> a number before the "<A HREF="#:menu">:menu</A>" command.
Example:
<B> :80menu Buffer.next :bn<CR></B>
The default <A HREF="#menus">menus</A> have these priorities:
File 10
Edit 20
Tools 40
<A HREF="autocmd.html#Syntax">Syntax</A> 50
Buffers 60
Window 70
Help 9999
When no or zero priority is given, 500 is used.
The priority for the PopUp menu is not used.
The Help menu will be placed on the far right side of the menu <A HREF="motion.html#bar">bar</A> on systems
which support this (Motif and <A HREF="gui_x11.html#GTK+">GTK+</A>). For <A HREF="gui_x11.html#GTK+">GTK+</A> 2 and 3, this is not done
anymore because right-aligning the Help menu is now discouraged UI design.
You can use a priority higher than 9999, to make <A HREF="motion.html#it">it</A> go after the Help menu,
but that is non-standard and is discouraged. The highest possible priority is
about 32000. The lowest is 1.
*<A NAME="sub-menu-priority"></A><B>sub-menu-priority</B>*
The same mechanism can be used to position a sub-menu. The priority is then
given <A HREF="motion.html#as">as</A> a dot-separated <A HREF="eval.html#list">list</A> of priorities, before the menu name:
<B> :menu 80.500 Buffer.next :bn<CR></B>
Giving the sub-menu priority is only needed when the item is not to be put
in a normal position. For example, to put a sub-menu before the other items:
<B> :menu 80.100 Buffer.first :brew<CR></B>
Or to put a sub-menu after the other items, and further items with default
priority will be put before <A HREF="motion.html#it">it</A>:
<B> :menu 80.900 Buffer.last :blast<CR></B>
When a number is missing, the default value 500 will be used:
<B> :menu .900 myMenu.test :echo "text"<CR></B>
The menu priority is only used when creating a new menu. When <A HREF="motion.html#it">it</A> already
existed, e.g., in another mode, the priority will not change. Thus, the
priority only needs to be given the first time a menu is used.
An exception is the PopUp menu. There is a separate menu for each mode
(Normal, Op-pending, <A HREF="visual.html#Visual">Visual</A>, <A HREF="insert.html#Insert">Insert</A>, <A HREF="cmdline.html#Cmdline">Cmdline</A>). The order in each of these
<A HREF="#menus">menus</A> can be different. This is different from menu-bar <A HREF="#menus">menus</A>, which have
the same order for all modes.
NOTE: sub-menu priorities currently don't work for all versions of the <A HREF="#GUI">GUI</A>.
*<A NAME="menu-separator"></A><B>menu-separator</B>* *<A NAME="E332"></A><B>E332</B>*
Menu items can be separated by a special item that inserts some space between
items. Depending on the system this is displayed <A HREF="motion.html#as">as</A> a line or a dotted line.
These items must start with a '<A HREF="motion.html#-">-</A>' and end in a '<A HREF="motion.html#-">-</A>'. The part in between is
used to give <A HREF="motion.html#it">it</A> a unique name. Priorities can be used <A HREF="motion.html#as">as</A> with normal items.
Example:
<B> :menu Example.item1 :do something</B>
<B> :menu Example.-Sep- :</B>
<B> :menu Example.item2 :do something different</B>
Note that the separator also requires a rhs. It doesn't matter what <A HREF="motion.html#it">it</A> is,
because the item will never be selected. Use a single colon to keep <A HREF="motion.html#it">it</A>
simple.
*<A NAME="gui-toolbar"></A><B>gui-toolbar</B>*
The toolbar is currently available in the <A HREF="os_win32.html#Win32">Win32</A>, <A HREF="gui_x11.html#Athena">Athena</A>, <A HREF="gui_x11.html#Motif">Motif</A>, <A HREF="gui_x11.html#GTK+">GTK+</A> (X11),
and Photon <A HREF="#GUI">GUI</A>. It should turn up in other GUIs in due course. The
default toolbar is setup in <A HREF="#menu.vim">menu.vim</A>.
The display of the toolbar is controlled by the <A HREF="options.html#'guioptions'">'guioptions'</A> <A HREF="print.html#letter">letter</A> '<A HREF="motion.html#T">T</A>'. You
can thus have menu <A HREF="change.html#&">&</A> toolbar together, or either on its own, or neither.
The appearance is controlled by the <A HREF="options.html#'toolbar'">'toolbar'</A> option. You can choose between
an image, text or both.
*<A NAME="toolbar-icon"></A><B>toolbar-icon</B>*
The toolbar is defined <A HREF="motion.html#as">as</A> a special menu called ToolBar, which only has one
level. Vim interprets the items in this menu <A HREF="motion.html#as">as</A> follows:
1) If an "icon=" argument was specified, the file with this name is used.
The file can either be specified with the full path or with the base name.
In the last <A HREF="change.html#case">case</A> <A HREF="motion.html#it">it</A> is searched for in the "bitmaps" directory in
<A HREF="options.html#'runtimepath'">'runtimepath'</A>, like in point 3. Examples:
<B> :amenu icon=/usr/local/pixmaps/foo_icon.xpm ToolBar.Foo :echo "Foo"<CR></B>
<B> :amenu icon=FooIcon ToolBar.Foo :echo "Foo"<CR></B>
Note that in the first <A HREF="change.html#case">case</A> the extension is included, while in the second
<A HREF="change.html#case">case</A> <A HREF="motion.html#it">it</A> is omitted.
If the file cannot be opened the next points are tried.
A space in the file name must be escaped with a <A HREF="intro.html#backslash">backslash</A>.
A menu priority must come _after_ the icon argument:
<B> :amenu icon=foo 1.42 ToolBar.Foo :echo "42!"<CR></B>
2) An item called 'BuiltIn##', where ## is a number, is taken <A HREF="motion.html#as">as</A> number ## of
the built-in bitmaps available in Vim. Currently there are 31 numbered
from 0 to 30 which cover most common editing operations |<A HREF="#builtin-tools">builtin-tools</A>|.
<B> :amenu ToolBar.BuiltIn22 :call SearchNext("back")<CR></B>
3) An item with another name is first searched for in the directory
"bitmaps" in <A HREF="options.html#'runtimepath'">'runtimepath'</A>. If found, the bitmap file is used <A HREF="motion.html#as">as</A> the
toolbar button image. Note that the exact filename is OS-specific: For
example, under <A HREF="os_win32.html#Win32">Win32</A> the command
<B> :amenu ToolBar.Hello :echo "hello"<CR></B>
would find the file 'hello.bmp'. Under GTK+/X11 <A HREF="motion.html#it">it</A> is 'Hello.xpm'. With
<A HREF="gui_x11.html#GTK+">GTK+</A> 2 the files 'Hello.png', 'Hello.xpm' and 'Hello.bmp' are checked for
existence, and the first one found would be used.
For <A HREF="os_win32.html#MS-Windows">MS-Windows</A> and <A HREF="gui_x11.html#GTK+">GTK+</A> 2 the bitmap is scaled to fit the button. For
<A HREF="os_win32.html#MS-Windows">MS-Windows</A> a size of 18 by 18 pixels works best.
For <A HREF="os_win32.html#MS-Windows">MS-Windows</A> the bitmap should have 16 colors with the standard palette.
The light grey pixels will be changed to the Window frame color and the
dark grey pixels to the <A HREF="windows.html#window">window</A> shadow color. More colors might also work,
depending on your system.
4) If the bitmap is still not found, Vim checks for a match against its <A HREF="eval.html#list">list</A>
of built-in names. Each built-in button image has a name.
So the command
<B> :amenu ToolBar.Open :e</B>
will show the built-in "open a file" button image if no open.bmp exists.
All the built-in names can be seen used in <A HREF="#menu.vim">menu.vim</A>.
5) If all else fails, a blank, but functioning, button is displayed.
*<A NAME="builtin-tools"></A><B>builtin-tools</B>*
<B><FONT COLOR="PURPLE">nr Name Normal action </FONT></B>
00 New open new <A HREF="windows.html#window">window</A>
01 Open browse for file to open in current <A HREF="windows.html#window">window</A>
02 Save write buffer to file
03 Undo <A HREF="undo.html#undo">undo</A> last change
04 Redo <A HREF="undo.html#redo">redo</A> last undone change
05 Cut delete selected text to <A HREF="#clipboard">clipboard</A>
06 Copy copy selected text to <A HREF="#clipboard">clipboard</A>
07 Paste paste text from <A HREF="#clipboard">clipboard</A>
08 Print print current buffer
09 Help open a buffer on Vim's builtin help
10 Find start a search command
11 SaveAll write all modified <A HREF="windows.html#buffers">buffers</A> to file
12 SaveSesn write session file for current situation
13 NewSesn write new session file
14 LoadSesn load session file
15 RunScript browse for file to run <A HREF="motion.html#as">as</A> a Vim <A HREF="usr_41.html#script">script</A>
16 <A HREF="insert.html#Replace">Replace</A> prompt for substitute command
17 WinClose close current <A HREF="windows.html#window">window</A>
18 WinMax make current <A HREF="windows.html#window">window</A> use many lines
19 WinMin make current <A HREF="windows.html#window">window</A> use few lines
20 WinSplit split current <A HREF="windows.html#window">window</A>
21 Shell start a shell
22 FindPrev search again, backward
23 FindNext search again, forward
24 FindHelp prompt for <A HREF="motion.html#word">word</A> to search help for
25 Make run make and jump to first error
26 TagJump jump to <A HREF="tagsrch.html#tag">tag</A> under the cursor
27 RunCtags build <A HREF="tagsrch.html#tags">tags</A> for files in current directory
28 WinVSplit split current <A HREF="windows.html#window">window</A> vertically
29 WinMaxWidth make current <A HREF="windows.html#window">window</A> use many columns
30 WinMinWidth make current <A HREF="windows.html#window">window</A> use few columns
*<A NAME="hidden-menus"></A><B>hidden-menus</B>* *<A NAME="win32-hidden-menus"></A><B>win32-hidden-menus</B>*
In the <A HREF="os_win32.html#Win32">Win32</A> and <A HREF="gui_x11.html#GTK+">GTK+</A> <A HREF="#GUI">GUI</A>, starting a menu name with '<A HREF="index.html#]">]</A>' excludes that menu
from the main menu <A HREF="motion.html#bar">bar</A>. You must then use the |<A HREF="#:popup">:popup</A>| or |<A HREF="gui_w32.html#:tearoff">:tearoff</A>| command
to display <A HREF="motion.html#it">it</A>.
*<A NAME="window-toolbar"></A><B>window-toolbar</B>* *<A NAME="WinBar"></A><B>WinBar</B>*
Each <A HREF="windows.html#window">window</A> can have a local toolbar. This uses the first line of the <A HREF="windows.html#window">window</A>,
thus reduces the space for the text by one line. The items in the toolbar
must start with "<A HREF="#WinBar">WinBar</A>".
Only text can be used. When using <A HREF="mbyte.html#Unicode">Unicode</A>, special characters can be used to
make the items look like icons.
If the items <A HREF="diff.html#do">do</A> not fit then the last ones cannot be used. The toolbar does
not wrap.
Note that Vim may be in any mode when executing these commands. The menu
should be defined for <A HREF="intro.html#Normal">Normal</A> mode and will be executed without <A HREF="change.html#changing">changing</A> the
current mode. Thus if the current <A HREF="windows.html#window">window</A> is in <A HREF="visual.html#Visual">Visual</A> mode and the menu
command does not intentionally change the mode, Vim will remain in <A HREF="visual.html#Visual">Visual</A>
mode. Best is to use `:nnoremenu` to avoid side effects.
Example for debugger tools:
<B> nnoremenu 1.10 WinBar.Step :Step<CR></B>
<B> nnoremenu 1.20 WinBar.Next :Next<CR></B>
<B> nnoremenu 1.30 WinBar.Finish :Finish<CR></B>
<B> nnoremenu 1.40 WinBar.Cont :Continue<CR></B>
The <A HREF="windows.html#window">window</A> toolbar uses the ToolbarLine and ToolbarButton highlight groups.
When splitting the <A HREF="windows.html#window">window</A> the <A HREF="windows.html#window">window</A> toolbar is not copied to the new <A HREF="windows.html#window">window</A>.
*<A NAME="popup-menu"></A><B>popup-menu</B>*
In the <A HREF="os_win32.html#Win32">Win32</A>, <A HREF="gui_x11.html#GTK+">GTK+</A>, <A HREF="gui_x11.html#Motif">Motif</A>, <A HREF="gui_x11.html#Athena">Athena</A> and Photon <A HREF="#GUI">GUI</A>, you can define the
special menu "PopUp". This is the menu that is displayed when the right mouse
button is pressed, if <A HREF="options.html#'mousemodel'">'mousemodel'</A> is set to popup or popup_setpos.
Example:
<B> nnoremenu 1.40 PopUp.&Paste "+gP</B>
<B> menu PopUp</B>
5.3 Showing What Menus Are Mapped To *<A NAME="showing-menus"></A><B>showing-menus</B>*
To see what an existing menu is mapped to, use just one argument after the
menu commands (just like you would with the "<A HREF="map.html#:map">:map</A>" commands). If the menu
specified is a submenu, then all <A HREF="#menus">menus</A> under that hierarchy will be shown.
If no argument is given after <A HREF="#:menu">:menu</A> at all, then ALL menu items are shown
for the appropriate mode (e.g., <A HREF="cmdline.html#Command-line">Command-line</A> mode for <A HREF="#:cmenu">:cmenu</A>).
<A HREF="eval.html#Special">Special</A> characters in the <A HREF="eval.html#list">list</A>, just before the rhs:
* The menu was defined with "nore" to disallow remapping.
<A HREF="change.html#&">&</A> The menu was defined with "<script>" to allow remapping <A HREF="map.html#script-local">script-local</A>
mappings only.
- The menu was disabled.
Note that hitting <A HREF="motion.html#<Tab>"><Tab></A> while entering a menu name after a menu command may
be used to complete the name of the menu item.
5.4 Executing Menus *<A NAME="execute-menus"></A><B>execute-menus</B>*
*<A NAME=":em"></A><B>:em</B>* *<A NAME=":emenu"></A><B>:emenu</B>* *<A NAME="E334"></A><B>E334</B>* *<A NAME="E335"></A><B>E335</B>*
:[range]em[enu] {menu} Execute {menu} from the command line.
The default is to execute the <A HREF="intro.html#Normal">Normal</A> mode
menu. If a range is specified, <A HREF="motion.html#it">it</A> executes
the <A HREF="visual.html#Visual">Visual</A> mode menu.
If used from <c-o>, <A HREF="motion.html#it">it</A> executes the
insert-mode menu Eg:
<B> :emenu File.Exit</B>
If the console-mode vim has been compiled with WANT_MENU defined, you can
use <A HREF="#:emenu">:emenu</A> to access useful menu items you may have got used to from <A HREF="#GUI">GUI</A>
mode. See <A HREF="options.html#'wildmenu'">'wildmenu'</A> for an option that works well with this. See
|<A HREF="#console-menus">console-menus</A>| for an example.
When using a range, if the lines match with '<,'>, then the menu is executed
using the last visual selection.
5.5 Deleting Menus *<A NAME="delete-menus"></A><B>delete-menus</B>*
*<A NAME=":unme"></A><B>:unme</B>* *<A NAME=":unmenu"></A><B>:unmenu</B>*
*<A NAME=":aun"></A><B>:aun</B>* *<A NAME=":aunmenu"></A><B>:aunmenu</B>*
*<A NAME=":nunme"></A><B>:nunme</B>* *<A NAME=":nunmenu"></A><B>:nunmenu</B>*
*<A NAME=":ounme"></A><B>:ounme</B>* *<A NAME=":ounmenu"></A><B>:ounmenu</B>*
*<A NAME=":vunme"></A><B>:vunme</B>* *<A NAME=":vunmenu"></A><B>:vunmenu</B>*
*<A NAME=":xunme"></A><B>:xunme</B>* *<A NAME=":xunmenu"></A><B>:xunmenu</B>*
*<A NAME=":sunme"></A><B>:sunme</B>* *<A NAME=":sunmenu"></A><B>:sunmenu</B>*
*<A NAME=":iunme"></A><B>:iunme</B>* *<A NAME=":iunmenu"></A><B>:iunmenu</B>*
*<A NAME=":cunme"></A><B>:cunme</B>* *<A NAME=":cunmenu"></A><B>:cunmenu</B>*
To delete a menu item or a whole submenu, use the unmenu commands, which are
analogous to the unmap commands. Eg:
<B> :unmenu! Edit.Paste</B>
This will remove the Paste item from the Edit menu for <A HREF="insert.html#Insert">Insert</A> and
<A HREF="cmdline.html#Command-line">Command-line</A> modes.
Note that hitting <A HREF="motion.html#<Tab>"><Tab></A> while entering a menu name after an umenu command
may be used to complete the name of the menu item for the appropriate mode.
To remove all <A HREF="#menus">menus</A> use: *<A NAME=":unmenu-all"></A><B>:unmenu-all</B>*
<B> :unmenu * " remove all menus in Normal and visual mode</B>
<B> :unmenu! * " remove all menus in Insert and Command-line mode</B>
<B> :aunmenu * " remove all menus in all modes</B>
If you want to get rid of the menu <A HREF="motion.html#bar">bar</A>:
<B> :set guioptions-=m</B>
5.6 Disabling Menus *<A NAME="disable-menus"></A><B>disable-menus</B>*
*<A NAME=":menu-disable"></A><B>:menu-disable</B>* *<A NAME=":menu-enable"></A><B>:menu-enable</B>*
If you <A HREF="diff.html#do">do</A> not want to remove a menu, but disable <A HREF="motion.html#it">it</A> for a moment, this can be
done by adding the "enable" or "disable" keyword to a "<A HREF="#:menu">:menu</A>" command.
Examples:
<B> :menu disable &File.&Open\.\.\.</B>
<B> :amenu enable *</B>
<B> :amenu disable &Tools.*</B>
The command applies to the modes <A HREF="motion.html#as">as</A> used with all menu commands. Note that
characters like "<A HREF="change.html#&">&</A>" need to be included for translated names to be found.
When the argument is "*", all <A HREF="#menus">menus</A> are affected. Otherwise the given menu
name and all existing submenus below <A HREF="motion.html#it">it</A> are affected.
5.7 Examples for Menus *<A NAME="menu-examples"></A><B>menu-examples</B>*
Here is an example on how to add menu items with menu's! You can add a menu
item for the keyword under the cursor. The <A HREF="sponsor.html#register">register</A> "<A HREF="index.html#z">z</A>" is used.
<B> :nmenu Words.Add\ Var wb"zye:menu! Words.<C-R>z <C-R>z<CR></B>
<B> :nmenu Words.Remove\ Var wb"zye:unmenu! Words.<C-R>z<CR></B>
<B> :vmenu Words.Add\ Var "zy:menu! Words.<C-R>z <C-R>z <CR></B>
<B> :vmenu Words.Remove\ Var "zy:unmenu! Words.<C-R>z<CR></B>
<B> :imenu Words.Add\ Var <Esc>wb"zye:menu! Words.<C-R>z <C-R>z<CR>a</B>
<B> :imenu Words.Remove\ Var <Esc>wb"zye:unmenu! Words.<C-R>z<CR>a</B>
(the rhs is in <A HREF="intro.html#<>"><></A> <A HREF="intro.html#notation">notation</A>, you can copy/paste this text to try out the
mappings, or put these lines in your <A HREF="#gvimrc">gvimrc</A>; "<C-R>" is <A HREF="undo.html#CTRL-R">CTRL-R</A>, "<A HREF="motion.html#<CR>"><CR></A>" is
the <A HREF="motion.html#<CR>"><CR></A> key. |<A HREF="intro.html#<>"><></A>|)
5.8 Tooltips <A HREF="change.html#&">&</A> Menu <A HREF="tips.html#tips">tips</A>
See section |<A HREF="usr_42.html#42.4">42.4</A>| in the user manual.
*<A NAME=":tmenu"></A><B>:tmenu</B>* *<A NAME=":tm"></A><B>:tm</B>*
:tm[enu] {menupath} <A HREF="map.html#{rhs}">{rhs}</A> Define a tip for a menu or tool. {only in
<A HREF="options.html#X11">X11</A> and <A HREF="os_win32.html#Win32">Win32</A> GUI}
:tm[enu] [menupath] <A HREF="eval.html#List">List</A> menu <A HREF="tips.html#tips">tips</A>. {only in <A HREF="options.html#X11">X11</A> and <A HREF="os_win32.html#Win32">Win32</A> GUI}
*<A NAME=":tunmenu"></A><B>:tunmenu</B>* *<A NAME=":tu"></A><B>:tu</B>*
:tu[nmenu] {menupath} Remove a tip for a menu or tool.
{only in <A HREF="options.html#X11">X11</A> and <A HREF="os_win32.html#Win32">Win32</A> GUI}
When a tip is defined for a menu item, <A HREF="motion.html#it">it</A> appears in the command-line area
when the mouse is over that item, much like a standard Windows menu hint in
the status <A HREF="motion.html#bar">bar</A>. (Except when Vim is in <A HREF="cmdline.html#Command-line">Command-line</A> mode, when of course
nothing is displayed.)
When a tip is defined for a ToolBar item, <A HREF="motion.html#it">it</A> appears <A HREF="motion.html#as">as</A> a tooltip when the
mouse pauses over that button, in the usual fashion. Use the |<A HREF="syntax.html#hl-Tooltip">hl-Tooltip</A>|
highlight group to change its colors.
A "tip" can be defined for each menu item. For example, when defining a menu
item like this:
<B> :amenu MyMenu.Hello :echo "Hello"<CR></B>
The tip is defined like this:
<B> :tmenu MyMenu.Hello Displays a greeting.</B>
And delete <A HREF="motion.html#it">it</A> with:
<B> :tunmenu MyMenu.Hello</B>
Tooltips are currently only supported for the <A HREF="options.html#X11">X11</A> and <A HREF="os_win32.html#Win32">Win32</A> <A HREF="#GUI">GUI</A>. However, they
should appear for the other <A HREF="#gui">gui</A> platforms in the not too distant future.
The "<A HREF="#:tmenu">:tmenu</A>" command works just like other menu commands, <A HREF="motion.html#it">it</A> uses the same
arguments. "<A HREF="#:tunmenu">:tunmenu</A>" deletes an existing menu tip, in the same way <A HREF="motion.html#as">as</A> the
other unmenu commands.
If a menu item becomes invalid (i.e. its actions in all modes are deleted) Vim
deletes the menu tip (and the item) for you. This means that <A HREF="#:aunmenu">:aunmenu</A> deletes
a menu item - you don't need to <A HREF="diff.html#do">do</A> a <A HREF="#:tunmenu">:tunmenu</A> <A HREF="motion.html#as">as</A> well.
5.9 Popup Menus
In the <A HREF="os_win32.html#Win32">Win32</A> and <A HREF="gui_x11.html#GTK+">GTK+</A> <A HREF="#GUI">GUI</A>, you can cause a menu to popup at the cursor.
This behaves similarly to the PopUp <A HREF="#menus">menus</A> except that any menu tree can
be popped up.
This command is for backwards compatibility, using <A HREF="motion.html#it">it</A> is discouraged, because
<A HREF="motion.html#it">it</A> behaves in a strange way.
*<A NAME=":popup"></A><B>:popup</B>* *<A NAME=":popu"></A><B>:popu</B>*
:popu[p] {name} Popup the menu {name}. The menu named must
have at least one subentry, but need not
appear on the menu-bar (see |<A HREF="#hidden-menus">hidden-menus</A>|).
{only available for <A HREF="os_win32.html#Win32">Win32</A> and <A HREF="gui_x11.html#GTK">GTK</A> GUI}
:popu[p]! {name} Like above, but use the position of the mouse
pointer instead of the cursor.
Example:
<B> :popup File</B>
will make the "File" menu (if there is one) appear at the text cursor (mouse
pointer if ! was used).
<B> :amenu ]Toolbar.Make :make<CR></B>
<B> :popup ]Toolbar</B>
This creates a popup menu that doesn't exist on the main menu-bar.
Note that a menu that starts with '<A HREF="index.html#]">]</A>' will not be displayed.
==============================================================================
6. Extras *<A NAME="gui-extras"></A><B>gui-extras</B>*
This section describes other features which are related to the <A HREF="#GUI">GUI</A>.
- With the <A HREF="#GUI">GUI</A>, there is no wait for one second after hitting <A HREF="intro.html#escape">escape</A>, because
the key codes don't start with <A HREF="intro.html#<Esc>"><Esc></A>.
- Typing ^V followed by a special key in the <A HREF="#GUI">GUI</A> will insert "<Key>", since
the internal <A HREF="eval.html#string">string</A> used is meaningless. Modifiers may also be held down to
get "<Modifiers-Key>".
- In the <A HREF="#GUI">GUI</A>, the modifiers SHIFT, CTRL, and ALT (or META) may be used within
mappings of special keys and mouse events. E.g.: <A HREF="map.html#:map">:map</A> <M-LeftDrag> <A HREF="term.html#<LeftDrag>"><LeftDrag></A>
- In the <A HREF="#GUI">GUI</A>, several normal keys may have modifiers in mappings etc, these
are <A HREF="motion.html#<Space>"><Space></A>, <A HREF="motion.html#<Tab>"><Tab></A>, <A HREF="motion.html#<NL>"><NL></A>, <A HREF="motion.html#<CR>"><CR></A>, <A HREF="intro.html#<Esc>"><Esc></A>.
- To check in a Vim <A HREF="usr_41.html#script">script</A> if the <A HREF="#GUI">GUI</A> is being used, you can use something
like this:
<B> if has("gui_running")</B>
<B> echo "yes, we have a GUI"</B>
<B> else</B>
<B> echo "Boring old console"</B>
<B> endif</B>
*<A NAME="setting-guifont"></A><B>setting-guifont</B>*
- When you use the same <A HREF="starting.html#vimrc">vimrc</A> file on various systems, you can use something
like this to set <A HREF="options.html#options">options</A> specifically for each type of <A HREF="#GUI">GUI</A>:
<B> if has("gui_running")</B>
<B> if has("gui_gtk2")</B>
<B> :set guifont=Luxi\ Mono\ 12</B>
<B> elseif has("x11")</B>
<B> " Also for GTK 1</B>
<B> :set guifont=*-lucidatypewriter-medium-r-normal-*-*-180-*-*-m-*-*</B>
<B> elseif has("gui_win32")</B>
<B> :set guifont=Luxi_Mono:h12:cANSI</B>
<B> endif</B>
<B> endif</B>
A recommended <A HREF="mbyte.html#Japanese">Japanese</A> font is MS Mincho. You can find info here:
<A HREF="http://www.lexikan.com/mincho.htm">http://www.lexikan.com/mincho.htm</A>
==============================================================================
7. Shell Commands *<A NAME="gui-shell"></A><B>gui-shell</B>*
For the <A HREF="options.html#X11">X11</A> <A HREF="#GUI">GUI</A> the external commands are executed inside the <A HREF="starting.html#gvim">gvim</A> <A HREF="windows.html#window">window</A>.
See |<A HREF="gui_x11.html#gui-pty">gui-pty</A>|.
WARNING: Executing an external command from the <A HREF="options.html#X11">X11</A> <A HREF="#GUI">GUI</A> will not always
work. "normal" commands like "ls", "<A HREF="quickfix.html#grep">grep</A>" and "make" mostly work fine.
Commands that require an intelligent <A HREF="terminal.html#terminal">terminal</A> like "<A HREF="various.html#less">less</A>" and "ispell" won't
work. Some may even hang and need to be killed from another <A HREF="terminal.html#terminal">terminal</A>. So be
careful!
For the <A HREF="os_win32.html#Win32">Win32</A> <A HREF="#GUI">GUI</A> the external commands are executed in a separate <A HREF="windows.html#window">window</A>.
See |<A HREF="gui_w32.html#gui-shell-win32">gui-shell-win32</A>|.
<A HREF="#top">top</A> - <A HREF="index.html">main help file</A>
</PRE>
</BODY>
</HTML>
|