[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Hard to switch from vi
From: |
ext-chunye . wang |
Subject: |
Re: Hard to switch from vi |
Date: |
Mon, 09 Oct 2006 02:03:32 GMT |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 |
Wen Weng <WenWeng@charter.net> writes:
I am a emacsen who is used to be a vimer.
the longer you use VI, the harder to switch.
anyway, I can answer some of your question.
> Hi, I am a vi user for years and am now trying emacs.
> I find it hard to get efficient. Can someone teach me some
> commands?
>
> 1. In vi, to delete a line, I do, "dd" and to delete 5
> lines, I do "5dd". In emacs, how do I delete a complete
> line? C-k only delete
> from cursor to the end of line. Adding a C-a is really too much work.
of course, we can write a piece of elisp and bind it to some keys. It is a
problem for me that there is no such key to bind.
(defun delete-line()
(interactive)
(beginning-of-line)
(call-interactively 'kill-line))
> 2. Is there a repeat last command command like the dot command in vi?
>
C-x z or M-x repeat. this is not really same as vi dot command, because
it repeat everything, including next-line. if you want repeat many
times, press C-x z z z z z z z ....
> 3. In vi, to find a pairing brace I use the "%" command, is there a
> command like thins in emacs?
>
there are many solution for this problem. I've got my own.
further more, it is more than "%" command. please refer to
http://ann77.stu.cdut.edu.cn/EmacsEditTips.html.
I hope you can read chinese. if not, feel free to contact me.
(define-key global-map (kbd "C-3") 'wcy-mark-some-thing-at-point)
(defun wcy-mark-some-thing-at-point()
(interactive)
(let* ((from (point))
(a (mouse-start-end from from 1))
(start (car a))
(end (cadr a))
(goto-point (if (= from start )
end
start)))
(if (or (eq last-command 'wcy-mark-some-thing-at-point)
(and transient-mark-mode mark-active))
(progn
;; exchange mark and point
(goto-char (mark-marker))
(set-marker (mark-marker) from))
(push-mark (if (= goto-point start) end start) nil t)
(when (and (interactive-p) (null transient-mark-mode))
(goto-char (mark-marker))
(sit-for 0 500 nil))
(goto-char goto-point))))
> 4. Should I really need to switch to emacs?
>
If you are curious about Emacs, it is worth to do that. but you should
change the way you are thinking in VI. Emacs is different way.
Anyway, both VI and Emacs are a powerful tools, just make it confortable
for you.
> Thanks
> Wen
Message not available
Re: Hard to switch from vi, Pascal Bourguignon, 2006/10/08
Re: Hard to switch from vi,
ext-chunye . wang <=
Re: Hard to switch from vi, Markus Triska, 2006/10/09