os_mac.txt 6.7 KB

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