From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id VAA25148 for caml-redistribution@pauillac.inria.fr; Wed, 3 Nov 1999 21:58:00 +0100 (MET) Resent-Message-Id: <199911032058.VAA25148@pauillac.inria.fr> Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id AAA26145 for ; Wed, 3 Nov 1999 00:12:35 +0100 (MET) Received: from miss.wu-wien.ac.at (miss.wu-wien.ac.at [137.208.107.17]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id AAA29938 for ; Wed, 3 Nov 1999 00:12:33 +0100 (MET) Received: (from mottl@localhost) by miss.wu-wien.ac.at (8.9.0/8.9.0) id AAA11578 for caml-list@inria.fr; Wed, 3 Nov 1999 00:12:33 +0100 (MET) From: Markus Mottl Message-Id: <199911022312.AAA11578@miss.wu-wien.ac.at> Subject: VIM-hints To: caml-list@inria.fr (OCAML) Date: Wed, 3 Nov 1999 00:12:32 +0100 (MET) X-Mailer: ELM [version 2.4 PL21] MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Resent-From: weis@pauillac.inria.fr Resent-Date: Wed, 3 Nov 1999 21:58:00 +0100 Resent-To: caml-redistribution@pauillac.inria.fr Hello, I guess that there are quite some people who use the editor VIM (Vi Improved) out there (see: www.vim.org). I have just tried to find out some more extras of VIM and found a very convenient way of building and debugging OCaml programs so I thought that you might also want to learn about it: VIM allows you to specify patterns which scan output produced by the compiler and/or during the make process. By teaching VIM the patterns that normally appear when the OCaml-compilers find a bug, it is possible to have the editor automatically load the corresponding file and place the cursor at the exact line + column. If you also bind, say, a function key to calling "make", you never have to leave the editor anymore. The following variable settings seem to be very useful for this purpose - put them in your ".vimrc"-file: --------------------------------------------------------------------------- map :make au BufNewFile,BufRead *.ml,*.mli,*.mll,*.mly set expandtab hidden autowrite efm=%+AFile\ \"%f\"\\,\ line\ %l\\,\ characters\ %c-%*\\d:,%Z%m --------------------------------------------------------------------------- The first line binds a function key to calling the appropriate "make" (the latter can be configured with e.g. "set makeprg=gmake"). The second line (it's just one - this is important!) says what has to be done when you create a new file or open an existing one with the corresponding OCaml-suffixes. The options in this line have the following meaning: * "expandtab" - use spaces instead of tabs when the tabulator key is used (I recommend this in general for sources). * "hidden" - Very important! If you call "make" and there is an error, VIM will open the file containing it, but forgets about the one that you changed - no undo anymore! This option orders VIM to not forget about old buffers... * "autowrite" - if you set this, then you do not have to save the files before executing "make" anymore. * "efm" - the patterns for which VIM scans the output of the building process. See the help on "quickfix" in VIM for more details. I have found that (at least for me) these features give quite some boost in development speed, especially if you want to rename things or if a small change requires many further changes in different parts of the program: then making use of the above features will (in most cases) help you track down all code parts that require an update - just "make" and let VIM do the job... Happy VIMing! Regards, Markus Mottl -- Markus Mottl, mottl@miss.wu-wien.ac.at, http://miss.wu-wien.ac.at/~mottl