3

I've been using Vim for a several years. And now I want to give a try to Emacs.

For Vim I have a general config file (here) where I'm overriding defaults (e.g. hey, Vim, show me the line numbers; save more history, don't create these stupid backup files, etc...)

I want the same thing for Emacs. While searching, the best thing I've found is better-defaults.el from technomancy. I'm still digging in Prelude and Emacs-Starter-Kit sources, but there are too many overrides and plugins.

So, what I want:

  • ability to see a list of variables, which I can customize (e.g. indent-tabs-mode or newline-and-indent). I know about C-h v variable-name but this command requires me to know a name of variable, but I want a list of them
  • sample config file for Emacs which sets helpful defaults with comments for each command
Max Prokopiev
  • 273
  • 3
  • 10
  • For your first bullet; hit `tab` after `C-h v` to get the list of variables. – jlahd Mar 02 '14 at 19:10
  • great, thanks! Wondering why I didn't try to do it myself %) – Max Prokopiev Mar 02 '14 at 19:13
  • 1
    @jlahd actually, found `M-x customize` just now, which is a way better – Max Prokopiev Mar 02 '14 at 19:16
  • I'm not sure what your goals are, but do be aware that there are a variety of ways to integrate Vi-like behaviours into Emacs. Some of these ship as part of Emacs, but I believe that [Evil](http://www.emacswiki.org/emacs/Evil) is more current and presumably provides features that the others do not. YMMV. – phils Mar 02 '14 at 22:36
  • @phils yes, I know about Evil, but I don't want (at least for now) to use it – Max Prokopiev Mar 03 '14 at 03:48

2 Answers2

7
  1. For your first question: M-x customize-option.

    C-h v TAB is not what you want, as it shows you also non-option variables (e.g., internal variables).

    However, if you load library help-fns+.el then C-u C-h v TAB shows you only the user options (in buffer *Completions*).

  2. My advice would be to not look for an existing "sample config file", if you intend to start with it, as opposed to just seeing how another user redefines things. And for help with the latter, I would still recommend the Emacs manual over looking at someone elses init file. Especially to start with.

    However, if you really want to look at init files from other users then this is the place to start. (And this is a good place to start, other than the manual (which is the best place), to learn about customizing Emacs.)

  3. Finally, my (unsolicited) advice wrt learning Emacs, including customizing, is to start by not customizing it at all. I say that without irony as one who has heavily customized Emacs.

    If you want to "get it", i.e., to get a feel for the Emacs design and what makes it different, then let yourself get used to Emacs as it is out of the box -- for maybe a month or so. At that point you can think about customizing, and your customizations are likely to be much wiser (in your own terms, i.e., for whatever it is that you want).

    Another way of putting this is that until you know Emacs a bit, you really do not know what it is that you want or need in terms of customization. In particular, it would be a mistake, IMO, to start out by trying to think of Emacs in terms of Vim or trying to make Emacs do what you've done in Vim. There is plenty of time for that later, if, based on understanding Emacs, you really do want to do that.

  4. Welcome to Emacs. Enjoy.

Community
  • 1
  • 1
Drew
  • 29,895
  • 7
  • 74
  • 104
  • Regarding (1), note that (by default) `M-x apropos-variable` only displays customizable user variables, which gives you another way to find them. That's "Find Options by Name" under "Search Documentation" in the "Help" menu. – phils Mar 02 '14 at 22:26
  • @phils: Yes, indeed. I should have mentioned that one first: `apropos-variable` is our friend. Good catch. – Drew Mar 02 '14 at 22:29
  • @Drew thanks for the answer! Direct links to EmacsWiki will save me a lot of time, I'm already looking at them :) – Max Prokopiev Mar 03 '14 at 03:52
  • @Drew regarding 3 - I don't want Emacs to act like Vim, but I want to be able to alter a few vital(for me) options in it (like removing visual bell) – Max Prokopiev Mar 03 '14 at 03:54
  • Max Prokopiev: Regarding that last item, I may as well link to http://stackoverflow.com/questions/10545437/how-to-disable-the-beep-in-emacs-on-windows – phils Mar 03 '14 at 04:00
0

I'm going to take a reasonable dissent from Drew's excellent answer, there are some things you really ought to set in your emacs-file immediately, that aren't set out of the box that you really ought to set.

Issue number 1: THAT $(generate-swearing) BELL!

The bell will ding like a madman. That's annoying. You can turn it off. In your init-file, do this:

(setq visible-bell 1)

Issue number 2: Emacs has an interesting view of backup files. If you edit a file, say "foo.txt", emacs will create little backups of the file with the name "foo.txt~" in the same directory. This is annoying as all hell, and you can fix it by doing this:

(setq backup-directory-alist '(("" . "~/.emacs.d/emacs-backup")))

Issue number 3: Emacs uses C-w differently than bash does, and that's a bit annoying. C-w usually deletes a word backwards. By standard in emacs, it deletes the marked region. That's a bit silly. It is better to do something like this:

;; This is my preference, your mileage may vary.
(global-set-key (kbd "C-x C-k") 'kill-region)
(global-set-key (kbd "C-x k") 'kill-buffer)
(global-set-key (kbd "C-w") 'backward-kill-word)

Issue number 4: Alt-X is a clunky way of running an interactive command. It is better to do something like this instead, avoid your hand cramping up all the time.

(global-set-key (kbd "C-x C-m") 'execute-extended-command)
(global-set-key (kbd "C-x C-m") 'execute-extended-command)

You also may want to check out Steve Yegge's Effective Emacs: https://sites.google.com/site/steveyegge2/effective-emacs It's pretty amazing. One thing to note though is that the caps-lock to ctrl thing is also available through a microsoft tool here: https://learn.microsoft.com/en-us/sysinternals/downloads/ctrl2cap This is better than the manual hack Yegge suggests, and you can turn it off if you don't like it.

Haakon Løtveit
  • 1,009
  • 10
  • 18