Fedora notes

Monday, January 03, 2005

Editing ability - vi

What I love about vi (not mean to be exclusive):
1. I don't need to leave the edit environment such as switching from GUI application when I happen to need some console operations.
2. Full featured editor for console. Basically it meets all I need at present. Let me list some features I use most:
- text navigation: "[[" goes to the head, "]]" goes to the end.
- copy, cut & paste: "yy" for copying current line, "dd" for cutting the current line, "p" for pasting
- find pattern: "/pattern"
- find&replace: ":g/pattern/s/target/replace/g", 'pattern' is a longer text than 'target' to locate, and 'target' is the exact pattern that 'replace' will replace. of course, 'target' is supposed inside 'pattern'.
- run external commands: ":!command"
- run shell: ":sh"
- word count: ":!wc -w %"
- spell check: ":!ispell %"
- latex compile: ":!latex %"
- dvi2pdf: I don't know how to run it inside vi 'cause %'s extension changes to dvi, and even pdf if i also want to view the final pdf. Please tell me if anyone knows.
3. Reliable failure recovery mechanism. swp files...

The only thing that I feel sad about vi:
1. I cannot easily copy a long text from vi to external applications, e.g. browser. Of course I can use mouse selection for copy and middle-click for pasting, but I refer to a "long" text that may span several screens of display. I just cannot be that way of copying, scrolling, and copying again in order to copy the whole text.

2 Comments:

  • As an emacs advocator, I have some suggestions for you:) All the basic editor functions, both of them have.
    - latex compile in emacs by Auctex package:
    -step 1, if not save, save: "C-c C-c", y
    -step 2, latex: "C-c C-c"
    -step 3, (if refs changes, system will insert this command) bibtex: "C-c C-c"
    -step 3, view by dvi: "C-c C-c"
    Just using same short cuts, system helps you to judge the proper command.
    As to dvi2pdf, pdf viewer, just "C-c C-c", and autocomplete the proper command, e.g.: "C-c C-c" "dv" TAB

    As to the "long" text selection, please simply define the region's beginning(C-@) and move cursor to the end. You can copy it by "M-w", or copy it later by the multiple copy clipboard function (Multi-yank, M-y). Nice, right?

    By Blogger Tony Zhou, at 6:14 AM  

  • emacs is good, man. it can do almost everything based on its plugin/lisp architecture. but in fact, the very first reason that i love vi and hence the reason i don't use emacs is, is the first item i listed in the post. that is, an integrated console environment, which enables me to never have to switch among apps for typing commands and editting text. emacs is good because all packages installed are like apps you don't need to switch to. vi is good because it's console-based. u got my idea?:)

    By Blogger zZ, at 9:57 PM  

Post a Comment

<< Home