Christian Brabandt | 8b97ca6 | 2024-11-14 21:12:38 +0100 | [diff] [blame] | 1 | *os_mac.txt* For Vim version 9.1. Last change: 2024 Nov 14 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2 | |
| 3 | |
| 4 | VIM REFERENCE MANUAL by Bram Moolenaar et al. |
| 5 | |
| 6 | |
| 7 | *mac* *Mac* *macintosh* *Macintosh* |
| 8 | |
| 9 | This file documents the particularities of the Macintosh version of Vim. |
| 10 | |
| 11 | NOTE: This file is a bit outdated. You might find more useful info here: |
Bram Moolenaar | 89cb5e0 | 2004-07-19 20:55:54 +0000 | [diff] [blame] | 12 | http://macvim.org/ |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 13 | |
| 14 | 1. Filename Convention |mac-filename| |
Bram Moolenaar | e0720cb | 2017-03-29 13:48:40 +0200 | [diff] [blame] | 15 | 2. .vimrc and .vim files |mac-vimfile| |
| 16 | 3. Standard mappings |mac-standard-mappings| |
| 17 | 4. FAQ |mac-faq| |
| 18 | 5. Known Lack |mac-lack| |
| 19 | 6. Mac Bug Report |mac-bug| |
| 20 | 7. Compiling Vim |mac-compile| |
Bram Moolenaar | 0635ee6 | 2017-04-28 20:32:33 +0200 | [diff] [blame] | 21 | 8. The darwin feature |mac-darwin-feature| |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 22 | |
| 23 | There was a Mac port for version 3.0 of Vim. Here are the first few lines |
| 24 | from the old file: |
| 25 | |
| 26 | VIM Release Notes |
| 27 | Initial Macintosh release, VIM version 3.0 |
| 28 | 19 October 1994 |
| 29 | |
| 30 | Eric Fischer |
| 31 | <enf1@midway.uchicago.edu>, <eric@jcp.uchicago.edu>, <etaoin@uchicago.edu> |
| 32 | 5759 N. Guilford Ave |
| 33 | Indianapolis IN 46220 USA |
| 34 | |
| 35 | ============================================================================== |
| 36 | 1. Filename Convention *mac-filename* |
| 37 | |
Bram Moolenaar | 4ea8fe1 | 2006-03-09 22:32:39 +0000 | [diff] [blame] | 38 | Starting with Vim version 7 you can just use the unix path separators with |
| 39 | Vim. In order to determine if the specified filename is relative to the |
| 40 | current folder or absolute (i.e. relative to the "Desktop"), the following |
| 41 | algorithm is used: |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 42 | |
| 43 | If the path start by a "/", the path is absolute |
| 44 | If the path start by a ":", the path is relative |
| 45 | If the path doesn't start by neither a "/" nor ":", |
| 46 | and a ":" is found before a "/" then the path is absolute |
| 47 | > |
| 48 | :e /HD/text |
| 49 | :e HD:text |
| 50 | < Edit the file "text" of the disk "HD" > |
| 51 | :e :src:main.c |
| 52 | :e src/main.c |
| 53 | < Edit the file "main.c" in the folder "src" in the current folder > |
| 54 | :e os_mac.c |
| 55 | < Edit the file "os_mac.c" in the current folder. |
| 56 | |
| 57 | You can use the |$VIM| and |$VIMRUNTIME| variable. > |
| 58 | |
| 59 | :so $VIMRUNTIME:syntax:syntax.vim |
| 60 | |
| 61 | ============================================================================== |
| 62 | 2. .vimrc and .vim files *mac-vimfile* |
| 63 | |
Bram Moolenaar | 4ea8fe1 | 2006-03-09 22:32:39 +0000 | [diff] [blame] | 64 | It is recommended to use Unix style line separators for Vim scripts, thus a |
| 65 | single newline character. |
| 66 | |
| 67 | When starting up Vim will load the $VIMRUNTIME/macmap.vim script to define |
| 68 | default command-key mappings. |
| 69 | |
| 70 | On older systems files starting with a dot "." are discouraged, thus the rc |
| 71 | files are named "vimrc" or "_vimrc" and "gvimrc" or "_gvimrc". These files |
| 72 | can be in any format (mac, dos or unix). Vim can handle any file format when |
| 73 | the |'nocompatible'| option is set, otherwise it will only handle mac format |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 74 | files. |
| 75 | |
| 76 | ============================================================================== |
Bram Moolenaar | e0720cb | 2017-03-29 13:48:40 +0200 | [diff] [blame] | 77 | 3. Standard mappings *mac-standard-mappings* |
| 78 | |
| 79 | The following mappings are available for cut/copy/paste from/to clipboard. |
| 80 | |
| 81 | key Normal Visual Insert Description ~ |
| 82 | Command-v "*P "-d"*P <C-R>* paste text *<D-v>* |
| 83 | Command-c "*y copy Visual text *<D-c>* |
| 84 | Command-x "*d cut Visual text *<D-x>* |
| 85 | Backspace "*d cut Visual text |
| 86 | |
| 87 | ============================================================================== |
| 88 | 4. Mac FAQ *mac-faq* |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 89 | |
Bram Moolenaar | 3991dab | 2006-03-27 17:01:56 +0000 | [diff] [blame] | 90 | On the internet: http://macvim.org/OSX/index.php#FAQ |
| 91 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 92 | Q: I can't enter non-ASCII character in Apple Terminal. |
| 93 | A: Under Window Settings, Emulation, make sure that "Escape non-ASCII |
| 94 | characters" is not checked. |
| 95 | |
Bram Moolenaar | 1cd871b | 2004-12-19 22:46:22 +0000 | [diff] [blame] | 96 | Q: How do I start the GUI from the command line? |
| 97 | A: Assuming that Vim.app is located in /Applications: |
| 98 | open /Applications/Vim.app |
| 99 | Or: |
Bram Moolenaar | c9b4b05 | 2006-04-30 18:54:39 +0000 | [diff] [blame] | 100 | /Applications/Vim.app/Contents/MacOS/Vim -g {arguments} |
Bram Moolenaar | 1cd871b | 2004-12-19 22:46:22 +0000 | [diff] [blame] | 101 | |
Bram Moolenaar | e2f98b9 | 2006-03-29 21:18:24 +0000 | [diff] [blame] | 102 | Q: How can I set $PATH to something reasonable when I start Vim.app from the |
| 103 | GUI or with open? |
| 104 | A: The following trick works with most shells. Put it in your vimrc file. |
| 105 | This is included in the system vimrc file included with the binaries |
| 106 | distributed at macvim.org . > |
| 107 | let s:path = system("echo echo VIMPATH'${PATH}' | $SHELL -l") |
| 108 | let $PATH = matchstr(s:path, 'VIMPATH\zs.\{-}\ze\n') |
| 109 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 110 | ============================================================================== |
Bram Moolenaar | e0720cb | 2017-03-29 13:48:40 +0200 | [diff] [blame] | 111 | 5. Mac Lack *mac-lack* |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 112 | |
Bram Moolenaar | 69a7cb4 | 2004-06-20 12:51:53 +0000 | [diff] [blame] | 113 | In a terminal CTRL-^ needs to be entered as Shift-Control-6. CTRL-@ as |
| 114 | Shift-Control-2. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 115 | |
| 116 | ============================================================================== |
Bram Moolenaar | e0720cb | 2017-03-29 13:48:40 +0200 | [diff] [blame] | 117 | 6. Mac Bug Report *mac-bug* |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 118 | |
| 119 | When reporting any Mac specific bug or feature change, please use the vim-mac |
| 120 | maillist |vim-mac|. However, you need to be subscribed. An alternative is to |
Christian Brabandt | 8b97ca6 | 2024-11-14 21:12:38 +0100 | [diff] [blame] | 121 | report issues either directly at the Vim github repository: |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 122 | |
Christian Brabandt | 8b97ca6 | 2024-11-14 21:12:38 +0100 | [diff] [blame] | 123 | https://github.com/vim/vim/issues |
| 124 | |
| 125 | or for MacVim specific issues, you may report those over here: |
| 126 | |
| 127 | https://github.com/macvim-dev/macvim/issues |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 128 | |
| 129 | ============================================================================== |
Bram Moolenaar | e0720cb | 2017-03-29 13:48:40 +0200 | [diff] [blame] | 130 | 7. Compiling Vim *mac-compile* |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 131 | |
| 132 | See the file "src/INSTALLmac.txt" that comes with the source files. |
| 133 | |
Bram Moolenaar | 0635ee6 | 2017-04-28 20:32:33 +0200 | [diff] [blame] | 134 | ============================================================================== |
| 135 | 8. The Darwin Feature *mac-darwin-feature* |
| 136 | |
| 137 | If you have a Mac that isn't very old, you will be running OS X, also called |
| 138 | Darwin. The last pre-Darwin OS was Mac OS 9. The darwin feature makes Vim |
| 139 | use Darwin-specific properties. |
| 140 | |
| 141 | What is accomplished with this feature is two-fold: |
| 142 | |
| 143 | - Make Vim interoperable with the system clipboard. |
| 144 | - Incorporate into Vim a converter module that bridges the gap between some |
| 145 | character encodings specific to the platform and those known to Vim. |
| 146 | |
| 147 | Needless to say, both are not to be missed for any decent text editor to work |
| 148 | nicely with other applications running on the same desktop environment. |
| 149 | |
| 150 | As Vim is not an application dedicated only to macOS, we need an extra feature |
| 151 | to add in order for it to offer the same user experience that our users on |
| 152 | other platforms enjoy to people on macOS. |
| 153 | |
| 154 | For brevity, the feature is referred to as "darwin" to signify it one of the |
| 155 | Vim features that are specific to that particular platform. |
| 156 | |
| 157 | The feature is a configuration option. Accordingly, whether it is enabled or |
| 158 | not is determined at build time; once it is selected to be enabled, it is |
| 159 | compiled in and hence cannot be disabled at runtime. |
| 160 | |
| 161 | The feature is enabled by default. For most macOS users, that should be |
| 162 | sufficient unless they have specific needs mentioned briefly below. |
| 163 | |
| 164 | If you want to disable it, pass `--disable-darwin` to the configure script: > |
| 165 | |
| 166 | ./configure --disable-darwin <other options> |
| 167 | |
| 168 | and then run `make` to build Vim. The order of the options doesn't matter. |
| 169 | |
| 170 | To make sure at runtime whether or not the darwin feature is compiled in, you |
Bram Moolenaar | d057301 | 2017-10-28 21:11:06 +0200 | [diff] [blame] | 171 | can use `has('osxdarwin')` which returns 1 if the feature is compiled in; 0 |
Bram Moolenaar | 40962ec | 2018-01-28 22:47:25 +0100 | [diff] [blame] | 172 | otherwise. For backward compatibility, you can still use `macunix` instead of |
Bram Moolenaar | d057301 | 2017-10-28 21:11:06 +0200 | [diff] [blame] | 173 | `osxdarwin`. |
Bram Moolenaar | 0635ee6 | 2017-04-28 20:32:33 +0200 | [diff] [blame] | 174 | |
| 175 | Notable use cases where `--disable-darwin` is turned out to be useful are: |
| 176 | |
| 177 | - When you want to use |x11-selection| instead of the system clipboard. |
| 178 | - When you want to use |x11-clientserver|. |
| 179 | |
| 180 | Since both have to make use of X11 inter-client communication for them to work |
| 181 | properly, and since the communication mechanism can come into conflict with |
| 182 | the system clipboard, the darwin feature should be disabled to prevent Vim |
| 183 | from hanging at runtime. |
| 184 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 185 | |
Bram Moolenaar | 91f84f6 | 2018-07-29 15:07:52 +0200 | [diff] [blame] | 186 | vim:tw=78:ts=8:noet:ft=help:norl: |