[Nfb-science] Accessible Math

Brian Buhrow buhrow at nfbcal.org
Mon Aug 24 07:24:07 UTC 2015


	Hello Bryan.  It has always been my assertion that the addage with vi
or vim  as you know it, is not "Can I do X with vim?", but "How can I do X
with vim?"
Specifically, I believe you can do all the things you're asking for with
vim as follows:

1.  For auto-indent, try something like the following when editing a file:
:set autoindent
Now, when ever you open a line below an existing line, the left margin of
that line will line up with the left margin of the line above it.

2.  To see line numbers in vim, try the following:
:set number
This will cause all of the line numbers of the file to appear on the left
hand side of the screen as you move up and down.  To turn this off, use:
:set nonumber

3.  For autocomplete, I can't think of an exact equivalent, but vim has a
macro language which will let you set keystrokes to emit certain commands
or type certain strings.  Look for instructions using the :map command.

4.  I'm assuming you already know about tricks in vim like finding balanced
parenthesis, braces brackets or angle brackets by putting your cursor on
one  of these characters and, while in command mode, pressing the % key.
Doing this will cause your cursor to move to the matching character for
that  character.  So, for example, if you have something like:
This sentence has nested parenthesis (starting here, (and including this
iner set as well), and ending here).

If you put your cursor on the last parenthesis on the previous line, and
press the %, you'll find you're now on the first opening parenthesis for
the set of nested parenthesis.  If you then move to the second opening
parenthesis and press the % key, you'll be moved to the corresponding
closing parenthesis.  Because python uses indentation to define scope
rather than braces, brackets or other characters, this feature might not be
as useful as it might otherwise be, but I find it invaluable for finding
unbalanced constructs of this kind.

	I use vi rather than vim, but I think vim is backward compatible with
vi, so I'll include the contents of my .exrc (.vimrc) file here in case it
has other tidbits you might find helpful.  As I said earlier, I'm convinced
that when it comes to text editing, it's now can I do something in vi/vim,
but how can I do it.

Hope this helps.

-thanks
-Brian

<cut here for .exrc>

set tabstop=5
set wrapmargin=5




More information about the NFB-Science mailing list