Concepts The Emacs Newbie Should Master
benjisimon.blogspot.com
benjisimon.blogspot.com
http://philjackson.github.com/magit/
I use custom Elisp to combine magit, git-blame, and other commands into a unified git environment:
https://github.com/emk/elisp/blob/5db6db4e7d96a3ef1c0a5fee76... https://github.com/emk/elisp/blob/5db6db4e7d96a3ef1c0a5fee76... https://github.com/emk/elisp/blob/5db6db4e7d96a3ef1c0a5fee76...
It's especially handy to be able to pull up git-blame information for the current buffer with just a few keystrokes. This turns your git commit messages into a layer of hidden code comments.
I've got to say though; seeing that article explain how Emacs helped him use RCS and how it also has support for CVS and SVN really does _not_ help the "Emacs is from the 80s" stereotype. Especially ironic since magit is the best git UI I've seen anywhere.
The mark ring. Whenever you place a mark (highlighting a region), its place is also added to a ring, and you can jump between them by pressing "C-u space" (or "C-x space" for pop-global-mark, which will jump between buffers). Many commands that move a long way add an implicit mark, so this works quite well as a "where was I..." command.
For "dynamic abbreviations", I recommend pabbrev (http://homepages.cs.ncl.ac.uk/phillip.lord/download/emacs/pa...) - when Emacs is otherwise idle, it starts building a lookup trie of prefixes to frequently used words, so it will suggest completions under the cursor as you type. I love it.
I much prefer iswitchb to the default buffer switching system. YMMV.
Don't forget about learning Emacs lisp, either! It adds quite a bit of flexibility to Emacs. It's kind of a crappy, backward Lisp dialect, but still tremendously useful.
Finally, learn to use the help system. Emacs's naming is really idiosyncratic, but it gives you several powerful ways to look things up, so you don't have to memorize everything.
Like image-dired, ibuffer, yasnippet, ...
C-x z, the command that repeat the last command for every 'z' you type. This is in my opinion one of the most important feature of Emacs
M-s o, the 'occur' command that show all the lines that match a specified regexp
File variables: http://www.gnu.org/software/emacs/manual/html_node/emacs/Spe...
* Tramp for remote/sudo editing: http://www.emacswiki.org/cgi-bin/wiki/TrampMode
* emacsclient if you want emacs everywhere all the time: http://www.emacswiki.org/emacs/EmacsClient
The Universal Principles of Design (among other places) talks about the 80/20 rule — but Emacs is so powerful and customizable that no two people ever agree on which 20% is the most important!
First rule of emacs: don't quit. Or, more specifically, don't shut it down.
I used to do this, but a few months ago I managed to really screw up a file I was working on, but didn't notice the problem until after I had saved it. And because I hadn't closed that emacs session for over a week, I couldn't even revert to a backup without losing a week's worth of work (emacs normally only creates a backup file when it closes). So for the last few months I close every session every day when I quit for the night.
I use emacs every day, and don't think I've ever used it though. Just put the stuff you want to delete in the kill ring.
Why don't you want stuff in the kill ring? It takes some getting used to, but I've found it's generally a good thing. You can always yank back previous items in the ring with M-y too, so it isn't like your OS clipboard where 'cutting' something else means you lose access to the previous item on the clipboard.
Perhaps I should instead write a new command to kill a region, but then swap the last two things in the kill ring. That's actually a good idea...
(delete-selection-mode 1)
(transient-mark-mode 1) ; enabled by default in emacs 23+
you can mark a region and press delete or backspace (or start typing replacement text) to delete the region without affecting the kill ring.The benefit is that you have an editor that you can extend in Emacs Lisp. (I assume you mean "vim" instead of "vi". If you want a vi-like emacs, use mg. If you want a vim-like emacs, use Emacs.)
I'm an happy vimmer, but the excitement about emacs makes me jealous. All my tries to use it makes me feel like it's either an endless unintuitive shortcut list OR an editor with very little text control (which I know it isn't ) AND I fail at customizing it
Any suggestion ?
Any suggestion?
Ignore the "weird function naming" until you get used to it. Read the docs to pick up advice on how to do things the Emacs way, so the simplest macros aren't "tens of lines of code". And finally, read the Emacs souce code to see how Emacs does it. Remember, Emacs is written in Emacs Lisp, too!
However, I am very jealous of emacs' integration with other OS tools. Nothing in vim comes close to emacs integration with gdb and lisp REPLs (slime, etc). So I could see using emacs+viper if I was programming lisp, or doing a lot of debugging.
Also, I feel that vim is a very powerful text editor, but only a competent text creator. How do emacs users feel about the distinction?
vi and Emacs are both excellent, and I'd recommend picking one (or an equally sophisticated editor) and mastering it, rather than waffling back and forth. For any professional programmer, the time invested in learning a powerful editor will quickly pay for itself.
I find viper mode unsatisfying - few to no mode / extension writers provide alternative keybindings for it (shocker), so you end up having using Emacs keys anyway, only with more cognitive dissonance. Other people may feel otherwise, but that's my experience.
* a mini-Emacs, basically core Emacs without the extensibility. If it wasn't installed on OpenBSD by default, I would probably just use nvi in its place.
That said, using vi(m) for Lisp is not that hard. Paul Graham says he uses vi in his programming FAQ (http://paulgraham.com/pfaq.html). Mainly, you just need a good setup for "copy this block of code to the repl", "reload the file I just saved", and the like. A bit of integration greatly reduces friction, and Lisp development is all about reducing friction for quick experimentation and testing. (Not so sure about doing Emacs Lisp in vi, though... ;) )
Starting points:
http://cybertiggyr.com/15-vim/
http://stackoverflow.com/questions/94792/using-vim-for-lisp-...
Nekthuth doesn't have anywhere near the number of features or intimate integration with Lisp that SLIME has, but it's good enough for me.
I had tried Emacs with vimpulse and viper mode. Although it did make using Emacs less painful, it still required way too much knowledge of Emacs to use effectively and configure than I had time to dedicate to learning it.
Emacs+SLIME+vimpulse+viper might be good enough for someone who already knows Emacs or who hasn't invested a lot of time in learning vim. But for someone fluent in vim, I just don't think huge time investment in learning Emacs well is worth it.