From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ext-chunye.wang@nokia.com Newsgroups: gmane.emacs.help Subject: Re: Hard to switch from vi Date: Mon, 09 Oct 2006 02:03:32 GMT Organization: Nokia Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1160361695 27756 80.91.229.2 (9 Oct 2006 02:41:35 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 9 Oct 2006 02:41:35 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Oct 09 04:41:32 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GWl54-000229-PU for geh-help-gnu-emacs@m.gmane.org; Mon, 09 Oct 2006 04:41:27 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GWl53-0006eQ-Qx for geh-help-gnu-emacs@m.gmane.org; Sun, 08 Oct 2006 22:41:25 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed1.swip.net!swipnet!newsfeed1.funet.fi!newsfeeds.funet.fi!nntp.inet.fi!inet.fi!newsfeed1.nokia.com!news1.nokia.com!news2.nokia.com.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 69 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 Original-NNTP-Posting-Host: 172.28.82.74 Original-X-Complaints-To: newsmaster@nokia.com Original-X-Trace: news2.nokia.com 1160359412 172.28.82.74 (Mon, 09 Oct 2006 05:03:32 EET DST) Original-NNTP-Posting-Date: Mon, 09 Oct 2006 05:03:32 EET DST Original-Xref: shelby.stanford.edu gnu.emacs.help:142287 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:37906 Archived-At: Wen Weng 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