[问题]vim PK emacs
- houdini
- 帖子: 250
- 注册时间: 2006-04-08 22:07
- 联系:
当然是 GNU Emacs 好了。
强大无匹,完全可定制,支持xft,而且更加智能……
举个例子:
请问在Vim下面怎么简单删去以下数据的第二栏(12和15)
6.00 12 programming
6.001 15 sicp
6.002 15 circuits
6.003 15 linearsystems
6.004 15 digital
6.011 12 signalproc
Emacs 解决方案:C-x ( M-f M-f M-d C-n C-a C-x ) C-u 5 C-x e
当然,行数越多越好,把上面的5改成总行数-1就可以了。
强大无匹,完全可定制,支持xft,而且更加智能……
举个例子:
请问在Vim下面怎么简单删去以下数据的第二栏(12和15)
6.00 12 programming
6.001 15 sicp
6.002 15 circuits
6.003 15 linearsystems
6.004 15 digital
6.011 12 signalproc
Emacs 解决方案:C-x ( M-f M-f M-d C-n C-a C-x ) C-u 5 C-x e
当然,行数越多越好,把上面的5改成总行数-1就可以了。
上次由 houdini 在 2007-06-29 13:23,总共编辑 1 次。
An Addicted KDE User
- BigSnake.NET
- 帖子: 12522
- 注册时间: 2006-07-02 11:16
- 来自: 廣州
- 联系:
代码: 全选
$ echo '6.00 12 programming
6.001 15 sicp
6.002 15 circuits
6.003 15 linearsystems
6.004 15 digital
6.011 12 signalproc '|perl -p -e 's/^([^ ]+) ([^ ]+) ([^ ]+)/\1 \3/g'
6.00 programming
6.001 sicp
6.002 circuits
6.003 linearsystems
6.004 digital
6.011 signalproc
^_^ ~~~
要理解递归,首先要理解递归。
地球人都知道,理论上,理论跟实际是没有差别的,但实际上,理论跟实际的差别是相当大滴。
要理解递归,首先要理解递归。
地球人都知道,理论上,理论跟实际是没有差别的,但实际上,理论跟实际的差别是相当大滴。
-
- 帖子: 3
- 注册时间: 2007-06-27 8:40
-
- 帖子: 1340
- 注册时间: 2006-01-10 19:09
vim肯定不需要这么多键的~等我回去操作一下houdini 写了:当然是 GNU Emacs 好了。
强大无匹,完全可定制,支持xft,而且更加智能……
举个例子:
请问在Vim下面怎么简单删去以下数据的第二栏(12和15)
6.00 12 programming
6.001 15 sicp
6.002 15 circuits
6.003 15 linearsystems
6.004 15 digital
6.011 12 signalproc
Emacs 解决方案:C-x ( M-f M-f M-d C-n C-a C-x ) C-u 5 C-x e
当然,行数越多越好,把上面的5改成总行数-1就可以了。
- houdini
- 帖子: 250
- 注册时间: 2006-04-08 22:07
- 联系:
当然,Vim也很好,它轻巧快速,功能也够强,适合使用Vim还是Emacs因人而异,不能一概而论。winter198351 写了:其实Vi的定制能力也很强,而且很方便。
16楼老兄说的那个问题 在VI中也很容易实现
利用Vi的宏编辑功能可轻松实现 删除第二栏的功能
如:qa ^ 3w dw $ j q
如果有6行就 用6@a就可以了。
总得来说,编辑配置文件和小文本文件我习惯用Vim,编程序还是觉得Emacs顺手。
我给出的解决方案也是列出键盘宏。
但Vim的定制能力和Emacs毕竟不是同一层次上的,因为Emacs本身就是Elisp解释器。
还有就是递归编辑模式不知在Vim里怎么实现?
An Addicted KDE User
- houdini
- 帖子: 250
- 注册时间: 2006-04-08 22:07
- 联系:
- houdini
- 帖子: 250
- 注册时间: 2006-04-08 22:07
- 联系:
http://en.wikipedia.org/wiki/Editor_war
Differences between vi and Emacs
The most important differences between vi and Emacs are:
* vi is a heavily modal editor (although some derivative versions, such as VIM, have an "easy mode"). Emacs relies less on modes, but makes extensive use of key chords (multiple keys pressed simultaneously, typically a Control or Meta (Alt) key plus some letter) for controlling the editor. In vi, the commands for modifying text and for moving around mostly use simple letter and number keystrokes, the same as the keystrokes used for inserting text. As a result, the user must switch into a separate mode to insert text.
* vi is small and fast, and (traditionally at least) has limited customizability. Emacs takes longer to start up and requires more RAM, but is highly customizable and includes a large number of bells and whistles, as it is essentially a Lisp programming language execution environment which by default runs a Lisp program designed for text-editing.
* vi was traditionally used inside of a text-mode console, having no X interface, whereas GNU Emacs, while initially designed for use on a console, grew an X interface fairly early on – modern versions of both provide various GUIs.
The difference in feature set and startup time tends to influence the way that the editors are used: vi users tend to enter and exit the editor repeatedly, and use the Unix shell for complex tasks, whereas Emacs users usually remain within the editor and use Emacs itself for complex tasks (often using an embedded shell mode when issuing shell commands).
Claimed benefits of vi-like editors
* vi is smaller and faster than Emacs and requires less overhead, as it is not subject to creeping featurism.
* vi is present in all Unix based operating systems, as guaranteed by the POSIX standard.
* vi users argue that it conforms with Unix design and philosophy ("do one thing, and do it well"). Unix does not advocate building "Swiss Army knives", instead favoring the right tool for the right job.
* vi commands are entered largely without the use of modifier keys such as Ctrl or Alt. Some users find this reduces repetitive strain injury in the wrists.
* vi is intentionally "what you see is what you get (pretty much everywhere)". vi users generally do not customize their editor much, as opposed to advanced Emacs users who would not feel comfortable if their heavily customized profile were not available to them. [1]
Claimed benefits of Emacs
* Emacs has a much larger set of built-in commands than vi.
* Emacs is scriptable in a variant of the Lisp programming language called Emacs Lisp.
* Emacs includes a vi emulation mode ("viper-mode").
* Emacs does not require switching between "command" and "input" mode: commands are given with metakey chords. Users claim this improves the "flow" of their work by not requiring them to continually switch between modes.
* GNU Emacs can perform computations with some calendars, such as Mayan or Discordian, which are not supported by the vi-like editors.
* Emacs has special editing modes for a large number of programming and markup languages, including Java, Python, Perl, C, C++, Objective-C, Fortran, Lisp, Scheme and Pascal and scripting language modes for Bash and other common shells.
* Emacs supports typing and displaying in many non-English languages, including Chinese, Czech, Hindi, Hebrew, Russian, Vietnamese as well as Western European languages.
* Emacs can create PostScript output from plain text files[2] and has special editing modes for document presentation formats like LaTeX, TeX, and Wikipedia.
* Emacs can be used as a shell itself,[3] and many tasks which would normally require the user to exit the editor interface can be performed from within the editor interface using plugins. This includes merge and diff functions, debugging operations, version control management, file and directory manipulation via dired, email, web browsing, and newsgroup checking (using gnus).
* Emacs is easily extensible and modifiable in that users can simply add a mode (really a program) to the existing implementation of Emacs by taking advantage of the Emacs Lisp interpreter, whereas vi users have to resort to calling external programs; in this view (held by Eric S. Raymond among others), Emacs is not so much a program but a portable framework in which modules are added together as needed.
* (GNU) Emacs gives the new user a helpful screen explaining how to exit (at least since the late 1980s). The typical vendor vi provided no help and was impossible for a new user to exit without external measures (e.g., disconnecting their terminal). Newer vi's have fixed this problem.
(Many of these benefits are based on historic deficiencies of vi; modern versions, such as VIM, do offer some of these features, though in doing so they lose other advantages such as universal availability.)
An Addicted KDE User
-
- 帖子: 3
- 注册时间: 2007-06-27 8:40
- zhan
- 帖子: 1880
- 注册时间: 2005-08-15 0:04
- 来自: 南7技校
perl ..... 单就这个例子来说不如用 awkBigSnake.NET 写了:代码: 全选
$ echo '6.00 12 programming 6.001 15 sicp 6.002 15 circuits 6.003 15 linearsystems 6.004 15 digital 6.011 12 signalproc '|perl -p -e 's/^([^ ]+) ([^ ]+) ([^ ]+)/\1 \3/g' 6.00 programming 6.001 sicp 6.002 circuits 6.003 linearsystems 6.004 digital 6.011 signalproc
代码: 全选
zhan@mylinux:~$ echo '6.00 12 programming
6.001 15 sicp
6.002 15 circuits
6.003 15 linearsystems
6.004 15 digital
6.011 12 signalproc '|awk '{print $1,$3}'
6.00 programming
6.001 sicp
6.002 circuits
6.003 linearsystems
6.004 digital
6.011 signalproc
飞得高,飞得低,学习再学习,多少大秘密!
http://zhan.blog.ubuntu.org.cn
http://zhan.blog.ubuntu.org.cn
- houdini
- 帖子: 250
- 注册时间: 2006-04-08 22:07
- 联系:
再给一个例子,大家来比较:
法2(RE替换) M-x replace-regexp \(\w+\) \(\w+\) RET \, (upcase \2), \1
* 这两个例子都来自MIT Phil Sung的 Being Productive With Emacs
转换成:Bill Gates
Steve Jobs
Eric Schmidt
Larry Ellison
法1(键盘宏) C-x ( M-d C-d M-u , SPACE C-y C-n C-a C-x ) C-u 3 C-x eGATES, Bill
JOBS, Steve
SCHMIDT, Eric
ELLISON, Larry
法2(RE替换) M-x replace-regexp \(\w+\) \(\w+\) RET \, (upcase \2), \1
* 这两个例子都来自MIT Phil Sung的 Being Productive With Emacs
An Addicted KDE User
-
- 帖子: 14
- 注册时间: 2007-04-08 3:10
Orz, 现在只会基本的命令已经感觉很方便了。Emacs比我想像的复杂的太多了。
houdini 写了:再给一个例子,大家来比较:
转换成:Bill Gates
Steve Jobs
Eric Schmidt
Larry Ellison
法1(键盘宏) C-x ( M-d C-d M-u , SPACE C-y C-n C-a C-x ) C-u 3 C-x eGATES, Bill
JOBS, Steve
SCHMIDT, Eric
ELLISON, Larry
法2(RE替换) M-x replace-regexp \(\w+\) \(\w+\) RET \, (upcase \2), \1
* 这两个例子都来自MIT Phil Sung的 Being Productive With Emacs
- BigSnake.NET
- 帖子: 12522
- 注册时间: 2006-07-02 11:16
- 来自: 廣州
- 联系:
一时短路了..zhan 写了:perl ..... 单就这个例子来说不如用 awkBigSnake.NET 写了:代码: 全选
$ echo '6.00 12 programming 6.001 15 sicp 6.002 15 circuits 6.003 15 linearsystems 6.004 15 digital 6.011 12 signalproc '|perl -p -e 's/^([^ ]+) ([^ ]+) ([^ ]+)/\1 \3/g' 6.00 programming 6.001 sicp 6.002 circuits 6.003 linearsystems 6.004 digital 6.011 signalproc
代码: 全选
zhan@mylinux:~$ echo '6.00 12 programming 6.001 15 sicp 6.002 15 circuits 6.003 15 linearsystems 6.004 15 digital 6.011 12 signalproc '|awk '{print $1,$3}' 6.00 programming 6.001 sicp 6.002 circuits 6.003 linearsystems 6.004 digital 6.011 signalproc
前几天那个高亮就是用perl加上去的..<Linux Server Hacks>上学来的
^_^ ~~~
要理解递归,首先要理解递归。
地球人都知道,理论上,理论跟实际是没有差别的,但实际上,理论跟实际的差别是相当大滴。
要理解递归,首先要理解递归。
地球人都知道,理论上,理论跟实际是没有差别的,但实际上,理论跟实际的差别是相当大滴。