Emacs config utilizing prelude as a base
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

302 lines
9.0 KiB

14 years ago
14 years ago
14 years ago
14 years ago
14 years ago
14 years ago
14 years ago
14 years ago
  1. ```
  2. ____ _ _
  3. | _ \ _ __ ___| |_ _ __| | ___
  4. | |_) | '__/ _ \ | | | |/ _` |/ _ \
  5. | __/| | | __/ | |_| | (_| | __/
  6. |_| |_| \___|_|\__,_|\__,_|\___|
  7. ```
  8. # Prelude
  9. Emacs is probably the best text editor in the world. However, the
  10. process of coming up with a useful Emacs configuration is long and
  11. difficult. It's this process that separates you from truly taking
  12. advantage of Emacs's power. I like to refer to this process as the
  13. **Prelude**. The **Emacs Prelude** has the goal to ease the initial
  14. Emacs setup process and to provide you with a much more powerful and
  15. productive experience than that you get out of the box. By using **Emacs
  16. Prelude** you're basically getting a "Get me out of the Prelude, I
  17. just want to use Emacs" card.
  18. Emacs Prelude is compatible **ONLY with GNU Emacs 24.x**.
  19. # Fast Forward
  20. Assuming you're using an Unix-like OS (`*BSD`, `GNU/Linux`, `OS X`, `Solaris`,
  21. etc), you already have Emacs 24 installed, as well as `git` & `curl` you
  22. can skip the whole manual and just type in your favorite shell the
  23. following command:
  24. ```bash
  25. $ curl -L https://github.com/bbatsov/prelude/raw/master/utils/installer.sh | sh
  26. ```
  27. You can now power up your Emacs, sit back and enjoy Prelude,
  28. forgetting about the rest of this manual.
  29. There are two environment variables you can use to control the
  30. source repository and the installation directory. To change the
  31. installation directory:
  32. ```bash
  33. $ PRELUDE_INSTALL_DIR="$HOME/.emacs.d" &&
  34. curl -L
  35. https://github.com/bbatsov/prelude/raw/master/utils/installer.sh
  36. | sh
  37. ```
  38. To change the source repository:
  39. ```bash
  40. $ PRELUDE_URL="https://github.com/yourname/prelude.git" &&
  41. curl -L
  42. https://github.com/bbatsov/prelude/raw/master/utils/installer.sh
  43. | sh
  44. ```
  45. Note that the installer will back up any existing `.emacs` file or
  46. `.emacs.d` since it will unpack Prelude's code in `.emacs.d`. If
  47. you're doing a manual install make sure you don't have a `.emacs` file
  48. or back up your existing `.emacs.d` directory manually.
  49. # More goodies
  50. The [Prelude Modules](https://github.com/bbatsov/prelude-modules)
  51. project contains a lot of additional packages for Prelude
  52. (install-able via the `package-list-packages` command) - enhanced programming
  53. mode configs, latex config, erc config, etc.
  54. # Installing Emacs 24
  55. Obviously to use the Emacs Prelude you have to install Emacs 24
  56. first. Have a look at the [WikEmacs articles on installing Emacs](http://wikemacs.org/wiki/Installing_Emacs).
  57. # Installation
  58. ## Automated
  59. You can install Emacs via the command line with either `curl` or
  60. `wget`. Naturally `git` is also required.
  61. ### Via Curl
  62. If you're using `curl` type the following command:
  63. ```bash
  64. $ curl -L
  65. https://github.com/bbatsov/prelude/raw/master/utils/installer.sh | sh
  66. ```
  67. ### Via Wget
  68. If you're using `wget` type:
  69. ```bash
  70. $ wget --no-check-certificate
  71. https://github.com/bbatsov/prelude/raw/master/utils/installer.sh -O -
  72. | sh
  73. ```
  74. ## Manual
  75. ```bash
  76. $ git clone git://github.com/bbatsov/prelude.git path/to/local/repo
  77. $ ln -s path/to/local/repo ~/.emacs.d
  78. $ cd ~/emacs.d
  79. ```
  80. You'd do well to replace `~/.emacs.d` with the value of
  81. `user-emacs-directory` for your OS. You can check the value by doing
  82. `C-h v user-emacs-directory` inside Emacs.
  83. # Running
  84. Nothing fancy here. Just start Emacs as usual. Personally I run Emacs
  85. in daemon mode:
  86. ```bash
  87. $ emacs --daemon
  88. ```
  89. Afterwards I connect to the server with either a terminal or a GUI
  90. client like this:
  91. ```bash
  92. $ emacsclient -t
  93. $ emacsclient -c
  94. ```
  95. You'd probably do well to put a few aliases in your `.zshrc` (or
  96. `.bashrc`):
  97. ```bash
  98. alias e=emacsclient -t
  99. alias ec=emacsclient -c
  100. alias vim=emacsclient -t
  101. alias vi=emacsclient -t
  102. ```
  103. The last two aliases are helpful if you're used to editing files from
  104. the command line using `vi(m)`.
  105. # Getting to know Prelude
  106. Certainly the best way to understand how Prelude enhances the default
  107. Emacs experience is to peruse Prelude's source code (which is
  108. obviously written in Emacs Lisp). If you're intimidated by the source
  109. - do not despair. Prelude includes a `prelude-mode` minor Emacs mode
  110. which collects some of the additional functionality added by
  111. Prelude. It also adds an additional keymap that binds many of those
  112. extensions to keybindings.
  113. ## Automatic package installation
  114. The default Prelude installation comes with a bare minimum of
  115. functionality. It will however install add-ons for various programming
  116. languages and frameworks on demand. For instance - if you try to open
  117. a `.clj` file `clojure-mode`, `nrepl.el` and prelude's enhanced Lisp
  118. configuration will be installed automatically for you.
  119. You can, of course, install anything you wish manually as well.
  120. ## Color Themes
  121. Emacs 24 ships with a new theming facility that effectively renders
  122. the old color-theme package obsolete. Emacs 24 provides a dozen of
  123. built-in themes you can use out-of-the-box by invoking the `M-x
  124. load-theme` command.
  125. [Zenburn](https://github.com/bbatsov/zenburn-emacs) is the default color theme in Prelude, but you can change it
  126. at your discretion. Why Zenburn? I (and lots of hackers around the
  127. world) find it pretty neat for some reason. Personally I find the
  128. default theme pretty tiresome for the eyes, that's why I took that
  129. "controversial" decision to replace it. You can, of course, easily go
  130. back to the default (or select another theme entirely).
  131. To disable Zenburn just put in your personal config the following
  132. line:
  133. ```lisp
  134. (disable-theme 'zenburn)
  135. ```
  136. Or you can use another theme altogether by adding something like:
  137. ```lisp
  138. (load-theme 'solarized-dark t)
  139. ```
  140. P.S. Solarized is not available by default - you'll have to install it from MELPA first.
  141. ## Personalizing
  142. Fork the official Prelude repo and add your own touch to it. You're advised to avoid changing stuff outside of the
  143. personal folder to avoid having to deal with git merge conflicts in the future.
  144. ## Prelude Modules
  145. Additional settings for various programming languages are available for installation via MELPA. You might take a look at the [Prelude Modules project](https://github.com/bbatsov/prelude-modules) for further info.
  146. # Caveats & Pitfalls
  147. ## Problems with flyspell-mode
  148. Prelude makes heavy use of the flyspell-mode package for spell
  149. checking of various things. The proper operation of flyspell depends
  150. on the presence of the `aspell` program and an `en` dictionary on your
  151. system. You can install `aspell` and the dictionary on OS X with
  152. `homebrew` like this:
  153. ```bash
  154. $ brew install aspell --lang=en
  155. ```
  156. On Linux distros - just use your distro's package manager.
  157. ## Ugly colors in the terminal Emacs version
  158. If your Emacs looks considerably uglier in a terminal (compared to the
  159. GUI version) try adding this to your `.bashrc` or `.zshrc`:
  160. ```bash
  161. $ export TERM=xterm-256color
  162. ```
  163. Source the `.bashrc` file and start Emacs again.
  164. ## MELPA error on initial startup
  165. If you get some http connection error related to the MELPA repo
  166. just do a manual `M-x package-refresh-contents` and restart Emacs
  167. afterwards.
  168. ## No arrow navigation in editor buffers
  169. This is not a bug - it's a feature! I firmly believe that the one true
  170. way to use Emacs is by using it the way it was intended to be used (as
  171. far as navigation is concerned at least). That's why I've disabled all
  172. movement commands with arrows (and keys like page up, page down, etc) - to prevent you from being tempted to
  173. use them.
  174. If you'd still like to use the arrow keys just invoke `M-x
  175. guru-mode` to enable them for the duration of your
  176. current Emacs session or add the following snippet to your
  177. personal Emacs customization to enable them permanently:
  178. ```lisp
  179. (add-hook 'prog-mode-hook 'turn-off-guru-mode t)
  180. ```
  181. ## Disable whitespace-mode
  182. Some people find `whitespace-mode` too intrusive and might want to
  183. disable it. It come be done from your personal config with the
  184. following bit of code:
  185. ```lisp
  186. (add-hook 'prog-mode-hook 'prelude-turn-off-whitespace t)
  187. ```
  188. ## Disable flyspell-mode
  189. If you're not fond of spellchecking on the fly:
  190. ```lisp
  191. (add-hook 'text-mode-hook 'turn-off-flyspell t)
  192. (add-hook 'prog-mode-hook 'turn-off-flyspell t)
  193. ```
  194. ## Windows compatibility
  195. While everything in Prelude should work fine in Windows, I test it only
  196. with Linux & OSX, so there are Windows related problems from time to
  197. time. This situation will probably improve over time.
  198. # Share the knowledge
  199. [WikEmacs](http://wikemacs.org) collects useful resources for working
  200. with GNU Emacs. Please, take the time to peruse and improve them as
  201. you accumulate knowledge about Emacs. Prelude makes this especially
  202. easy, since it bundles
  203. [MediaWiki support](http://wikemacs.org/wiki/Mediawiki.el) + the
  204. settings required to access WikEmacs right away.
  205. # Known issues
  206. Check out the project's
  207. [issue list](https://github.com/bbatsov/prelude/issues?sort=created&direction=desc&state=open)
  208. a list of unresolved issues. By the way - feel free to fix any of them
  209. and send me a pull request. :-)
  210. # Contributors
  211. Here's a [list](https://github.com/bbatsov/prelude/contributors) of all the people who have contributed to the
  212. development of Emacs Prelude.
  213. # Bugs & Improvements
  214. Bug reports and suggestions for improvements are always
  215. welcome. GitHub pull requests are even better! :-)
  216. Cheers,<br/>
  217. Bozhidar