Revert "Modifier key sends Esc" related commits
[MacVim.git] / runtime / doc / gui_mac.txt
blob573ce83aaa6e88564d8d94d821ff567f6ccacf43
1 *gui_mac.txt*   For Vim version 7.2.  Last change: 2008 Oct 04
4                   VIM REFERENCE MANUAL    by Bjorn Winckler
7 The MacVim Graphical User Interface                     *macvim* *gui-macvim*
9  0. Important!                  |macvim-important|
10  1. MacVim differences          |macvim-differences|
11  2. Starting MacVim             |macvim-start|
12  3. Preferences                 |macvim-preferences|
13  4. Special colors              |macvim-colors|
14  5. Menus                       |macvim-menus|
15  6. Toolbar                     |macvim-toolbar|
16  7. Dialogs                     |macvim-dialogs|
17  8. System services             |macvim-services|
18  9. mvim:// URL handler         |macvim-url-handler|
19 10. Keyboard shortcuts          |macvim-shortcuts|
20 11. Known bugs/missing features |macvim-todo|
21 12. Hints                       |macvim-hints|
23 Other relevant documentation:
24 |gui.txt|       For generic items of the GUI.
26 {Vi does not have a GUI}
28 ==============================================================================
29 0. Important!                                           *macvim-important*
31 MacVim is still under development...this is not the finished product!  If you
32 have problems with MacVim then make it known either by adding an issue report
33 on the MacVim project page >
34         http://code.google.com/p/macvim
35 or by posting to the vim_mac mailing list               *vim_mac*  >
36         http://groups.google.com/group/vim_mac
38 Remember to keep checking the project page for new snapshots or use the
39 automatic updating feature which can be enabled in the preferences pane.  (If
40 you downloaded this copy from somewhere else, you might want to go there now
41 to make sure that you have got the latest version.)
43 ==============================================================================
44 1. MacVim differences                                   *macvim-differences*
46 One of the goals of MacVim is to make Vim behave like a proper Mac OS X
47 application.  For this reason MacVim behaves slightly different from other GUI
48 ports of Vim.  Most of the modifications are provided in the system gvimrc
49 file; you can quickly open this file and look at it yourself by typing: >
50         :tabe $VIM/gvimrc
51 Note that this file will be overwritten each time you update MacVim, so it is
52 better to keep your own modifications inside "~/.gvimrc".
54                                                         *macvim-windows*
55 There is some confusion regarding the term "window" in MacVim since it means
56 one thing to Vim and another to MacVim.  A "window" in Vim is what opens up
57 when you type ":sp", whereas a "window" in MacVim is the GUI window which
58 contains the text view, scrollbars, toolbar and tabline.  To avoid confusion,
59 the former is referred to as a Vim-window, whereas the latter is simply called
60 a window.
62                                                         *macvim-encoding*
63 It is not possible to modify 'termencoding' in MacVim; this option is forcibly
64 set to "utf-8".  The option 'encoding' also defaults to "utf-8" (as opposed to
65 "latin1" in the other GUI ports).
67 Note: UTF-8 can represent all characters defined in Unicode, which includes
68 all characters in all other standard encodings, so it should be perfectly safe
69 to edit files in any encoding while 'encoding' is set to "utf-8".  Of course,
70 you may need to set 'fileencodings' to auto-detect the encoding of the files
71 you edit, or force the detection with |++enc| on the command line.
73 However, if you are editing files that use multiple encodings (container
74 formats like MIME or Unix mbox files) or no standard encoding (binary data,
75 see also |edit-binary|), you may want to prevent MacVim from re-encoding the
76 file at all. In this situation, you will need to set both 'encoding' and
77 'fileencodings' to a simple single-byte encoding such as Latin1 so that when
78 the file is read into memory, the original bytes are left untouched.
80                                                         *macvim-shift-movement*
81 Text editors on Mac OS X lets the user hold down shift+movement key to extend
82 the selection.  Also, pressing a printable key whilst selecting replaces the
83 current selection with that character.  MacVim can emulate this kind of
84 behaviour (by providing key bindings and by setting 'keymodel' and
85 'selectmode' to non-default values) although it is not enabled by default.  To
86 make MacVim behave more like TextEdit and less like Vim, add the following
87 lines to your "~/.vimrc" (not .gvimrc) file: >
88         if has("gui_macvim")
89           let macvim_hig_shift_movement = 1
90         endif
92                                                         *macvim-drag-n-drop*
93 Dragging files and dropping them on a window opens those files in tabs in that
94 window, unless Vim is in command-line mode.  In command-line mode the names of
95 the files are added to the command line.  Holding down modifier keys whilst
96 dragging is not supported.
98 If a file is dropped on the Dock icon, it is always opened in a new tab
99 regardless of the mode Vim is currently in.  The same holds if you
100 double-click on a file in the Finder.
102 The "Open files from applications" preference in the General preference pane
103 gives more options on how dropped files should open, in case tabs are not
104 desired.
106                                                         *macvim-default-menu*
107 The default menu in MacVim has been changed to conform better with the Apple
108 Human Interface Guidelines (HIG).  At the moment this breaks the localized
109 menus, so only English menus are supported.
111 Note: The menus are a work in progress.  If you know something about the HIG
112 and want to contribute to MacVim you could do so by making the menus better.
114                                                         *macvim-window-title*
115 The default window title does not include the argument list because it looks
116 really bad once you start using tabs.  For example, dropping two files, then
117 dropping two more, and switching back to the first tab would cause weird
118 strings like "((3) of 2)" to appear in the window title.
120                                                         *macvim-options*
121 These are the non-standard options that MacVim supports:
122         'fullscreen' 'fuoptions' 'toolbariconsize' 'transparency' 'antialias'
124                                                         *macvim-find*
125 Whenever you search for something in Vim (e.g. using "/") the search query is
126 copied to the OS X "Find Pasteboard".  The idea is that if you search for
127 something and switch to another application, then you can hit <D-g> (or <D-G>)
128 to repeat the search in the new app.  The same feature works if you search in
129 some app, switch to MacVim and hit <D-g>.
131 Note that the command |n| is not the same as <D-g>.  The former will repeat
132 the last search made in Vim, whereas the latter searches for the string on the
133 OS X Find Pasteboard using the action findNext: (see |:macaction|).
135 The <D-g> key equivalent is a great way to bring a search from one window to
136 another in MacVim.  Simply search for something in one window (using "/") then
137 switch to another (e.g. with <D-`>) and hit <D-g> and the search will be
138 repeated in the new window.
140                                         *macvim-backspace* *macvim-delete*
141 The 'backspace' option is set in the system vimrc to make the delete key
142 behave in a more familiar way to new users.  If you dislike this non-default
143 behaviour, then add the line "set backspace&" to your "~/.vimrc" file.
145 ==============================================================================
146 2. Starting MacVim                                      *macvim-start*
148 The easiest way to start MacVim is by double-clicking its icon in the Finder,
149 but most users will probably prefer to use the Terminal.  First some Finder
150 related ways of starting MacVim are described, then Terminal is discussed.
151 Note that you can put MacVim anywhere on your hard drive, but in this help
152 file it is assumed that you have put it inside your /Applications folder.
154 MacVim automatically registers itself as an editor of several standard file
155 formats.  This enables you to double-click a file to open it with MacVim (if
156 it is not associated with another program), or to right-click a file to bring
157 up the "Open with" menu.  You can also drag and drop files onto the Dock icon
158 to open them in tabs in a new window, or you can drop them in an already open
159 window to open the files in tabs in that specific window (it is possible to
160 have files open in e.g. splits by changing the "Open files from applications"
161 option in the General preference pane).  Finally, you can use Mac OS X System
162 Services to open files in MacVim, see |macvim-services|.
164 There are essentially two ways to start MacVim from Terminal: either call the
165 Vim binary with the -g switch >
166         /Applications/MacVim.app/Contents/MacOS/Vim -g file ...
167 or use the "open" command (this method can not be used to pass parameters to
168 Vim) >
169         open -a MacVim file ...
170 The advantage of using the latter method is that the settings relating to file
171 opening in the preferences panel are respected, and files open instantly if
172 |Quickstart| is enabled.
174                                                         *mvim*
175 To save yourself from having to type the entire path to the Vim binary each
176 time you start MacVim, you could create an alias such as >
177         alias gvim='/Applications/MacVim.app/Contents/MacOS/Vim -g'
178 and add that to "~/.profile".  A more flexible way to start MacVim is to use
179 the shell script "mvim" which comes bundled with MacVim.  Put this script in a
180 folder in your path and then simply type "mvim" to start MacVim.  This script
181 will try to find MacVim.app in various typical folders such as >
182         ~/Applications              ~/Applications/vim
183         /Applications               /Applications/vim
184         /Applications/Utilities     /Applications/Utilities/vim
185 If you would rather put MacVim.app in some other directory then that is also
186 possible, simply set the environment variable VIM_APP_DIR to whatever folder
187 you have placed MacVim.app in.
189 Note: Starting MacVim by creating a symlink to >
190         .../MacVim.app/Contents/MacOS/Vim
191 with 'ln -s' does not work.
193 Once in terminal Vim it is possible to start MacVim by using the following
194 command:
195         :gui [++opt] [+cmd] [-f|-b] [files...]
196 Note: Forking ("-b") currently does not work.
198                                                         *Quickstart*
199 Quickstart ensures that new windows open instantaneously e.g. when <D-n> is
200 pressed.  This feature can be enabled from the Advanced preferences pane (it
201 is disabled by default).  Note that this setting does not affect the speed
202 with which windows open when using the |mvim| command.
204 The main reason why this feature is not enabled by default is because on OS X
205 10.4 changes to runtime files (e.g. those in "~/.vim") are not detected.  For
206 example, if you install a new plugin and then press <D-n> to open a new
207 window, then that first window will not notice the plugin (but any consecutive
208 windows after the first one will).  On OS X 10.5 and later all modifications
209 to runtime files in "~/.vim" are detected, so unless you keep runtime files in
210 another folder there should be no problems.
212                                                 *odbeditor* *external-editor*
213 MacVim can act as an 'external editor' for Mac OS X applications that support
214 the ODB Editor Protocol (or the 'external editor' protocol).  Each application
215 has different ways of configuring this option, check the application's
216 documentation.  Once configured properly MacVim can be used to open files in
217 such an application.
219 A technical note: MacVim handles file open, modified and closed events.  In
220 the open event the FTok and Burl parameters are parsed (the latter is ignored
221 at the moment though).  In the modified and closed events the Tokn parameter
222 is sent back to the server application.
224 ==============================================================================
225 3. Preferences                              *macvim-prefs* *macvim-preferences*
227 Some settings are global to the MacVim application and would not make sense as
228 Vim options.  These settings are stored in a user default database and can be
229 accessed via the "MacVim.Preferences..." menu item.
231                                                         *macvim-user-defaults*
232 Not all entries in the user defaults database are exposed via the preference
233 panel, usually because they should not be changed by the user under normal
234 circumstances.  These options can still be changed with the "defaults" command
235 by opening Terminal and typing >
236         defaults write org.vim.MacVim KEY VALUE
237 Check the man page on "defaults" for more information on this command as well
238 as general information regarding Mac OS X user defaults.
240 Here is a list of relevant dictionary entries:
242 KEY                             VALUE ~
243 MMCellWidthMultiplier           width of a normal glyph in em units [float]
244 MMDialogsTrackPwd               open/save dialogs track the Vim pwd [bool]
245 MMLoginShellArgument            login shell parameter [string]
246 MMLoginShellCommand             which shell to use to launch Vim [string]
247 MMNoFontSubstitution            disable automatic font substitution [bool]
248 MMTabMaxWidth                   maximum width of a tab [int]
249 MMTabMinWidth                   minimum width of a tab [int]
250 MMTabOptimumWidth               default width of a tab [int]
251 MMTextInsetBottom               text area offset in pixels [int]
252 MMTextInsetLeft                 text area offset in pixels [int]
253 MMTextInsetRight                text area offset in pixels [int]
254 MMTextInsetTop                  text area offset in pixels [int]
255 MMTexturedWindow                use brushed metal window (Tiger only) [bool]
256 MMTranslateCtrlClick            interpret ctrl-click as right-click [bool]
257 MMVerticalSplit                 files open in vertical splits [bool]
258 MMZoomBoth                      zoom button maximizes both directions [bool]
260 As an example, if you have more than one mouse button and would wish to free
261 up Ctrl-click so you can bind it to something else, then the appropriate
262 command is: >
263         defaults write org.vim.MacVim MMTranslateCtrlClick 0
265 If you wish to restore all user defaults to their starting values, open
266 Terminal and type: >
267         defaults delete org.vim.MacVim
269                                                         *macvim-login-shell*
270 Applications opened from the Finder do not automatically source the user's
271 environment variables (which are typically set in .profile or .bashrc).  This
272 presents a problem when using |:!| to execute commands in the shell since e.g.
273 $PATH might not be set properly.  To work around this problem MacVim starts
274 new Vim processes via a login shell so that all environment variables are set.
276 By default MacVim uses the $SHELL environment variable to determine which
277 shell to use (if $SHELL is not set "/bin/bash" is used).  It is possible to
278 override this choice by setting the user default MMLoginShellCommand to the
279 shell that should be used (e.g. "/bin/tcsh").  MacVim tries to make the shell
280 a login shell by prepending argv[0] with a dash.  If you use an exotic shell
281 and need to pass it a parameter to make it a login shell then you can set the
282 user default MMLoginShellArgument (e.g. to "-l").  Finally, if the "bash"
283 shell is used, then "-l" is automatically added as an argument.  To override
284 this behaviour set MMLoginShellArgument to "--".
286 ==============================================================================
287 4. Special colors                                       *macvim-colors*
289 The colors in MacVim are defined in two dictionaries inside the "Resources"
290 folder of the application bundle (MacVim.app/Contents/Resources).  It is
291 possible to add more colors by modifying these files.  Color names are case
292 insensitive when accessed from Vim, but in the dictionary they must be
293 lowercase.
295                                                         *SystemColors.plist*
296 There are only a few system colors that can be accessed from Vim.  These
297 colors are defined in the dictionary "SystemColors.plist".  This dictionary
298 stores (key, value) pairs where the key is the name of the color and the
299 value is an NSColor selector name.
301 The most useful system colors are: >
302         MacSelectedTextBackgroundColor
303         MacSecondarySelectedColor
304 The former is the "Highlight Color" which can be changed in the "Appearance"
305 section of the System Preferences.  The latter is the selection color used by
306 a Cocoa application when it is not in focus.
308                                                         *Colors.plist*
309 Apart from the system colors, it is also possible to use the standard X11
310 color names (see http://en.wikipedia.org/wiki/X11_color_names) which usually
311 come in a file called "rgb.txt".  MacVim does not have such a file, instead it
312 keeps these colors in a dictionary called "Colors.plist". The key in this
313 dictionary is the name of the color and the value is an RGB value on the form
314 #rrggbb stored as an integer.
316                                                         *macvim-colorscheme*
317 MacVim ships with a custom color scheme that is used instead of the default
318 Vim color scheme.  The color scheme can be changed with >
319         :colorscheme macvim
320 If you prefer a dark background color, then type >
321         :set bg=dark
322 after having loaded the "macvim" color scheme.
324 The color scheme uses the the system "Highlight Color", which can be changed in
325 the "Appearance" pane of the System Preferences.  It also changes the
326 highlight color when a window becomes inactive.
328 If you have any comments regarding this colors cheme (is it better or worse
329 than the default?) then post them to |vim_mac|.
331 ==============================================================================
332 5. Menus                                                *macvim-menus*
334 Menus in Mac OS X behave slightly different from other platforms.  For that
335 reason two new commands have been added to Vim.  To understand what these
336 commands do you must first understand how menus work on OS X.
338 Each entry in a menu is called a "menu item".  With each menu item is
339 associated: a title, a key equivalent and an action message.  When a menu is
340 displayed the title is shown on the left and the key equivalent (if any) is
341 shown on the right.  Key equivalents enable you to access a menu item using
342 the keyboard instead of having to use the mouse.  When a menu item is clicked
343 it will send it's associated action message.  Actions can be used to instruct
344 MacVim to paste some text (paste:), open a new window (newWindow:), etc.
345 Certain actions are standard throughout OS X which is why MacVim must be able
346 to set these for each menu item.  (E.g. the menu item "Edit.Paste" must be
347 bound to the action "paste:" otherwise pasting won't work in dialogs since
348 that is the action that instructs them to paste something.)
350 Menus are configured using the |:macmenu| command and the |:macaction| command
351 can be used to send action messages.
353                                                 *:maca* *:macaction*
354 :maca[ction] {action:}  Send the message "action:" to the first responder.
355                         The list of allowed actions can be seen by typing
356                             :maca <C-d>
357                         An attempt to send an action not listed here will
358                         result in an error.  This list is specified in a
359                         property list file called |Actions.plist|.
361                                                 *:macm* *:macmenu*
362 :macm[enu] {menu} {key}={arg} ...
363                         Set Mac specific properties for {menu}.  The
364                         properties that can be set are:
365                             action      the action this menu sends
366                             alt         "yes" if alternate of previous menu
367                             key         the key equivalent of this menu
368                         This command must be used in a startup file, for
369                         example in "~/.gvimrc".  It has no effect otherwise.
371                         For convenience, a menu with "action=name:" which is
372                         bound to <Nop> will act as if bound to
373                         ":maca name:<CR>".  Thus, if "Menu.Item" is given by
374                             :an Menu.Item <Nop>
375                             :macm Menu.Item action=name:
376                         then ":emenu Menu.Item" is equivalent to
377                         ":maca name:".
379                         The key equivalent is specified with the <D-..>
380                         syntax.  Note that key equivalents must contain the
381                         Cmd modifier flag (<D-..>), and they take precedence
382                         over normal mappings.
383                         Use the syntax "key=<nop>" to clear the key equivalent
384                         of a menu.  This can be used to free up a key
385                         combination that is set in the system gvimrc so that
386                         it may be mapped to using ":map".
388                         Recognised values of "alt" are "0", "no", "1", and
389                         "yes".  The default is "no".  An alternate menu must
390                         have the same key equivalent as the previous menu,
391                         except the modifier flags must differ.  The alternate
392                         menu is by default hidden and only shows up when the
393                         modifier is held down.
395 Here are some examples on how to use these commands:
397 1. Create a menu item with title "New Window" under the "File" menu, with key
398 equivalent Cmd-n, which opens a new window when selected: >
399         :an 10.290 File.New\ Window <Nop>
400         :macm File.New\ Window action=newWindow: key=<D-n>
401 2. Change the key equivalent to cycle through tabs to Cmd-Left/Right: >
402         :macm Window.Previous\ Tab  key=<D-Left>
403         :macm Window.Next\ Tab      key=<D-Right>
404 3. Create a mapping in normal mode which closes the current tab/window: >
405         :map <C-w> :maca performClose:<CR>
408 The standard Vim menus are modified in "$VIM/gvimrc".  Take a look at that
409 file for more examples on how to set up menus.  Note: When no window is open a
410 minimal default menu is used.  The default menu is set up in MainMenu.nib
411 which resides in "Resources/English.lproj/" folder inside the app bundle.
413                                                         *Actions.plist*
414 Some action messages would not be suitable to call from within Vim, so there
415 is a dictionary called "Actions.plist" (in the Resources folder of the
416 application bundle) which contains all actions that may be called.  The key in
417 this dictionary is the name of the action message (case sensitive), the value
418 is not used.
420 Hint: The |:macaction| command supports command-line completion so you can
421 enter ":maca<Space><C-d>" to see a list of all available actions.
423 Here is a random assortment of actions from Actions.plist which might be
424 useful.  
426 Action                          Description ~
427 fileOpen:                       Show "File Open" dialog
428 findNext:                       Search forward using the "Find Pasteboard"
429 findPrevious:                   Search backward using the "Find Pasteboard"
430 fontSizeDown:                   Decrease font size
431 fontSizeUp:                     Increase font size
432 hide:                           Hide MacVim
433 miniaturizeAll:                 Minimize all windows to the dock
434 newWindow:                      Open a new (empty) window
435 orderFrontCharacterPalette:     Show the the "Special Characters" dialog
436 orderFrontFontPanel:            Show the Font panel
437 orderFrontPreferencePanel:      Show the Preferences panel
438 performMiniaturize:             Minimize window to the dock
439 performZoom:                    Zoom window (same as clicking the green blob)
440 terminate:                      Quit MacVim
441 zoomAll:                        Zoom all windows
442 _cycleWindows:                  Select next window (similar to <D-`>)
443 _cycleWindowsBackwards:         Select previous window (similar to <D-S-`>)
445 ==============================================================================
446 6. Toolbar                                              *macvim-toolbar*
448 The toolbar in MacVim works just like in the other GUIs (see |gui-toolbar|),
449 with the addition of two separator items (see |menu-separator|).  You can use
450 them as follows: >
451         :an ToolBar.-space1-        <Nop>
452         :an ToolBar.-flexspace2-    <Nop>
453 The first example creates an empty space on the toolbar, the second creates an
454 empty space which will shink or expand so that the items to the right of it
455 are right-aligned.  A space (flexspace) will be created for any toolbar item
456 whose name begins with "-space" ("-flexspace") and ends with "-"
458 Toolbar icons should be tiff, png or icns, of dimension 32x32 or 24x24 pixels.
459 The larger size is used when 'tbis' is "medium" or "large", otherwise the
460 smaller size is used (which is the default).  If the icon file only contains
461 one dimension then Mac OS X will scale the icon to the appropriate dimension
462 if necessary.  To avoid this, use a file format which supports multiple
463 resolutions (such as icns) and provide both 32x32 and 24x24 versions of the
464 icon.
466 Note: Only a subset of the builtin toolbar items presently have icons.  If no
467 icon can be found a warning triangle is displayed instead.
469 ==============================================================================
470 7. Dialogs                                              *macvim-dialogs*
472 Dialogs can be controlled with the keyboard in two ways.  By default each
473 button in a dialog is bound to a key.  The button that is highlighted by blue
474 is bound to Enter, any button with the title "Cancel" is bound to Escape, and
475 any button with the title "Don't Save" is bound to <D-d>.  Other buttons are
476 usually bound to the first letter in the title of the button.  There is no
477 visual feedback to indicate which letter a button is bound to, so sometimes
478 some experimentation might be required in order to figure out which key to
479 press.
481 The second way of controlling dialogs with the keyboard is to enable "Full
482 keyboard access" in the "Keyboard & Mouse" pane of the System Preferences (you
483 can also toggle this on or off by pressing Ctrl-F7).  Once keyboard access is
484 enabled it is possible to move between buttons with Tab and pressing Space to
485 select the current button.  The current button is indicated with a blue
486 outline.
488 ==============================================================================
489 8. System services                                      *macvim-services*
491 MacVim supports a few system services.  These can be accessed from the MacVim
492 submenu in the Services menu.  For services to work, MacVim.app should be
493 located in the /Applications folder.  (You might have to logout and then login
494 again before Mac OS X detects the MacVim services.)
496 These are the currently supported services:
497 * New Document Here: Open a new window and set the current directory to that
498   of the selected text.  This is intended to be used from a Finder window to
499   open an empty document in the currently selected folder.
500 * New Document Containing Selection: Open a new window and paste the currently
501   selected text.
502 * Open Selected File: If the selected text represents a file name, then the
503   corresponding file is opened in a new window.
505 If new files are set to open in the current window (in the General preference
506 pane) then the above services will also reuse the topmost window, instead of
507 opening a new window.
509 ==============================================================================
510 9. mvim:// URL handler                          *mvim://* *macvim-url-handler*
512 MacVim supports a custom URL handler for "mvim://" URLs. The handler is
513 supposed to be compatible to TextMate's URL scheme as documented at
514 http://blog.macromates.com/2007/the-textmate-url-scheme/.
516 Currently, this means that the format is >
517         mvim://open?<arguments>
518 < where arguments can be:
520 * url — the actual file to open (i.e. a file://... URL), if you leave
521         out this argument, the frontmost document is implied.
522 * line — line number to go to (one based).
523 * column — column number to go to (one based).
525 For example, the link >
526         mvim://open?url=file:///etc/profile&line=20
527 < will open the file /etc/profile on line 20 when clicked in a web browser.
529 Note that url has to be a file:// url pointing to an existing local file.
531 ==============================================================================
532 10. Keyboard shortcuts                                  *macvim-shortcuts*
534 Most keyboard shortcuts in MacVim are bound to menu items and can be
535 discovered by looking through the menus.  The remaining shortcuts are listed
536 here:
538                                                         *Cmd-.* *<D-.>*
539 Cmd-.                   Interrupt Vim.  This is synonymous with CTRL-C and can
540                         hence be used instead of Esc to exit insert mode (in
541                         case you find Esc a bit hard to reach).
543                                                         *Cmd-`* *<D-`>*
544 Cmd-`                   Cycle to the next window.  On an American keyboard the
545                         `-key is located under the Esc-key.  On European
546                         keyboards this key is often adjacent to the left
547                         Shift-key and it may be not even be marked with "`".
549                                                         *Cmd-Left*  *<D-Left>*
550 Cmd-Left                Move cursor to the beginning of the line
551                         (see |cmd-movement|).
553                                                         *Cmd-Right* *<D-Right>*
554 Cmd-Right               Move cursor to the end of the line (see |cmd-movement|).
556                                                         *Cmd-Up*    *<D-Up>*
557 Cmd-Up                  Move cursor to the first line (see |cmd-movement|).
559                                                         *Cmd-Down*  *<D-Down>*
560 Cmd-Down                Move cursor to the last line (see |cmd-movement|).
562                                                         *Alt-Left*  *<M-Left>*
563 Alt-Left                Move cursor to the beginning of the previous word
564                         (see |alt-movement|).
566                                                         *Alt-Right* *<M-Right>*
567 Alt-Right               Move cursor to the beginning of the next word
568                         (see |alt-movement|).
570                                                         *Alt-Up*    *<M-Up>*
571 Alt-Up                  Move cursor one paragraph forward (see |alt-movement|).
573                                                         *Alt-Down*  *<M-Down>*
574 Alt-Down                Move cursor to the previous paragraph
575                         (see |alt-movement|).
577                                                 *cmd-movement* *alt-movement*
578 The above mappings involving Cmd/Alt + arrow key are enabled by default in the
579 system gvimrc file "$VIM/gvimrc".  You can quickly disable all of these by
580 adding the following lines to your "~/.vimrc" (not .gvimrc) file: >
581         if has("gui_macvim")
582           let macvim_skip_cmd_opt_movement = 1
583         endif
584 Note: These are the only key mappings that MacVim makes (not counting menu key
585 equivalents which are not set up with :map).
587 See |macvim-shift-movement| if you want Shift to select text when used in
588 conjunction with the above Cmd/Alt movement shortcuts.
590 ==============================================================================
591 11. Known bugs/missing features                         *macvim-todo*
593 This list is by no means exhaustive, it only enumerates some of the more
594 prominent bugs/missing features.
596 - Localized menus are not supported.  Choosing anything but "English" in the
597   "International" pane of "System Prefences" may break the menus (and
598   toolbar).
599 - Some Unicode characters are not handled well (e.g. nonspacing marks)
600 - Sometimes multibyte characters look "too wide", i.e. they overlap the
601   following character.  It might help to change 'ambiwidth', or override the
602   automatic font substitution by setting 'guifontwide' manually.
603 - Printing.  As a temporary solution <D-p> creates a PostScript file which is
604   then opened in Preview where it may be printed.
605 - The toolbar looks ugly and is not very useful.
607 If you find new bugs then add a new issue at http://code.google.com/p/macvim/
608 or post your findings to the |vim_mac| mailing list.  If you are missing
609 feature X in MacVim then voice your opinion on the |vim_mac| mailing list; it
610 might be simple to implement, but unless somebody asks for a particular
611 feature then there is little incentive to add it.
613 ==============================================================================
614 12. Hints                                               *macvim-hints*
616 In this section some general (not necessarily MacVim specific) hints are
617 given.
619 Scenario: ~
620 You try opening a bunch of files in tabs but not all files get opened in their
621 own tab.
622 Solution: ~
623 To get around this, set 'tabpagemax' to something big in your .gvimrc file
624 (e.g. ":set tabpagemax=100").
626 Scenario: ~
627 You want to open a file in a tab in an already opened window, but typing "mvim
628 filename" in Terminal opens it up in a separate window.
629 Solution: ~
630 Use the |--remote-tab| switch.  If you have several windows open you might
631 have to specify which window you want the file to open in by using the
632 |--servername| switch.  The title of a window usually ends in something like
633 "VIM" or "VIM3" --- this is the server name of that window.  So to open a file
634 named "foobar.txt" in a window whose title ends in "VIM3" you would type (the
635 order of the arguments matters): >
636         mvim --servername VIM3 --remote-tab foobar.txt
637 For more information, consult the |client-server| manual page.
639 Scenario: ~
640 You like to be able to select text by holding down shift and pressing the
641 arrow keys and find the Vim way of selecting text strange.
642 Solution: ~
643 See |macvim-shift-movement|.
645 Scenario: ~
646 You do not want MacVim to set up any key mappings.
647 Solution: ~
648 See |macvim-movement|.
650 Scenario: ~
651 Enabling localized menus breaks the toolbar and the menus as well.
652 Solution: ~
653 This is a known problem, see |macvim-todo|.
655 Scenario: ~
656 You dislike the default font (DejaVu Sans Mono).
657 Solution: ~
658 The standard fixed width font on other Mac OS X applications is Monaco.  If
659 you prefer this font then add the following line to your "~/.gvimrc" (note
660 that Monaco does not come in italic and bold variants): >
661         set guifont=Monaco:h10
662 The suffix ":h10" specifies the point size of the font should be "10" (see
663 'guifont' for more information on how to set the font).
665 Scenario: ~
666 When you click the (green) zoom button you want the window to maximize
667 horizontally as well as vertically.
668 Solution: ~
669 Hold down Cmd and click the zoom button.  If you prefer this to be the default
670 action, then set the user default MMZoomBoth (see |macvim-prefs|).
672 Scenario: ~
673 Typing feels sluggish when the cursor is just before a right bracket (i.e.
674 ')', '}', or ']').
675 Solution: ~
676 Disable the "matchparen" plugin (see |matchparen|) by typing :NoMatchParen.
677 If that helps, then you can permanently disable "matchparen" by adding the
678 following line to your "~/.vimrc": >
679         let loaded_matchparen=1
681 Scenario: ~
682 You want to use MacVim as an editor for some external application.
683 Solution: ~
684 If the external application lets you set a program to execute then something
685 like "mvim -f" might be all you need (the "-f" switch ensures that the "mvim"
686 script returns only after you close the editor window, otherwise "mvim"
687 returns immediately). If the external program honors the EDITOR environment
688 variable (e.g Git does this) then you may get away by adding the following
689 line to your "~/.profile": >
690         export EDITOR='mvim -f'
691 If you have not installed the "mvim" script in your path you can provide the
692 path to the Vim binary instead.  Thus, if "MacVim.app" resides in the
693 Applications folder then you would use the following line: >
694         export EDITOR='/Applications/MacVim.app/Contents/MacOS/Vim -g -f'
696 Scenario: ~
697 You have set MacVim to open from an external program and when you finish
698 editing (by closing the MacVim window) you want the external program to regain
699 focus.
700 Solution: ~
701 Use the VimLeave autocommand to hide MacVim when the window closes: >
702         au VimLeave * maca hide:
703 Assuming your external program has a setting for which command to execute to
704 bring up an editor, you would set that option to something like: >
705         mvim -c "au VimLeave * maca hide:"
706 (You may need to add the "-f" switch before the "-c", see the Scenario above.)
708 Scenario: ~
709 You can't find the information on MacVim you thought should be in this manual
710 page.
711 Solution: ~
712 Post your question on the |vim_mac| mailing list and wait for an answer.
714  vim:tw=78:sw=4:ts=8:ft=help:norl: