I am looking for tips for learning Vim or Emacs the smart way

后端 未结 18 1757
迷失自我
迷失自我 2021-01-29 20:34

I am a quite happy user of Eclipse (I mostly develop in PHP and Python), however I found the answers to \"What specific productivity gains does Vim/Emacs provide over GUI text e

相关标签:
18条回答
  • 2021-01-29 20:53

    I came to Vim when I started using Linux after years of Windows development, and had to do a lot of work on remote systems via ssh. For the first couple of weeks hated it. After that I could not live without it.

    Probably the best way to start is to use Vim in easy mode ([g]vim -y), most installations have a shortcut called evim. This runs vim in a mode that is in insert mode by default and remaps keys to the usual Windows ones (ctrl-S to save, ctrl-X to cut etc). You can then use it like a regular Windowsy editor but still access the power of Vim.

    There is also Cream which is Vim + a bunch of scripts to make it behave even more like a Windows editor.

    I started out using evim and Cream, but found I gradually transitioned to using 100% vim.

    Also if you use gvim then most of the functionality is also available through the menus and you can see the keystrokes for the same functionality.

    Also read the docs - there are extensive help files available on every aspect. I still browse them from time to time and find something new.

    0 讨论(0)
  • 2021-01-29 20:53

    One argument in favor of Vim if you know Python is that you can write Vim scripts in Python. See :h python. Emacs requires you to learn elisp.

    I find myself gravitating toward Vim for scripting languages like Ruby/Perl/Python/PHP, and for Emacs for languages that are more interactive (Lisp, essentially). If you develop your Python code using an interactive Python shell a lot, Emacs might be good, because you can embed a Python shell right into Emacs. If you write code and run it from commandline a lot, Vim can handle that easily enough via :make or :!.

    I really recommend you learn both and pick whichever you like better. They are both worth knowing.

    0 讨论(0)
  • 2021-01-29 20:53

    Wow, vi/vim vs emacs, what a temptation...

    From a vi-user's perspective...

    • Always There
      vi is on about every unix system ever released, in the default install, and available for Win
    • May save you from RSI
      vi uses home-row keys for just about everything, modifiers like control and meta are used only for rarely invoked functions and even shift-key use is moderate. This was probably all just a lucky accident, but don't laugh at RSI. It can happen to anyone, it's seriously painful, it's potentially career-ending, and it's hard to treat.
    • Starts up instantly.
      In the past, this was a huge advantage over emacs. Emacs users had to start up just once, and navigate everywhere within emacs. Today it starts faster, but in vi, it's perfectly reasonable to quit out of it entirely on every compile or test cycle.
    • Has an awesome line-mode
      The line mode in vi is backwards compatible to the original Unix ed(1) program, an editor that had only a line mode. That is, vi's regular-expression-substitution-engine-/-line-editor was once an editor all by itself.
    • Easily scriptable
      Got something you want to do to every .whatever file in your project? It's easy to write a declarative script that will edit a sequence of files. No need for imperative or procedural programming.
    • Easily extensible
      Vim, at least, can be extended in Python.
    0 讨论(0)
  • 2021-01-29 20:53

    First of all, be humble.

    As long as you remain aware that they are very powerful tools you'll be ok. If you are finding a task very difficult, and you are thinking 'it's just me that sucks not the editor', you're in the right mind to learn and improve.

    Bram's 7 habits are a good tenets to go by http://www.moolenaar.net/habits.html

    Also I highly recommend having a go at writing a plugin. It doesn't matter what it does. It gives you the impetus to dive deep into the manuals.

    0 讨论(0)
  • 2021-01-29 20:55

    Here's the way you learn: Start typing. When you hit a point where you want to do something other than typing, look up how you do that. Repeat. It helps to start with a few basics, say 7 fundamental commands. Other than that, when you run into wanting to do some operation, look it up and use it.

    0 讨论(0)
  • 2021-01-29 20:59

    This should really just be a comment, but against which answer ...

    With Vim I'd suggest using the GUI version for a start, just dive in, the built-in help is excellent (:h and the screen splits adding a panel with comprehensive "hyperlinked" help pages). With vim the only potentially dangerous operation is a write, everything else you do is recoverable per command or edit (undo & redo).

    The power acquired easily incentivises the learning.

    0 讨论(0)
提交回复
热议问题