Bram Moolenaar | 3b1db36 | 2013-08-10 15:00:24 +0200 | [diff] [blame] | 1 | *os_os2.txt* For Vim version 7.4. Last change: 2007 Apr 22 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2 | |
| 3 | |
| 4 | VIM REFERENCE MANUAL by Paul Slootman |
| 5 | |
| 6 | |
| 7 | *os2* *OS2* *OS/2* |
| 8 | This file contains the particularities for the OS/2 version of Vim. |
| 9 | |
| 10 | At present there is no native PM version of the GUI version of Vim: The OS/2 |
| 11 | version is a console application. However, there is now a Win32s-compatible |
| 12 | GUI version, which should be usable by owners of Warp 4 (which supports |
| 13 | Win32s) in a Win-OS/2 session. The notes in this file refer to the native |
| 14 | console version. |
| 15 | |
| 16 | |
| 17 | NOTE |
| 18 | |
| 19 | This OS/2 port works well for me and a couple of other OS/2 users; however, |
| 20 | since I haven't had much feedback, that either means no (OS/2-specific) bugs |
| 21 | exist (besides the ones mentioned below), or no one has yet created a |
| 22 | situation in which any bugs are apparent. File I/O in Dos and Unix mode, |
| 23 | binary mode, and FAT handling all seem to work well, which would seem to be |
| 24 | the most likely places for trouble. |
| 25 | |
| 26 | A known problem is that files opened by Vim are inherited by other programs |
| 27 | that are started via a shell escape from within Vim. This specifically means |
| 28 | that Vim won't be able to remove the swap file(s) associated with buffers open |
| 29 | at the time the other program was started, until the other program is stopped. |
| 30 | At that time, the swap file may be removed, but if Vim could not do that the |
Bram Moolenaar | 402d2fe | 2005-04-15 21:00:38 +0000 | [diff] [blame] | 31 | first time, it won't be removed at all. You'll get warnings that some other |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 32 | Vim session may be editing the file when you start Vim up again on that file. |
Bram Moolenaar | 402d2fe | 2005-04-15 21:00:38 +0000 | [diff] [blame] | 33 | This can be reproduced with ":!start epm". Now quit Vim, and start Vim again |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 34 | with the file that was in the buffer at the time epm was started. I'm working |
| 35 | on this! |
| 36 | |
| 37 | A second problem is that Vim doesn't understand the situation when using it |
| 38 | when accessing the OS/2 system via the network, e.g. using telnet from a Unix |
Bram Moolenaar | 402d2fe | 2005-04-15 21:00:38 +0000 | [diff] [blame] | 39 | system, and then starting Vim. The problem seems to be that OS/2 =sometimes= |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 40 | recognizes function / cursor keys, and tries to convert those to the |
Bram Moolenaar | 402d2fe | 2005-04-15 21:00:38 +0000 | [diff] [blame] | 41 | corresponding OS/2 codes generated by the "normal" PC keyboard. I've been |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 42 | testing a workaround (mapping the OS/2 codes to the correct functions), but so |
Bram Moolenaar | 402d2fe | 2005-04-15 21:00:38 +0000 | [diff] [blame] | 43 | far I can't say anything conclusive (this is on Warp 3, by the way). In the |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 44 | meantime any help will be appreciated. |
| 45 | |
| 46 | |
| 47 | PREREQUISITES |
| 48 | |
| 49 | To run Vim, you need the emx runtime environment (at least rev. 0.9b). This |
| 50 | is generally available as (ask Archie about it): |
| 51 | |
| 52 | emxrt.zip emx runtime package |
| 53 | |
| 54 | I've included a copy of emx.dll, which should be copied to one of the |
Bram Moolenaar | 402d2fe | 2005-04-15 21:00:38 +0000 | [diff] [blame] | 55 | directories listed in your LIBPATH. Emx is GPL'ed, but the emx.dll library is |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 56 | not (read COPYING.EMX to find out what that means to you). |
| 57 | |
| 58 | This emx.dll is from the emxfix04.zip package, which unfortunately has a bug, |
| 59 | eh, I mean a POSIX feature, in select(). Versions of Vim before 3.27 will |
Bram Moolenaar | 402d2fe | 2005-04-15 21:00:38 +0000 | [diff] [blame] | 60 | appear to hang when starting (actually, while processing vimrc). Hit <Enter> a |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 61 | couple of times until Vim starts working if this happens. Next, get an up to |
| 62 | date version of Vim! |
| 63 | |
| 64 | |
| 65 | HELP AND VIMRC FILE |
| 66 | |
| 67 | If you unpack the archive that Vim came in and run Vim directly from where it |
| 68 | was unpacked, Vim should be able to find the runtime files and your .vimrc |
| 69 | without any settings. |
| 70 | |
| 71 | If you put the runtime files separately from the binary, the VIM environment |
| 72 | variable is used to find the location of the help files and the system .vimrc. |
| 73 | Place an entry such as this in CONFIG.SYS: > |
| 74 | |
| 75 | SET VIM=c:/local/lib/vim |
| 76 | |
| 77 | Put your .vimrc and your other Vim files in this directory. Copy the runtime |
| 78 | directory to this directory. Each version of Vim has its own runtime |
| 79 | directory. It will be called something like "c:/local/lib/vim/vim54". Thus |
| 80 | you get a tree of Vim files like this: |
| 81 | c:/local/lib/vim/.vimrc |
| 82 | c:/local/lib/vim/vim54/filetype.vim |
| 83 | c:/local/lib/vim/vim54/doc/help.txt |
| 84 | etc. |
| 85 | |
| 86 | Note: .vimrc may also be called _vimrc to accommodate those who have chosen to |
Bram Moolenaar | 402d2fe | 2005-04-15 21:00:38 +0000 | [diff] [blame] | 87 | install OS/2 on a FAT file system. Vim first tries to find .vimrc and if that |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 88 | fails, looks for _vimrc in the same place. The existence of a .vimrc or |
| 89 | _vimrc file influences the 'compatible' options, which can have unexpected side |
| 90 | effects. See |'compatible'|. |
| 91 | |
| 92 | If you're using network drives with OS/2, then you can install Vim on a |
| 93 | network drive (including .vimrc; this is then called the "system" vimrc file), |
Bram Moolenaar | 402d2fe | 2005-04-15 21:00:38 +0000 | [diff] [blame] | 94 | and then use a personal copy of .vimrc (the "user" vimrc file). This should be |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 95 | located in a directory indicated by the HOME environment variable. |
| 96 | |
| 97 | |
| 98 | ENVIRONMENT VARIABLES IN FILE NAMES |
| 99 | |
| 100 | This HOME environment variable is also used when using ~ in file names, so |
| 101 | ":e ~/textfile" will edit the file "textfile" in the directory referred to by |
| 102 | HOME. Additionally you can use other environment variables in file names, as |
Bram Moolenaar | 0630b8d | 2007-05-05 17:11:56 +0000 | [diff] [blame] | 103 | in ":n $SRC/*.c". |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 104 | |
| 105 | The HOME environment variable is also used to locate the .viminfo file |
| 106 | (see |viminfo-file|). There is no support yet for .viminfo on FAT file |
| 107 | systems yet, sorry. You could try the -i startup flag (as in "vim -i |
| 108 | $HOME/_viminfo") however. |
| 109 | |
| 110 | If the HOME environment variable is not set, the value "C:/" is used as a |
| 111 | default. |
| 112 | |
| 113 | |
| 114 | BACKSLASHES |
| 115 | |
| 116 | Using slashes ('/') and backslashes ('\') can be a bit of a problem (see |
| 117 | |dos-backslash| for more explanation), but in almost all cases Vim does "The |
| 118 | Right Thing". Vim itself uses backslashes in file names, but will happily |
| 119 | accept forward slashes if they are entered (in fact, sometimes that works |
| 120 | better!). |
| 121 | |
| 122 | |
| 123 | TEMP FILES |
| 124 | |
| 125 | Temporary files (for filtering) are put in the first directory in the next |
| 126 | list that exists and where a file can be created: |
| 127 | $TMP |
| 128 | $TEMP |
| 129 | C:\TMP |
| 130 | C:\TEMP |
| 131 | current directory |
| 132 | |
| 133 | |
| 134 | TERMINAL SETTING |
| 135 | |
| 136 | *os2ansi* |
| 137 | Use "os2ansi" as the TERM environment variable (or don't set it at all, as the |
Bram Moolenaar | 402d2fe | 2005-04-15 21:00:38 +0000 | [diff] [blame] | 138 | default is the correct value). You can set term to os2ansi in the .vimrc, in |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 139 | case you need TERM to be a different value for other applications. The |
| 140 | problem is that OS/2 ANSI emulation is quite limited (it doesn't have insert / |
| 141 | delete line, for example). |
| 142 | |
| 143 | If you want to use a different value for TERM (because of other programs, for |
| 144 | example), make sure that the termcap entry for that TERM value has the |
Bram Moolenaar | 402d2fe | 2005-04-15 21:00:38 +0000 | [diff] [blame] | 145 | appropriate key mappings. The termcap.dat distributed with emx does not always |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 146 | have them. Here are some suitable values to add to the termcap entry of your |
| 147 | choice; these allow the cursor keys and the named function keys (such as |
| 148 | pagedown) to work. |
| 149 | |
| 150 | :ku=\316H:kd=\316P:kl=\316K:kr=\316M:%i=\316t:#4=\316s:\ |
| 151 | :kD=\316S:kI=\316R:kN=\316Q:kP=\316I:kh=\316G:@7=\316O:\ |
| 152 | :k1=\316;:k2=\316<:k3=\316=:k4=\316>:k5=\316?:k6=\316@:\ |
| 153 | :k7=\316A:k8=\316B:k9=\316C:k;=\316D: |
| 154 | |
| 155 | |
| 156 | Paul Slootman |
| 157 | |
| 158 | |
| 159 | 43 LINE WINDOW |
| 160 | |
| 161 | A suggestion from Steven Tryon, on how to run Vim in a bigger window: |
| 162 | |
| 163 | When I call Vim from an OS/2 WPS application such as PMMail it comes up |
| 164 | in the default 25-line mode. To get a more useful window size I make |
| 165 | my external editor "vimbig.cmd" which in turn calls "vimbig2.cmd". |
| 166 | Brute force and awkwardness, perhaps, but it works. |
| 167 | |
| 168 | vimbig.cmd: > |
| 169 | @echo off |
| 170 | start "Vi Improved" /f vimbig2.cmd %1 %2 %3 %4 |
| 171 | |
| 172 | vimbig2.cmd: > |
| 173 | @echo off |
| 174 | mode 80,43 |
| 175 | vim.exe %1 %2 %3 %4 |
| 176 | exit |
| 177 | < |
| 178 | |
| 179 | CLIPBOARD ACCESS (provided by Alexander Wagner) |
| 180 | |
| 181 | Vim for OS/2 has no direct access to the system clipboard. To enable access |
| 182 | anyway you need an additional tool which gives you access to the clipboard |
| 183 | from within a vio application. The freeware package clipbrd.zip by Stefan |
| 184 | Gruendel can be used for this purpose. You might download the package |
| 185 | including precompiled binaries and all sources from: |
Bram Moolenaar | a17d4c1 | 2010-05-30 18:30:36 +0200 | [diff] [blame] | 186 | http://www.os2site.com/sw/util/clipboard/index.html |
| 187 | http://download.uni-hd.de/ftp/pub/os2/pmtools/ |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 188 | |
| 189 | Installation of this package is straight forward: just put the two executables |
| 190 | that come with this package into a directory within your PATH for Vim should |
| 191 | be able to call them from whatever directory you are working. |
| 192 | |
| 193 | To copy text from the clipboard to your Vim session you can use the :r |
| 194 | command. Simply call clipbrd.exe from within Vim in the following way: > |
| 195 | |
| 196 | :r !clipbrd -r |
| 197 | |
| 198 | To copy text from Vim to the system clipboard just mark the text in the usual |
| 199 | vim-manner and call: > |
| 200 | |
| 201 | :!clipbrd -w |
| 202 | |
| 203 | which will write your selection right into OS/2's clipboard. |
| 204 | |
Bram Moolenaar | 06b5d51 | 2010-05-22 15:37:44 +0200 | [diff] [blame] | 205 | For ease of use you might want to add some maps for these commands. E.g. to |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 206 | use F11 to paste the clipboard into Vim and F12 to copy selected text to the |
| 207 | clipboard you would use: > |
| 208 | |
| 209 | if has("os2") |
| 210 | imap <F11> <ESC>:r !clipbrd -r<CR>i |
| 211 | vmap <F12> :!clipbrd -w<cr> |
| 212 | else |
| 213 | imap <F11> <ESC>"*p<CR>i |
| 214 | vmap <F12> "*y |
| 215 | endif |
| 216 | |
| 217 | This will ensure that only on OS/2 clipbrd is called whereas on other |
Bram Moolenaar | 402d2fe | 2005-04-15 21:00:38 +0000 | [diff] [blame] | 218 | platforms vims build in mechanism is used. (To enable this functions on every |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 219 | load of Vim place the above lines in your .vimrc.) |
| 220 | |
| 221 | vim:tw=78:ts=8:ft=help:norl: |