[vox-tech] missing vim

Ricardo Anguiano vox-tech@lists.lugod.org
13 May 2003 10:20:37 -0700


Before going into answers to the questions raised, I will point out
that the emacs manual can be found by starting emacs and entering

        C-h i (emacs) 

I need to spend more time with the manual myself.  If you are looking
for a basic tutorial enter:

        C-h t

Michael Wenk <wenk@praxis.homedns.org> writes:
> > (3) Move the cursor by screen lines instead of virtual lines. I
> > primarily want this because LaTeX paragraphs can get quite long,
> > and if I want to access text in the middle of the paragraph, it is
> > easier to spot the text and move to it than to guess with
> > word/sentence movement commands. In vim: g<movement command>

Not sure, but both C-<uparrow> and C-<downarrow> jump mode-specific
paragraphs.  That may be what you are looking for.

> Hmm, I use M g to goto particular lines. Not sure about how to do this. 

M-g doesn't work on my system.  I believe it works with your system
because because you remapped the key combo.  I use C-c g <linenumber>
<enter>.  To get this to work I put this in my .emacs:

        (global-set-key "\C-cg" 'goto-line)

C-c <key> are the user remappable key combos.  They are bound to
nothing initially.  If you remap other key combos you overwrite
already used keybindings.  Here's a few I like to keep around:

     (global-set-key "\C-ct" 'my-insert-current-time)
     (global-set-key "\C-ce" 'my-insert-name-email)
     (global-set-key "\C-cl" 'my-insert-line)
     (global-set-key "\C-cc" 'compile)
     (global-set-key "\C-cg" 'goto-line)
     (global-set-key "\C-cr" 'rename-buffer)
     (global-set-key "\C-cb" 'shell) ; b for bash

I wrote the my-* functions.  Here's one:

     (defun my-insert-current-time ()
       (interactive)
       (insert (current-time-string)))

> > (4) Allow the cursor to stray all the way to the end of each line on the
> >     screen regardless of how much text is actually on the line. (This is
> >     much more useful than it sounds.) In vim: set ve=all
> 
> ctrl e goes to end of line.  
> 
> > (5) Display line numbers next to each line. In vim: set nu

To make the line number appear in the status bar for that buffer I use
this:

        (line-number-mode t)

I also like to know which column number I am in:

        (column-number-mode t)


> > (6) Send the cursor to the top, middle, or bottom of the screen. In vim:
> >     H, M, L

The closest things which I actually use are:

     M-< move to top of buffer
     M-> move to bottom of buffer
     C-l center buffer around point

Closer inspection of the manual might help you there.  The emacs
manual refers to the cursor as "point".

> > (7) Folding -- automatically collapse sections of the code based on some
> >     criteria. In vim: set fdm=indent

I am not sure what you mean.  Do you have a short example?

> > (8) Out of curiousity, do most people experienced with emacs use
> >     ^N/^P/^B/^F or just the arrow keys?

I use the arrow keys and feel no shame in it. :) C-n and friends are
good to know when your arrow keys don't work.  That's a rare case for
me.

> It was difficult to force emacs to use tabs for indents,

The tab key is usually bound to an edit-mode specific function.  For
message buffers (the buffer i am in now, editing this email) tab is
bound to the function message-tab.  You can rebind the tab key to any
function you want, including one that prints an actual tab character.

     (defun my-tab ()
             (interactive)
             (insert-char ?\t 1))
     (global-set-key "\t" 'my-tab)

Or you can just type C-q <tab> if this is not a frequent need. <tab>
usually does the right thing for me.

> and emacs required being run from a particular termtype.

emacs requires being run from termtypes which it supports.  If I find
a weird terminal I usually just punt and change the term type at the
shell prompt.  Usually with some combination of these:

        unset TERMCAP
        export TERM=vt100
        resize

Seems to work ok on an emergency basis.

> I couldn't just waltz in the machine room and on a vt320 and run it
> well.  Also, if termcaps or terminfos get messed or confused, it can
> be odd.  Ive also noticed that ed works well in these cases.

True.  ed can save your bacon in those situations.  Thankfully, I
haven't run into any like that in years and emacs works fine on the
systems I use, even emacs -nw over ssh.

-- 
Ricardo Anguiano
http://www.codesourcery.com