Purpose: to discuss the Vim editor.
First, you can find Vim at http://www.vim.org/
MC 16 Jul 2003: This is probably old news to many, but I finally stumbled upon this little gem only this evening:
vim already does syntax highlighting for *.tcl files. For files without an extension, however, adding a comment in your code that says:
# vim: syntax=tcl
causes vim to do the highlighting properly.
glennj This magic depends on two settings: (default values)
set modeline modelines=5
vim will then look at the top 5 lines and the bottom 5 lines for these special comments. See
:help modeline
Modelines are handy for "forcing" people to conform to particular vim settings. For example, if you like a 8 space indent using tabs, but you're editing someone else's code who likes 4 space indent and no tabs, then in order not to mess up that person's code, you'll want a modeline like (demonstrating the alternate modeline syntax)
# vim: set shiftwidth=4 smarttab expandtab:
Configuring Vim to conform to yhe Tcl Style Guide
indenting
set autoindent " keep the previous line's indentation set cindent " indent after line ending in {, and use 'cinwords' " see also ':help c-indent' set shiftwidth=4
do not inadvertantly break a line
set textwidth=0
comments
set comments=:# set formatoptions+=r " Automatically insert the current comment leader set formatoptions+=q " Allow formatting of comments with 'gq'
prevent the comment character from forcibly being inserted in column 1
set cpoptions-=< " allow '<keycode>' forms in mappings, e.g. <CR> inoremap # X<BS># set cinkeys-=0# " # in column 1 does not prevent >> from indenting set indentkeys-=0#
Version 6 of vim has a wonderful feature called folding, where blocks of text can be hidden as a single line until you have to enter them. However, I can't seem to get syntax-based automatic folding of procs. The obvious
syntax region tclFunc start="^proc.*{$" end="^}" transparent fold
does nothing. Folding blocks works fine with
syntax region tclBlock start="{" end="}" transparent fold
but I don't really want to fold every block, I'd rather do it on the proc level. Any suggestions?
What: Vim Where: http://www.vim.org/ http://www.mcs.net/%7Eimdave/ftp/vimconsole-1.2.tgz Description: Vi clone which provides language syntax colorization (including Tcl), command line edit and recall, filename completion, split windows, mouse control, drag and drop, and other features. The vimconsole is a Tclsh shell that interacts with the Tcl support one can build into vim. Currently at version 6.0 . Updated: 09/2001 Contact: mailto:[email protected]