codekingpro/portable-devtools
114k
1*os_mac.txt* For Vim version 9.2. Last change: 2026 Feb 142 3 4 VIM REFERENCE MANUAL by Bram Moolenaar et al.5 6 7 *mac* *Mac* *macintosh* *Macintosh*8 9This file documents the particularities of the Macintosh version of Vim.10 11NOTE: This file is a bit outdated. You might find more useful info here:12 http://macvim.org/13 141. Filename Convention |mac-filename|152. .vimrc and .vim files |mac-vimfile|163. Standard mappings |mac-standard-mappings|174. FAQ |mac-faq|185. Known Lack |mac-lack|196. Mac Bug Report |mac-bug|207. Compiling Vim |mac-compile|218. The darwin feature |mac-darwin-feature|22 23There was a Mac port for version 3.0 of Vim. Here are the first few lines24from the old file:25 26VIM Release Notes27Initial Macintosh release, VIM version 3.02819 October 199429 30Eric Fischer31<enf1@midway.uchicago.edu>, <eric@jcp.uchicago.edu>, <etaoin@uchicago.edu>325759 N. Guilford Ave33Indianapolis IN 46220 USA34 35==============================================================================361. Filename Convention *mac-filename*37 38Starting with Vim version 7 you can just use the unix path separators with39Vim. In order to determine if the specified filename is relative to the40current folder or absolute (i.e. relative to the "Desktop"), the following41algorithm is used:42 43 If the path start by a "/", the path is absolute44 If the path start by a ":", the path is relative45 If the path doesn't start by neither a "/" nor ":",46 and a ":" is found before a "/" then the path is absolute47>48 :e /HD/text49 :e HD:text50< Edit the file "text" of the disk "HD" >51 :e :src:main.c52 :e src/main.c53< Edit the file "main.c" in the folder "src" in the current folder >54 :e os_mac.c55< Edit the file "os_mac.c" in the current folder.56 57You can use the |$VIM| and |$VIMRUNTIME| variable. >58 59 :so $VIMRUNTIME:syntax:syntax.vim60 61==============================================================================622. .vimrc and .vim files *mac-vimfile*63 64It is recommended to use Unix style line separators for Vim scripts, thus a65single newline character.66 67When starting up Vim will load the $VIMRUNTIME/macmap.vim script to define68default command-key mappings.69 70On older systems files starting with a dot "." are discouraged, thus the rc71files are named "vimrc" or "_vimrc" and "gvimrc" or "_gvimrc". These files72can be in any format (mac, dos or unix). Vim can handle any file format when73the 'nocompatible' option is set, otherwise it will only handle mac format74files.75 76==============================================================================773. Standard mappings *mac-standard-mappings*78 79The following mappings are available for cut/copy/paste from/to clipboard.80 81key Normal Visual Insert Description ~82Command-v "*P "-d"*P <C-R>* paste text *<D-v>*83Command-c "*y copy Visual text *<D-c>*84Command-x "*d cut Visual text *<D-x>*85Backspace "*d cut Visual text86 87==============================================================================884. Mac FAQ *mac-faq*89 90On the internet: https://github.com/macvim-dev/macvim/wiki/FAQ91 92Q: I can't enter non-ASCII character in Apple Terminal.93A: Under Window Settings, Emulation, make sure that "Escape non-ASCII94 characters" is not checked.95 96Q: How do I start the GUI from the command line?97A: Assuming that Vim.app is located in /Applications:98 open /Applications/Vim.app99 Or:100 /Applications/Vim.app/Contents/MacOS/Vim -g {arguments}101 102Q: How can I set $PATH to something reasonable when I start Vim.app from the103 GUI or with open?104A: 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 binaries106 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 110==============================================================================1115. Mac Lack *mac-lack*112 113In a terminal CTRL-^ needs to be entered as Shift-Control-6. CTRL-@ as114Shift-Control-2.115 116==============================================================================1176. Mac Bug Report *mac-bug*118 119When reporting any Mac specific bug or feature change, please use the vim-mac120maillist |vim-mac|. However, you need to be subscribed. An alternative is to121report issues either directly at the Vim github repository:122 123https://github.com/vim/vim/issues124 125or for MacVim specific issues, you may report those over here:126 127https://github.com/macvim-dev/macvim/issues128 129==============================================================================1307. Compiling Vim *mac-compile*131 132See the file "src/INSTALLmac.txt" that comes with the source files.133 134==============================================================================1358. The Darwin Feature *mac-darwin-feature*136 137If you have a Mac that isn't very old, you will be running OS X, also called138Darwin. The last pre-Darwin OS was Mac OS 9. The darwin feature makes Vim139use Darwin-specific properties.140 141What 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 some145 character encodings specific to the platform and those known to Vim.146 147Needless to say, both are not to be missed for any decent text editor to work148nicely with other applications running on the same desktop environment.149 150As Vim is not an application dedicated only to macOS, we need an extra feature151to add in order for it to offer the same user experience that our users on152other platforms enjoy to people on macOS.153 154For brevity, the feature is referred to as "darwin" to signify it one of the155Vim features that are specific to that particular platform.156 157The feature is a configuration option. Accordingly, whether it is enabled or158not is determined at build time; once it is selected to be enabled, it is159compiled in and hence cannot be disabled at runtime.160 161The feature is enabled by default. For most macOS users, that should be162sufficient unless they have specific needs mentioned briefly below.163 164If you want to disable it, pass `--disable-darwin` to the configure script: >165 166 ./configure --disable-darwin <other options>167 168and then run `make` to build Vim. The order of the options doesn't matter.169 170To make sure at runtime whether or not the darwin feature is compiled in, you171can use `has('osxdarwin')` which returns 1 if the feature is compiled in; 0172otherwise. For backward compatibility, you can still use `macunix` instead of173`osxdarwin`.174 175Notable 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 180Since both have to make use of X11 inter-client communication for them to work181properly, and since the communication mechanism can come into conflict with182the system clipboard, the darwin feature should be disabled to prevent Vim183from hanging at runtime.184 185 186 vim:tw=78:ts=8:noet:ft=help:norl:187 