[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A few simple questions

From: Marco Parrone
Subject: Re: A few simple questions
Date: Sat, 10 May 2003 14:19:29 GMT
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

Hash: SHA1

Wang Yin <address@hidden> writes:

> > > I have a few simple questions to ask about Emacs. They are so simple,
> > > yet it seems that I can't find them in the manual and FAQ:
> > > 
> > > 1. How can I do something like f command in vi? When I'm looking at a
> > >    line, I want to move to a charater, say 'a'. How can I do something
> > >    like "fa" in Emacs, and how to I repeat this command to go to
> > >    following a's?
> > C-s a
> > for repeated searches just type C-s  again
> I don't mean that. I want something faster that doesn't need
> interaction. 
> I want something just like a zap-to-char, but instead of killing the
> characters, move the pointer.

You can put this in your .emacs:

(defun go-to-char (arg char)
  "Go to ARG'th occurrence of CHAR.
Case is ignored if `case-fold-search' is non-nil in the current buffer.
Goes backward if ARG is negative; error if CHAR not found."
  (interactive "p\ncGo to char: ")
  (search-forward (char-to-string char) nil nil arg))

(define-key global-map (kbd "C-c g") 'go-to-char)

This is derived for zap-to-char.

> > > 2. How do I move like "W" in vi. That is, move to the next white space
> > >    delimited "Word"?
> > M-f alternatively for more word C-u 3 M-f
> I mean how can I jump over something like "emacs-21.2.tar.gz" as a
> whole, not as 5 words. I want to jump to the next white space.

Put this in you .emacs:

(defun go-to-non-alphanum (arg)
  "Search forward for a whitespace."
  (interactive "p")
  (re-search-forward "[^A-Za-z1-9]" nil nil arg))

(define-key global-map (kbd "C-c n") 'go-to-char)


- -- 
Marco Parrone - address@hidden
2143 9E77 D5E6 115A 48AD  A170 D0EE F736 (4E88 99C2)
Version: GnuPG v1.0.7 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]