Mike <mikee@mikee.ath.cx> wrote:
+---------------
| Tamas K Papp <tkpapp@gmail.com> wrote:
| > Are you using SLIME, or some other IDE?
|
| I'm a vi user for decades. I used emacs for a while. Emacs is not
| conducive to my style of system administration. Vi is on every unix
| machine (mac and I can get it on windows too).
+---------------
Here are a few small tips on using Vi (or Vim) when editing Lisp:
- Set the following options:
:se ai icl sm mat=2 sw=1
or without the abbreviations:
:set autoindent iclower showmatch matchtime=2 shiftwidth=1
That is, set:
- Autoindent [use ^D or 0^D to cancel some/all of the indenting].
- Ignore case in searches but only if the search string
is all lower case.
- Show ("flash") the open matching paren/bracket/brace
when the closing matching paren/bracket/brace is inserted.
- Set the "flash" time for paren matching to 200 ms (or whatever
time is comfortable for you -- editing across slower speed
network connections may need larger values).
- Set the amount to shift text left/right to one space. [You can
use the "." command to quickly repeat the same shift to get larger
shift amounts.]
- With that done, then you can use the "%" command to bounce back
and force between matching parens; you can place the cursor on
[or on front of] a paren and use ">%" to shift a whole sexp right,
or "<%" to shift it left, or ">%..." to shift a sexp right 4 spaces,
etc.
- "d%" will, of course, delete a whole sexp; "y%" will "yank" (copy) one;
"p" will paste it after the current point [and "P" will paste before].
All of these can be used with prefix Q-register names (e,g, "a etc.)
- Experiment with ":set lisp" and see if it does anything useful
for you. [It might will not, since it was never well-supported.]
- Vim has more Lisp-friendly options than Vi; it might be worth looking
into. [I don't use Vim much, "nvi-1.79" is my standard editor, so I
can't offer much more help there.]
- Create yourself a "map" entry in your "~/.exrc" for some function
key [I use "shift-<F12>" myself] to type ":r!cat^V^M" for you.
That will let you paste hunks of Lisp from somewhere else into
your editing sessions without the autoindenting (turned on above)
messing up the indenting. [And if you have the "xselection" or
"xclip" programs, you can make a "map" entry I use <F12>] that
pastes the current X selection directly, without having to hit
middle-mouse then EOF, as needed with ":r!cat".]
Not much, I know, but should help some...
-Rob
-----
Rob Warnock <rpw3@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607