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.

762 lines
28 KiB

12 years ago
12 years ago
13 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
14 years ago
14 years ago
11 years ago
12 years ago
8 years ago
12 years ago
  1. [![License GPL 3][badge-license]](http://www.gnu.org/licenses/gpl-3.0.txt)
  2. [![Liberapay](https://liberapay.com/assets/widgets/donate.svg)](https://liberapay.com/bbatsov/donate)
  3. [![Patreon](https://img.shields.io/badge/patreon-donate-orange.svg)](https://www.patreon.com/bbatsov)
  4. Emacs Prelude
  5. =============
  6. Prelude is an Emacs distribution that aims to enhance the default
  7. Emacs experience. Prelude alters a lot of the default settings,
  8. bundles a plethora of additional packages and adds its own core
  9. library to the mix. The final product offers an easy to use Emacs
  10. configuration for Emacs newcomers and lots of additional power for
  11. Emacs power users.
  12. Prelude is compatible **ONLY with GNU Emacs 25.1+**. In general you're
  13. advised to always run Prelude with the latest Emacs - currently
  14. **26.1**.
  15. You can support the development of Prelude via
  16. [PayPal](https://www.paypal.me/bbatsov),
  17. [Salt](https://bountysource.com/teams/prelude),
  18. [Patreon](https://www.patreon.com/bbatsov) and
  19. [Liberapay](https://liberapay.com/bbatsov/donate).
  20. [![Liberapay](https://liberapay.com/assets/widgets/donate.svg)](https://liberapay.com/bbatsov/donate)
  21. [![Patreon](https://img.shields.io/badge/patreon-donate-orange.svg)](https://www.patreon.com/bbatsov)
  22. **Table of Contents**
  23. - [Fast Forward](#fast-forward)
  24. - [Installing Emacs](#installing-emacs)
  25. - [Installation](#installation)
  26. - [Automated](#automated)
  27. - [Via Curl](#via-curl)
  28. - [Via Wget](#via-wget)
  29. - [Manual](#manual)
  30. - [Updating Prelude](#updating-prelude)
  31. - [Manual update](#manual-update)
  32. - [Update all bundled packages](#update-all-bundled-packages)
  33. - [Update Prelude's code](#update-preludes-code)
  34. - [Restart Prelude](#restart-prelude)
  35. - [Automatic update](#automatic-update)
  36. - [Enabling additional modules](#enabling-additional-modules)
  37. - [Running](#running)
  38. - [Getting to know Prelude](#getting-to-know-prelude)
  39. - [Keymap](#keymap)
  40. - [Global](#global)
  41. - [Prelude Mode](#prelude-mode)
  42. - [macOS modifier keys](#macos-modifier-keys)
  43. - [Projectile](#projectile)
  44. - [Helm](#helm)
  45. - [Key-chords](#key-chords)
  46. - [Disabling key-chords](#disabling-key-chords)
  47. - [Cheatsheet](#cheatsheet)
  48. - [Automatic package installation](#automatic-package-installation)
  49. - [Color Themes](#color-themes)
  50. - [Personalizing](#personalizing)
  51. - [Disabling whitespace-mode](#disabling-whitespace-mode)
  52. - [Disable flyspell-mode](#disable-flyspell-mode)
  53. - [Caveats & Pitfalls](#caveats--pitfalls)
  54. - [Updating bundled packages](#updating-bundled-packages)
  55. - [Problems with flyspell-mode](#problems-with-flyspell-mode)
  56. - [Ugly colors in the terminal Emacs version](#ugly-colors-in-the-terminal-emacs-version)
  57. - [MELPA error on initial startup](#melpa-error-on-initial-startup)
  58. - [Warnings on arrow navigation in editor buffers](#warnings-on-arrow-navigation-in-editor-buffers)
  59. - [Customized C-a behavior](#customized-c-a-behavior)
  60. - [Poor ido matching performance on large datasets](#poor-ido-matching-performance-on-large-datasets)
  61. - [Windows compatibility](#windows-compatibility)
  62. - [Known issues](#known-issues)
  63. - [Support](#support)
  64. - [Contributors](#contributors)
  65. - [Bugs & Improvements](#bugs--improvements)
  66. ## Fast Forward
  67. Assuming you're using an Unix-like OS (`*BSD`, `GNU/Linux`, `macOS`, `Solaris`,
  68. etc), you already have Emacs 24.4+ installed, as well as `git` & `curl` you
  69. can skip the whole manual and just type in your favorite shell the
  70. following command:
  71. ```bash
  72. curl -L https://git.io/epre | sh
  73. ```
  74. You can now power up your Emacs, sit back and enjoy Prelude,
  75. forgetting about the rest of this manual.
  76. There are two environment variables you can use to control the
  77. source repository and the installation directory. To change the
  78. installation directory:
  79. ```bash
  80. export PRELUDE_INSTALL_DIR="$HOME/.emacs.d" && curl -L https://github.com/bbatsov/prelude/raw/master/utils/installer.sh | sh
  81. ```
  82. To change the source repository:
  83. ```bash
  84. export PRELUDE_URL="https://github.com/yourname/prelude.git" && curl -L https://github.com/bbatsov/prelude/raw/master/utils/installer.sh | sh
  85. ```
  86. Note that the installer will back up any existing `.emacs` file or
  87. `.emacs.d` since it will unpack Prelude's code in `.emacs.d`. If
  88. you're doing a manual install make sure you don't have a `.emacs` file
  89. or back up your existing `.emacs.d` directory manually.
  90. Don't forget to adjust your `prelude-modules.el` file in your personal directory
  91. once the installation is done. By default most of the modules
  92. that ship with Prelude are not loaded.
  93. ## Installing Emacs
  94. Obviously to use the Emacs Prelude you have to install Emacs
  95. first. Have a look at
  96. the
  97. [WikEmacs articles on installing Emacs](http://wikemacs.org/index.php/Installing_Emacs).
  98. ## Installation
  99. ### Automated
  100. You can install **Emacs Prelude** via the command line with either `curl` or
  101. `wget`. Naturally `git` is also required.
  102. #### Via Curl
  103. If you're using `curl` type the following command:
  104. ```bash
  105. curl -L https://github.com/bbatsov/prelude/raw/master/utils/installer.sh | sh
  106. ```
  107. #### Via Wget
  108. If you're using `wget` type:
  109. ```bash
  110. wget --no-check-certificate https://github.com/bbatsov/prelude/raw/master/utils/installer.sh -O - | sh
  111. ```
  112. ### Manual
  113. Make sure you do not have any `~/.emacs` file present.
  114. ```bash
  115. git clone git://github.com/bbatsov/prelude.git path/to/local/repo
  116. ln -s path/to/local/repo ~/.emacs.d
  117. cd ~/.emacs.d
  118. ```
  119. If you are using Windows, you should check what Emacs thinks the `~` directory is by running Emacs and typing `C-x d ~/<RET>`, and then adjust the command appropriately.
  120. ## Updating Prelude
  121. ### Manual update
  122. The update procedure is fairly straightforward and consists of 3 steps:
  123. #### Update all bundled packages
  124. Just run <kbd>M-x package-list-packages RET U x</kbd>.
  125. #### Update Prelude's code
  126. ```bash
  127. cd path/to/prelude/installation
  128. git pull
  129. ```
  130. The `path/to/prelude/installation` is usually `~/.emacs.d` (at least
  131. on Unix systems).
  132. #### Restart Prelude
  133. It's generally a good idea to stop Emacs after you do the update. The
  134. next time Prelude starts it will install any new dependencies (if
  135. there are such).
  136. ### Automatic update
  137. Simply run <kbd>M-x prelude-update</kbd> from Emacs itself and restart Emacs afterwards.
  138. ## Pinning packages
  139. By default, Prelude will install packages from the melpa and gnu package
  140. repositories. Occasionally package integration can break when upgrading packages.
  141. This can be avoided by pinning packages to stable versions in other repositories.
  142. To do so, copy `prelude-pinned-packages.el` from the sample directory to
  143. Prelude's root directory and adjust the [variables](https://www.gnu.org/software/emacs/manual/html_node/emacs/Package-Installation.html)
  144. inside accordingly.
  145. ## Enabling additional modules
  146. By default most of the modules that ship with Prelude are not loaded. For more information on the functionality provided by these modules visit the [docs](modules/doc/README.md).
  147. ```lisp
  148. ;;; Uncomment the modules you'd like to use and restart Prelude afterwards
  149. (require 'prelude-c)
  150. ;; (require 'prelude-clojure)
  151. ;; (require 'prelude-coffee)
  152. ;; (require 'prelude-common-lisp)
  153. ;; (require 'prelude-css)
  154. (require 'prelude-emacs-lisp)
  155. (require 'prelude-erc)
  156. ;; (require 'prelude-erlang)
  157. ;; (require 'prelude-elixir)
  158. ;; (require 'prelude-haskell)
  159. (require 'prelude-js)
  160. ;; (require 'prelude-latex)
  161. (require 'prelude-lisp)
  162. (require 'prelude-org)
  163. (require 'prelude-perl)
  164. ;; (require 'prelude-python)
  165. ;; (require 'prelude-ruby)
  166. ;; (require 'prelude-scala)
  167. (require 'prelude-scheme)
  168. ;; (require 'prelude-scss)
  169. ;; (require 'prelude-web)
  170. (require 'prelude-xml)
  171. ```
  172. You'll need to adjust your `prelude-modules.el` file once the
  173. installation is done. If you are doing a manual install then you first
  174. need to copy the `prelude-modules.el` available in the sample
  175. directory to the `personal` directory under `path/to/prelude/installation`
  176. and then adjust that one.
  177. After you've uncommented a module you should either restart Emacs or evaluate the module
  178. `require` expression with <kbd>C-x C-e</kbd>.
  179. ## Running
  180. Nothing fancy here. Just start Emacs as usual. Personally I run Emacs
  181. in daemon mode:
  182. ```bash
  183. emacs --daemon
  184. ```
  185. Afterwards I connect to the server with either a terminal or a GUI
  186. client like this:
  187. ```bash
  188. emacsclient -t
  189. emacsclient -c
  190. ```
  191. You'd probably do well to put a few aliases in your `.zshrc` (or
  192. `.bashrc`):
  193. ```bash
  194. alias e='emacsclient -t'
  195. alias ec='emacsclient -c'
  196. alias vim='emacsclient -t'
  197. alias vi='emacsclient -t'
  198. ```
  199. The last two aliases are helpful if you're used to editing files from
  200. the command line using `vi(m)`.
  201. You can also open a file with the cursor positioned directly on a specific line:
  202. ```bash
  203. emacsclient somefile:1234
  204. ```
  205. This will open file 'somefile' and set cursor on line 1234.
  206. ## Getting to know Prelude
  207. Certainly the best way to understand how Prelude enhances the default
  208. Emacs experience is to peruse Prelude's source code (which is
  209. obviously written in Emacs Lisp). Understanding the code is not
  210. necessary of course. Prelude includes a `prelude-mode` minor Emacs mode
  211. which collects some of the additional functionality added by
  212. Prelude. It also adds an additional keymap that binds many of those
  213. extensions to keybindings.
  214. ### Keymap
  215. #### Global
  216. Keybinding | Description
  217. -------------------|------------------------------------------------------------
  218. <kbd>C-x \\</kbd> | `align-regexp`
  219. <kbd>C-+</kbd> | Increase font size(`text-scale-increase`).
  220. <kbd>C--</kbd> | Decrease font size(`text-scale-decrease`).
  221. <kbd>C-x O</kbd> | Go back to previous window (the inverse of `other-window` (`C-x o`)).
  222. <kbd>C-^</kbd> | Join two lines into one(`crux-top-join-line`).
  223. <kbd>C-x p</kbd> | Start `proced` (manage processes from Emacs; works only in Linux).
  224. <kbd>C-x m</kbd> | Start `eshell`.
  225. <kbd>C-x M-m</kbd> | Start your default shell.
  226. <kbd>C-x C-m</kbd> | Alias for `M-x`.
  227. <kbd>M-X</kbd> | Like `M-x` but limited to commands that are relevant to the active major mode.
  228. <kbd>C-h A</kbd> | Run `apropos` (search in all Emacs symbols).
  229. <kbd>C-h C-m</kbd> | Display key bindings of current major mode and descriptions of every binding.
  230. <kbd>M-/</kbd> | Run `hippie-expand` (a replacement for the default `dabbrev-expand`).
  231. <kbd>C-x C-b</kbd> | Open `ibuffer` (a replacement for the default `buffer-list`).
  232. <kbd>F11</kbd> | Make the window full screen.
  233. <kbd>F12</kbd> | Toggle the Emacs menu bar.
  234. <kbd>C-x g</kbd> | Open Magit's status buffer.
  235. <kbd>C-x M-g</kbd> | Open Magit's popup of popups.
  236. <kbd>M-Z</kbd> | Zap up to char.
  237. <kbd>C-=</kbd> | Run `expand-region` (incremental text selection).
  238. <kbd>C-a</kbd> | Run `crux-move-beginning-of-line`. Read [this](http://emacsredux.com/blog/2013/05/22/smarter-navigation-to-the-beginning-of-a-line/) for details.
  239. #### Prelude Mode
  240. Keybinding | Description
  241. -------------------|------------------------------------------------------------
  242. <kbd>C-c o</kbd> | Open the currently visited file with an external program.
  243. <kbd>C-c i</kbd> | Search for a symbol, only for buffers that contain code
  244. <kbd>C-c g</kbd> | Search in Google for the thing under point (or an interactive query).
  245. <kbd>C-c G</kbd> | Search in GitHub for the thing under point (or an interactive query).
  246. <kbd>C-c y</kbd> | Search in YouTube for the thing under point (or an interactive query).
  247. <kbd>C-c U</kbd> | Search in Duckduckgo for the thing under point (or an interactive query).
  248. <kbd>C-S-RET</kbd> or <kbd>Super-o</kbd> | Insert an empty line above the current line and indent it properly.
  249. <kbd>S-RET</kbd> or <kbd>M-o</kbd> | Insert an empty line and indent it properly (as in most IDEs).
  250. <kbd>C-S-up</kbd> or <kbd>M-S-up</kbd> | Move the current line or region up.
  251. <kbd>C-S-down</kbd> or <kbd>M-S-down</kbd>| Move the current line or region down.
  252. <kbd>C-c n</kbd> | Fix indentation in buffer and strip whitespace.
  253. <kbd>C-c f</kbd> | Open recently visited file.
  254. <kbd>C-M-\\</kbd> | Indent region (if selected) or the entire buffer.
  255. <kbd>C-c u</kbd> | Open a new buffer containing the contents of URL.
  256. <kbd>C-c e</kbd> | Eval a bit of Emacs Lisp code and replace it with its result.
  257. <kbd>C-c s</kbd> | Swap two active windows.
  258. <kbd>C-c D</kbd> | Delete current file and buffer.
  259. <kbd>C-c d</kbd> | Duplicate the current line (or region).
  260. <kbd>C-c M-d</kbd> | Duplicate and comment the current line (or region).
  261. <kbd>C-c r</kbd> | Rename the current buffer and its visiting file if any.
  262. <kbd>C-c t</kbd> | Open a terminal emulator (`ansi-term`).
  263. <kbd>C-c k</kbd> | Kill all open buffers except the one you're currently in.
  264. <kbd>C-c TAB</kbd> | Indent and copy region to clipboard
  265. <kbd>C-c I</kbd> | Open user's init file.
  266. <kbd>C-c S</kbd> | Open shell's init file.
  267. <kbd>C-c . +</kbd> | Increment integer at point. Default is +1.
  268. <kbd>C-c . -</kbd> | Decrement integer at point. Default is -1.
  269. <kbd>C-c . *</kbd> | Multiply integer at point. Default is *2.
  270. <kbd>C-c . /</kbd> | Divide integer at point. Default is /2.
  271. <kbd>C-c . \\</kbd> | Modulo integer at point. Default is modulo 2.
  272. <kbd>C-c . ^</kbd> | Power to the integer at point. Default is ^2.
  273. <kbd>C-c . <</kbd> | Left-shift integer at point. Default is 1 position to the left.
  274. <kbd>C-c . ></kbd> | Right-shift integer at point. Default is 1 position to the right.
  275. <kbd>C-c . #</kbd> | Convert integer at point to specified base. Default is 10.
  276. <kbd>C-c . %</kbd> | Replace integer at point with another specified integer.
  277. <kbd>C-c . '</kbd> | Perform arithmetic operations on integer at point. User specifies the operator.
  278. <kbd>Super-r</kbd> | Recent files
  279. <kbd>Super-j</kbd> | Join lines
  280. <kbd>Super-k</kbd> | Kill whole line
  281. <kbd>Super-m m</kbd> | Magit status
  282. <kbd>Super-m l</kbd> | Magit log
  283. <kbd>Super-m f</kbd> | Magit file log
  284. <kbd>Super-m b</kbd> | Magit blame mode
  285. **Note**: For various arithmetic operations, the prefix `C-c .` only needs to be pressed once for the first operation.
  286. For subsequent operations, only the appropriate operations (i.e. `+`, `-`, `*`, `/`... needs to be pressed).
  287. #### macOS modifier keys
  288. Prelude does not mess by default with the standard mapping of `Command` (to `Super`) and `Option` (to `Meta`).
  289. If you want to swap them add this to your [personal config](#personalizing):
  290. ```lisp
  291. (setq mac-command-modifier 'meta)
  292. (setq mac-option-modifier 'super)
  293. ```
  294. You can also temporarily swap them with `C-c w` (`M-x prelude-swap-meta-and-super`). Note that some emacs distributions (like [emacs-mac](https://bitbucket.org/mituharu/emacs-mac.git) come with `Command` [set](https://bitbucket.org/mituharu/emacs-mac/src/7fdbfba85d543f01b81e997e2b03788c35cb3bfa/src/macterm.c?at=master&fileviewer=file-view-default#macterm.c-6147:6169) to `Meta`.
  295. **Note**: I'd highly recommend to all macOS users to consider
  296. [remapping Return to
  297. Control](http://emacsredux.com/blog/2013/11/12/a-crazy-productivity-boost-remap-return-to-control/)
  298. instead. That's an epic productivity boost and it's not as crazy as it sounds!
  299. #### Projectile
  300. [Projectile](https://github.com/bbatsov/projectile) is one of the essential packages bundled with Prelude.
  301. It provides an easy way to navigate and switch projects. Take a look at its extensive documentation
  302. to get a feel for everything you can do with Projectile.
  303. Prelude adds an extra keymap prefix `s-p` (`s` stands for
  304. `Super`) in addition to the standard one `C-c p`. By default on Windows keyboard
  305. `Super` is mapped to the `Windows` key and on macOS keyboards `Super` is mapped
  306. to the `Command` key.
  307. If you ever forget any of Projectile's keybindings just do a:
  308. <kbd>C-c p C-h</kbd> or <kbd>s-p C-h</kbd>
  309. Alternatively you can just press <kbd>s-p</kbd> and wait for a moment
  310. for `which-key` to kick in and show you the available keybindings.
  311. #### Helm
  312. Helm is setup according to this guide: [A Package in a league of its own: Helm](http://tuhdo.github.io/helm-intro.html).
  313. You can learn Helm usage and key bindings following the guide. <kbd>C-c h</kbd> is Prelude's default prefix key for Helm.
  314. If you don't remember any key binding, append <kbd>C-h</kbd> after <kbd>C-c h</kbd> for a list of key bindings in Helm.
  315. If you love Helm and want to use Helm globally with enhanced `helm-find-files`, `helm-buffer-lists`..., you will have to also add `(require 'prelude-helm-everywhere)`.
  316. When `prelude-helm-everywhere` is activated, Helm enables these global key bindings:
  317. Key binding | Description
  318. -------------------|----------------------------------------------
  319. <kbd>M-x</kbd> | Run [helm-M-x](http://tuhdo.github.io/helm-intro.html#sec-3), an interactive version of <kbd>M-x</kdb>.
  320. <kbd>M-y</kbd> | Run [helm-show-kill-ring](http://tuhdo.github.io/helm-intro.html#sec-4), shows the content of `kill-ring`.
  321. <kbd>C-x b </kbd> | Run [helm-mini](http://tuhdo.github.io/helm-intro.html#sec-5), an interactive version of `C-x b` with more features.
  322. <kbd>C-x C-f</kbd> | Run [helm-find-files](http://tuhdo.github.io/helm-intro.html#sec-6), an interactive version of `find-file` with more features.
  323. <kbd>C-h f </kbd> | Run [helm-apropos](http://tuhdo.github.io/helm-intro.html#sec-13), an interactive version of `apropos-command`.
  324. <kbd>C-h r</kbd> | Run [helm-info-emacs](http://tuhdo.github.io/helm-intro.html#sec-14), an interactive version of `info-emacs-manual`.
  325. <kbd>C-h C-l </kbd>| Run `helm-locate-library` that can search for locations of any file loaded into Emacs.
  326. This key binding is activated in `shell-mode`:
  327. Key Binding | Description
  328. -------------------|----------------------------------------------
  329. <kbd>C-c C-l</kbd> | Run `helm-comint-input-ring` that shows `shell` history using Helm interface.
  330. This key bindings is activated in `eshell-mode`:
  331. Key Binding | Description
  332. -------------------|----------------------------------------------
  333. <kbd>C-c C-l</kbd> | Run `helm-eshell-history` that shows `eshell` history using Helm interface.
  334. If you prefer Ido in everywhere, you should not add `prelude-helm-everywhere`, so you can use Helm along with Ido and Prelude's default commands.
  335. You can always reactivate Helm with `(prelude-global-helm-global-mode-on)`.
  336. **NOTICE**: In `helm-M-x`, you have to pass prefix argument *AFTER* you run `helm-M-x`,
  337. because your prefix argument will be displayed in the modeline when in `helm-M-x`
  338. buffer. Passing prefix argument **BEFORE** =helm-M-x= **has no effect**.
  339. #### Key-chords
  340. **Key-chords are available only when the `prelude-key-chord` module has been enabled.**
  341. Keybinding | Description
  342. -------------------|----------------------------------------------
  343. <kbd>jj</kbd> | Jump to the beginning of a word(`avy-goto-word-1`)
  344. <kbd>jk</kbd> | Jump to a character(`avy-goto-char`)
  345. <kbd>jl</kbd> | Jump to the beginning of a line(`avy-goto-line`)
  346. <kbd>JJ</kbd> | Jump back to previous buffer(`crux-switch-to-previous-buffer`)
  347. <kbd>uu</kbd> | View edits as a tree(`undo-tree-visualize`)
  348. <kbd>xx</kbd> | Executed extended command(`execute-extended-command`)
  349. <kbd>yy</kbd> | Browse the kill ring(`browse-kill-ring`)
  350. ##### Disabling key-chords
  351. In some cases you may not want to have a key-chord that is defined by prelude,
  352. in which case you can disable the binding in your `personal.el` file by setting
  353. its command to `nil`. For example, to disable the `jj` key-chord add the
  354. following line:
  355. ```lisp
  356. (key-chord-define-global "jj" nil)
  357. ```
  358. If you're an `evil-mode` user you'll probably do well to disable `key-chord-mode` altogether:
  359. ```lisp
  360. (key-chord-mode -1)
  361. ```
  362. #### vim emulation
  363. If you want to use vim keybindings inside of Emacs enable the `prelude-evil` module which provides
  364. support for `evil-mode`.
  365. ### Cheatsheet
  366. Use `C-h k <key>` (`<key>` are the ones listed on the left) or `C-h f <function>` (`<function>` are the ones listed on the right) to see the detailed explanation.
  367. ![cheatsheet](/modules/doc/cheatsheet.png)
  368. #### PDF generation
  369. Install [LaTeX](https://www.latex-project.org/get/)
  370. ``` bash
  371. cd modules/doc
  372. pdflatex prelude-cheatsheet.tex
  373. ```
  374. #### PNG generation
  375. Install [Poppler](https://poppler.freedesktop.org/)
  376. ``` bash
  377. cd modules/doc
  378. pdftocairo -png -singlefile prelude-cheatsheet.pdf cheatsheet
  379. ```
  380. ## Automatic package installation
  381. The default Prelude installation comes with a bare minimum of
  382. functionality. It will however install add-ons for various programming
  383. languages and frameworks on demand. For instance - if you try to open
  384. a `.clj` file `clojure-mode`, `cider` and Prelude's enhanced Lisp
  385. configuration will be installed automatically for you.
  386. You can, of course, install anything you wish manually as well.
  387. ### Color Themes
  388. Emacs provides a dozen of
  389. built-in themes you can use out-of-the-box by invoking the `M-x
  390. load-theme` command.
  391. [Zenburn](https://github.com/bbatsov/zenburn-emacs) is the default
  392. color theme in Prelude, but you can change it at your discretion. Why
  393. Zenburn? I (and lots of hackers around the world) find it pretty neat
  394. for some reason. Personally I find the default theme pretty tiresome
  395. for the eyes, that's why I took that "controversial" decision to
  396. replace it. You can, of course, easily go back to the default (or
  397. select another theme entirely).
  398. To disable Zenburn just put in your [personal config](#personalizing)
  399. the following line:
  400. ```lisp
  401. (disable-theme 'zenburn)
  402. ```
  403. Or you can use another theme altogether by adding something in `personal/preload` like:
  404. ```lisp
  405. (setq prelude-theme 'tango)
  406. ```
  407. **Note** To use a non-built-in theme, like [Solarized](https://github.com/bbatsov/solarized-emacs),
  408. you'll have to install it from MELPA first by `M-x package-install RET solarized-theme`. Then add
  409. ``` lisp
  410. (setq prelude-theme 'solarized-dark)
  411. ```
  412. in `personal/preload`.
  413. Finally, if you don't want any theme at all, you can add this to your
  414. `personal/preload`:
  415. ```lisp
  416. (setq prelude-theme nil)
  417. ```
  418. ### Personalizing
  419. All files you create under the `personal/` directory are yours for
  420. personalization. There is no single special personal config file --
  421. any files you create in the `personal/` directory will be loaded in
  422. lexicographical order. The overall loading precedence is:
  423. 1. `personal/preload/*`
  424. 2. `core/`
  425. 3. `personal/prelude-modules.el` (or deprecated `prelude-modules.el`)
  426. 4. `personal/*`
  427. #### Personalization Example
  428. Suppose you want to configure go-mode to autoformat on each save. You
  429. can create a file in `personal/`, let's call this one
  430. `config-go-mode.el` and add the following to it.
  431. ``` emacs-lisp
  432. (add-hook 'go-mode-hook
  433. (lambda ()
  434. (add-hook 'before-save-hook 'gofmt-before-save)
  435. (setq tab-width 2)))
  436. ```
  437. #### Tips
  438. **Fork** (instead of cloning) the official Prelude repo and add your
  439. own touch to it. You're advised to **avoid changing stuff outside of
  440. the personal folder** to avoid having to deal with git merge conflicts
  441. in the future.
  442. If you'd like to add some auto installation of packages in your
  443. personal config use the following code:
  444. ```lisp
  445. (prelude-require-packages '(some-package some-other-package))
  446. ```
  447. If you require just a single package you can also use:
  448. ```lisp
  449. (prelude-require-package 'some-package)
  450. ```
  451. #### Preloading personal config
  452. Sometimes you might want to load code before Prelude has started loading. Prelude will automatically preload all
  453. Emacs Lisp files in your `personal/preload` directory. Note that at this point you can't using anything from
  454. Prelude, except a few variables like `prelude-dir`, etc (since nothing is yet loaded).
  455. #### Disabling whitespace-mode
  456. Although `whitespace-mode` is awesome, some people might find it too
  457. intrusive. You can disable it in your
  458. personal config with the following bit of code:
  459. ```lisp
  460. (setq prelude-whitespace nil)
  461. ```
  462. If you like `whitespace-mode`, but prefer it to not automatically
  463. cleanup your file on save, you can disable that behavior by setting
  464. `prelude-clean-whitespace-on-save` to `nil` in your config file with:
  465. ```lisp
  466. (setq prelude-clean-whitespace-on-save nil)
  467. ```
  468. The `prelude-clean-whitespace-on-save` setting can also be set on a
  469. per-file or directory basis by using a file variable or a
  470. `.dir-locals.el` file.
  471. #### Disable flyspell-mode
  472. If you're not fond of spellchecking on the fly:
  473. ```lisp
  474. (setq prelude-flyspell nil)
  475. ```
  476. ## Caveats & Pitfalls
  477. ### Updating bundled packages
  478. Generally it's a good idea to do a package update before running
  479. updating Prelude, since the latest Prelude code might depend on newer
  480. versions of the bundled packages than you would currently have
  481. installed.
  482. If you're doing manual Prelude updates you should always do a package update first.
  483. `M-x package-list-packages RET U x`
  484. That's not necessary if you're using `M-x prelude-update`, since it
  485. will automatically update the installed packages.
  486. ### Problems with flyspell-mode
  487. Prelude makes heavy use of the flyspell-mode package for spell
  488. checking of various things. The proper operation of flyspell depends
  489. on the presence of the `aspell` program and an `en` dictionary on your
  490. system. You can install `aspell` and the dictionary on macOS with
  491. `homebrew` like this:
  492. ```bash
  493. brew install aspell --with-lang=en
  494. ```
  495. On Linux distros - just use your distro's package manager.
  496. ### Ugly colors in the terminal Emacs version
  497. If your Emacs looks considerably uglier in a terminal (compared to the
  498. GUI version) try adding this to your `.bashrc` or `.zshrc`:
  499. ```bash
  500. export TERM=xterm-256color
  501. ```
  502. Source the `.bashrc` file and start Emacs again.
  503. ### MELPA error on initial startup
  504. If you get some http connection error related to the MELPA repo
  505. just do a manual `M-x package-refresh-contents` and restart Emacs
  506. afterwards.
  507. ### Warnings on arrow navigation in editor buffers
  508. This is not a bug - it's a feature! I firmly believe that the one true
  509. way to use Emacs is by using it the way it was intended to be used (as
  510. far as navigation is concerned at least).
  511. If you'd like to be take this a step further and disable the arrow key navigation
  512. completely put this in your [personal config](#personalizing):
  513. ```lisp
  514. (setq guru-warn-only nil)
  515. ```
  516. To disable `guru-mode` completely add the following snippet to your
  517. [personal config](#personalizing):
  518. ```lisp
  519. (setq prelude-guru nil)
  520. ```
  521. ### Customized C-a behavior
  522. Prelude overrides `C-a` to behave as described
  523. [here](http://emacsredux.com/blog/2013/05/22/smarter-navigation-to-the-beginning-of-a-line/). If
  524. you don't like that simply add this to your [personal config](#personalizing):
  525. ```lisp
  526. (global-set-key [remap move-beginning-of-line]
  527. 'move-beginning-of-line)
  528. ```
  529. ### Poor ido matching performance on large datasets
  530. Prelude's `ido` module swaps the default `ido` flex matching with the
  531. more powerful [ido-flx](https://github.com/lewang/flx).
  532. The sorting algorithm `flx` uses is more complex, but yields better results.
  533. On slower machines, it may be necessary to lower `flx-ido-threshold` to
  534. ensure a smooth experience.
  535. ```lisp
  536. (setq flx-ido-threshold 1000)
  537. ```
  538. You can always disable the improved sorting algorithm all together like this:
  539. ```lisp
  540. (flx-ido-mode -1)
  541. ```
  542. ### Windows compatibility
  543. While everything in Prelude should work fine in Windows, I test it only
  544. with GNU/Linux & macOS, so there might be Windows-specific problems from time to
  545. time. This situation will probably improve over time.
  546. ## Known issues
  547. Check out the project's
  548. [issue list](https://github.com/bbatsov/prelude/issues?sort=created&direction=desc&state=open)
  549. a list of unresolved issues. By the way - feel free to fix any of them
  550. and send me a pull request. :-)
  551. ## Support
  552. Support is available via several channels:
  553. * Prelude's Google Group <emacs-prelude@googlegroups.com>
  554. * Prelude's Freenode channel (`#prelude-emacs`)
  555. * [Gitter](https://gitter.im/bbatsov/prelude)
  556. ## Contributors
  557. Here's a [list](https://github.com/bbatsov/prelude/contributors) of all the people who have contributed to the
  558. development of Emacs Prelude.
  559. ## Bugs & Improvements
  560. Bug reports and suggestions for improvements are always
  561. welcome. GitHub pull requests are even better! :-)
  562. Cheers,<br/>
  563. [Bozhidar](https://twitter.com/bbatsov)
  564. [badge-license]: https://img.shields.io/badge/license-GPL_3-green.svg