[DOCS] Fix problem with Edit in github link

The link is created with docs in it, even if the mkdocs.yml file
mentions doc as the documentation folder. I am not aware if there is
any other dependency in the name doc, I have renamed it to docs and
changed it also in the mkdocs.yml file. It seems docs is hardcoded in
the readthedocs theme :(
This commit is contained in:
Kostas Tsiligkiris 2022-02-20 11:44:08 +02:00 committed by Bozhidar Batsov
parent 3f5e83d0e9
commit 9ed0d772da
26 changed files with 1 additions and 1 deletions

BIN
docs/cheatsheet.png Normal file

Binary file not shown.

After

(image error) Size: 476 KiB

182
docs/configuration.md Normal file
View file

@ -0,0 +1,182 @@
# Configuration
## User Interface
Historically Prelude had adopted a very minimalistic approach to UI and
had hidden by default Emacs's menu bar and tool bar. This was changed a bit
in Prelude 1.1 for the sake of being more approachable to newcomers to Emacs
and now the menu bar is displayed by default. The tool bar is still hidden, as
it's quite big and not that useful.
!!! Tip
You can toggle the menu bar by pressing `F12`.
Furthermore, Prelude 1.1 displays line numbers (via `global-nlinum-mode`), just
like most "modern" editors and IDEs do these days. You can go back to the way
things were by setting `prelude-minimalistic-ui` to `t` in `personal/preload` or
by adding the following snippets to your personal config:
``` emacs-lisp
(global-nlinum-mode -1)
(menu-bar-mode -1)
```
!!! Note
The first approach is better as it would prevent those UI elements from
appearing temporarily.
## Color Themes
Emacs provides a dozen of
built-in themes you can use out-of-the-box by invoking the `M-x
load-theme` command.
[Zenburn](https://github.com/bbatsov/zenburn-emacs) is the default
color theme in Prelude, but you can change it at your discretion. Why
Zenburn? I (and lots of hackers around the world) find it pretty neat
for some reason. Personally I find the default theme pretty tiresome
for the eyes, that's why I took that "controversial" decision to
replace it. You can, of course, easily go back to the default (or
select another theme entirely).
To disable Zenburn just put in your personal config the following
line:
```emacs-lisp
(disable-theme 'zenburn)
```
Or you can use another theme altogether by adding something in `personal/preload` like:
```emacs-lisp
(setq prelude-theme 'tango)
```
!!! Note
To use a non-built-in theme, like [Solarized](https://github.com/bbatsov/solarized-emacs),
you'll have to install it from MELPA first by `M-x package-install RET solarized-theme`. Then add
```emacs-lisp
(setq prelude-theme 'solarized-dark)
```
in `personal/preload`.
Finally, if you don't want any theme at all, you can add this to your
`personal/preload`:
```emacs-lisp
(setq prelude-theme nil)
```
## Personalizing
All files you create under the `personal/` directory are yours for
personalization. There is no single special personal config file --
any files you create in the `personal/` directory will be loaded in
lexicographical order. The overall loading precedence is:
1. `personal/preload/*`
2. `core/`
3. `personal/prelude-modules.el` (or deprecated `prelude-modules.el`)
4. `personal/*`
### Personalization Example
Suppose you want to configure `go-mode` to autoformat on each save. You
can create a file in `personal/`, let's call this one
`config-go-mode.el` and add the following to it.
```emacs-lisp
(add-hook 'go-mode-hook
(lambda ()
(add-hook 'before-save-hook 'gofmt-before-save)
(setq tab-width 2)))
```
### General Tips
**Fork** (instead of cloning) the official Prelude repo and add your
own touch to it. You're advised to **avoid changing stuff outside of
the personal folder** to avoid having to deal with git merge conflicts
in the future.
If you'd like to add some auto installation of packages in your
personal config use the following code:
```emacs-lisp
(prelude-require-packages '(some-package some-other-package))
```
If you require just a single package you can also use:
```emacs-lisp
(prelude-require-package 'some-package)
```
### Preloading personal config
Sometimes you might want to load code before Prelude has started loading. Prelude will automatically preload all
Emacs Lisp files in your `personal/preload` directory. Note that at this point you can't using anything from
Prelude, except a few variables like `prelude-dir`, etc (since nothing is yet loaded).
### Disabling whitespace-mode
Although `whitespace-mode` is awesome, some people might find it too
intrusive. You can disable it in your
personal config with the following bit of code:
```emacs-lisp
(setq prelude-whitespace nil)
```
If you like `whitespace-mode`, but prefer it to not automatically
cleanup your file on save, you can disable that behavior by setting
`prelude-clean-whitespace-on-save` to `nil` in your config file with:
```emacs-lisp
(setq prelude-clean-whitespace-on-save nil)
```
### Disable flyspell-mode
If you're not fond of spellchecking on the fly:
```emacs-lisp
(setq prelude-flyspell nil)
```
### Disable automatic formatting on save
If you prefer not to automatically format your file on save, you can disable that behavior by setting
`prelude-format-on-save` to `nil` in your config file with:
```emacs-lisp
(setq prelude-format-on-save nil)
```
Currently this only affects automated formatting of Typescript files.
### Disable Super-based keybindings
Out-of-the-box Prelude will create two versions of many keybindings in `prelude-mode`:
* One "traditional" version with a prefix like `Control`
* One "alternative" version with a prefix like `Super`
The reason for this is that there are generally more options for short keybindings with `Super` - e.g. you can
have `s-p`, `s-g`, etc. There's, however, a problem lying here as well - some operating systems and
desktop environments might be making heavy use of such keybindings. (in most cases those would intercept them before Emacs does).
`exwm` also uses those heavily. You prevent Prelude from creating such keybindings via `prelude-super-keybindings`:
```emacs-lisp
(setq prelude-super-keybindings nil)
```
### Configuration per file or directory
Some of these settings (those that don't need to be pre-loaded) can also be set
on a per-file or directory basis by using a file local variable or a
`.dir-locals.el` file.

54
docs/contributing.md Normal file
View file

@ -0,0 +1,54 @@
# Contributing
## Issues
Report issues and suggest features and improvements on the
[GitHub issue tracker](https://github.com/bbatsov/prelude/issues). Don't ask
questions on the issue tracker - use the [support channels](support.md) instead.
If you want to file a bug, please provide all the necessary info listed in
our issue reporting template (it's loaded automatically when you create a
new GitHub issue).
## Patches
Patches in any form are always welcome! GitHub pull requests are even better! :-)
Before submitting a patch or a pull request make sure that your patch
is in line with the [contribution
guidelines](https://github.com/bbatsov/prelude/blob/master/CONTRIBUTING.md).
## Documentation
Good documentation is just as important as good code.
Please, consider improving and extending this manual.
### Working on the Manual
The manual is generated from the markdown files in the
[doc](https://github.com/bbatsov/prelude/tree/master/doc) folder of Prelude's
GitHub repo and is published to [Read the Docs](readthedocs.org). The
[MkDocs](http://www.mkdocs.org/) tool is used to convert the markdown sources to
HTML.
To make changes to the manual you simply have to change the files under
`doc`. The manual will be regenerated automatically when changes to those files
are merged in `master` (or the latest stable branch).
You can install `MkDocs` locally and use the command `mkdocs serve` to see the
result of changes you make to the manual locally:
```sh
$ cd path/to/prelude/repo
$ mkdocs serve
```
If you want to make changes to the manual's page structure you'll have to edit
[mkdocs.yml](https://github.com/bbatsov/prelude/blob/master/mkdocs.yml).
## Donations
You can support the development of Prelude via
[GitHub Sponsors](https://github.com/sponsors/bbatsov),
[PayPal](https://www.paypal.me/bbatsov) and
[Patreon](https://www.patreon.com/bbatsov).

15
docs/css/extra.css Normal file
View file

@ -0,0 +1,15 @@
/* By default kbd doesn't stand out very much. Let's fix this! */
kbd {
padding: 3px 5px;
border: solid 1px #ccc;
background-color: #fcfcfc;
border-radius: 3px;
box-shadow: inset 0 -1px 0 #bbb;
display: inline-block;
}
/* The default font-size for code blocks is 75% which makes code
hard to read. */
code {
font-size: 90%;
}

31
docs/faq.md Normal file
View file

@ -0,0 +1,31 @@
# Frequently Asked Questions
## What's the origin of the name Emacs Prelude?
I wanted an Emacs experience that was both as sleek and as powerful
as the legendary sports car [Honda Prelude](https://en.wikipedia.org/wiki/Honda_Prelude).
I also wanted a name with `el` in it. :-)
## Why doesn't Prelude use `use-package`?
While `use-package` provides a nice way of structuring your
configuration (especially if you're into single-file setups), it also adds a layer of complexity as it's just a macro
that expands to some "traditional" configuration code. One aspect of `use-package` that's a bit tricky is where to place cross-package configuration, as it can potentially go to different configuration blocks.
Given how modular the structure of Prelude is, there's relatively little to be gained by adopting `use-package` everywhere, but end users are free to use `use-package` for their personal configuration.
!!! Note
I have a stripped-down version of Prelude for personal use, based on `use-package` [here](https://github.com/bbatsov/emacs.d).
I guess it might be of interest to some of you.
## Why does Prelude use MELPA instead of MELPA Stable by default?
Mostly because many package authors/maintainers don't have the habit to cut
"stable" releases of their projects. It seems that's changing for the better
in recent years, so Prelude's defaults might change down the road.
## Why is Zenburn the default color theme?
No particular reason other than the fact that I like it a lot and happen to maintain
its Emacs port. I believe it's pretty nice improvement over the default Emacs theme, but your perspective might be different.

152
docs/index.md Normal file
View file

@ -0,0 +1,152 @@
# Emacs Prelude
Prelude is an Emacs distribution that aims to enhance the default
Emacs experience. Prelude alters a lot of the default settings,
bundles a plethora of additional packages and adds its own core
library to the mix. The final product offers an easy to use Emacs
configuration for Emacs newcomers and lots of additional power for
Emacs power users.
!!! Important
Prelude is compatible **ONLY with GNU Emacs 25.1+**. In general you're
advised to always run Prelude with the latest stable Emacs release.
You can support the development of Prelude via
[GitHub Sponsors](https://github.com/sponsors/bbatsov),
[ko-fi](https://www.ko-fi.com/bbatsov),
[PayPal](https://www.paypal.me/bbatsov) and
[Patreon](https://www.patreon.com/bbatsov).
## Features
* Improved UX, that's still in line with Emacs traditions
* Sane defaults of baseline Emacs functionality
* Automatic installation of many major programming modes on demand
* A curated set of 3rd party packages to enhance the base functionality
* Simple modular architecture
* Easy customization
## Package Highlights
Here are some of the essential 3rd party packages that Prelude adds to Emacs:
* [ace-window](https://github.com/abo-abo/ace-window)
(effective navigation between multiple windows)
* [avy](https://github.com/abo-abo/avy)
(effective navigation)
* [crux](https://github.com/bbatsov/crux)
(lots of useful editing commands)
* [diff-hl](https://github.com/dgutov/diff-hl)
(shows colorful diff markers in the gutter when you're editing files
under version control)
* [easy-kill](https://github.com/leoliu/easy-kill)
* [editorconfig-mode](https://github.com/editorconfig/editorconfig-emacs)
(teaches Emacs to respect [.editorconfig](https://editorconfig.org/))
* [expand-region](https://github.com/magnars/expand-region.el)
* [flycheck](https://www.flycheck.org/)
(modern integration with many lint tools)
* [guru-mode](https://github.com/bbatsov/guru-mode)
(an Emacs guru that helps you learn basic Emacs keybindings)
* [projectile](https://github.com/bbatsov/projectile)
(powerful project navigation/interaction package)
* [magit](https://magit.vc/)
(the best git client in the known universe)
* [git-timemachine](https://gitlab.com/pidu/git-timemachine)
(navigate quickly through different versions of one file)
* `nlinum`
(line numbers in your buffers)
* [smartparens](https://github.com/Fuco1/smartparens)
(powerful package for dealing with expressions and matched
delimiters in programming languages)
* [super-save](https://github.com/bbatsov/super-save)
(auto-save buffers when moving around)
* [which-key](https://github.com/justbur/emacs-which-key)
(shows you possible keybindings when you type a partial keybinding)
* [zenburn-theme](https://github.com/bbatsov/zenburn-emacs)
(Prelude's default color theme)
* [undo-tree](https://elpa.gnu.org/packages/undo-tree.html)
(A powerful way to navigate your editing history)
On top of this Prelude bundles a bunch of smaller packages and makes
many more packages available via optional modules.
## Programming Languages Support
The following programming languages have enhanced support in Prelude:
- C/C++
- [Clojure](modules/clojure.md)
- CoffeeScript
- [Common Lisp](modules/common_lisp.md)
- CSS
- [Dart](modules/dart.md)
- [Emacs Lisp](modules/emacs_lisp.md)
- Erlang
- Elixir
- [F#](modules/fsharp.md)
- Go
- Haskell
- JavaScript
- LaTeX
- [Lisp Base](modules/lisp.md) (common foundation for Lisp modules)
- Lua
- Markdown
- OCaml
- Org Mode
- Perl
- [Python](modules/python.md)
- Racket
- [Ruby](modules/ruby.md)
- Rust
- Scala
- [Scheme](modules/scheme.md)
- SCSS
- TypeScript
- HTML (via `web-mode`)
- XML
- YAML
On top of this - basic support for many other programming languages
will be auto-installed when needed (e.g. the first time you open a
source file for some language).
## Philosophy
Prelude's philosophy is quite simple:
* simple
* easy to understand and extend
* stable
* a foundation for you to build upon, as opposed to some end-user product
This means that it intentionally doesn't pack all the bells and
whistles that it could. Prelude aims to enhance the classic Emacs
experience without deviating a lot from it - e.g. it would never
enable something like `evil-mode` (vim keybindings) by default and so
on.
All the third-party packages that it bundles are carefully vetted and
are known to be of good quality and to have reliable maintainers. That
generally means that Prelude's unlikely to immediately adopt some
shiny new package, that has established tried and true alternatives.
In practice this translates to the following:
* Prelude is less opinionated than distros like Spacemacs and Doom
Emacs (meaning it's closer to the standard Emacs experience)
* Prelude installs relatively few additional packages by default
* Most modules in Prelude are opt-in instead of opt-out (you'll notice
the default config enables only a handful of modules)
* Most modules (for example, modules for programming languages) are
pretty short and feature setup only for essential packages (in some
cases that would be just the major mode for the language in
question)
* You don't really need to track Prelude's upstream - you're
encouraged to just fork it and use it as the basis for your own
configuration.
Remember that the ultimate goal of every Emacs user is to create an
Emacs setup that reflects their own experience, needs, goals and
ideas. Just like Lisp, Emacs is nothing but a raw building material
for the perfect editing experience.

184
docs/installation.md Normal file
View file

@ -0,0 +1,184 @@
# Installation
## Prerequisites
Obviously to use the Emacs Prelude you have to install Emacs
first. We'll assume you can manage this part on your own.
Aim for the newest stable Emacs release, although as a rule of
thumb Prelude aims to support the last 2-3 stable releases.
For spell-checking to work you should install `aspell`, together with its
dictionaries for the languages you wish to check.
You'll also do well to install some of the following:
* `git` (needed by Magit)
* `ag` (`the_silver_searcher`) or `ripgrep` (Projectile has nice integration with them and they are much faster than `grep`)
* your favorite lint tools (for Flycheck)
All those tools are completely optional, though.
!!! Note
Additional external tools might be needed by some of the modules (e.g. tools specific to particular programming languages, etc).
## Installation
### Automated
You can install Emacs Prelude via the command line with either `curl` or
`wget`. Naturally `git` is also required.
The installer script will do the following:
* Clone Prelude's GitHub repo
* Check your Emacs version
* Backup any existing `.emacs` or `.emacs.d` you might have
* Create any additional folders if necessary (e.g. for storing package-specific data)
If you have a `.emacs` file it will backed up as `.emacs.pre-prelude` and if you have
a `.emacs.d` folder, it will be backed up as `.emacs.d.pre-prelude.tar`.
#### Via Curl
If you're using `curl` type the following command:
```shellsession
$ curl -L https://github.com/bbatsov/prelude/raw/master/utils/installer.sh | sh
```
#### Via Wget
If you're using `wget` type:
```shellsession
$ wget --no-check-certificate https://github.com/bbatsov/prelude/raw/master/utils/installer.sh -O - | sh
```
### Manual
Make sure you do not have any `~/.emacs` file or `~/.emacs.d` folder present.
```shellsession
$ git clone git://github.com/bbatsov/prelude.git path/to/local/repo
$ ln -s path/to/local/repo ~/.emacs.d
$ cd ~/.emacs.d
```
!!! Note
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.
### System-wide (site-wide)
For a multi-user environment, as an admin, the customizations intended
for all users go in the site-start file represented by the variable
`site-run-file`, while single users will use their own init file
represented by the variable `user-init-file`.
If you have placed your Prelude directory in `/opt/prelude` then,
append the following line to the `site-start.el`:
``` emacs-lisp
(load "/opt/prelude/init.el")
```
If you are using Emacs as a daemon process, with other users or daemon
processes interacting with the Emacs daemon (e.g. Emacs is your window
manager) then the `site-lisp` directory could be the right place to
place your configuration files.
## Pinning packages
By default, Prelude will install packages from the MELPA and GNU ELPA package
repositories. Occasionally package integration can break when upgrading packages,
as the packages in the MELPA repository are all snapshot builds.
This can be avoided by pinning packages to stable versions in other repositories (e.g. MELPA Stable).
To do so, copy `prelude-pinned-packages.el` from the sample directory to
Prelude's root directory and adjust the [variables](https://www.gnu.org/software/emacs/manual/html_node/emacs/Package-Installation.html)
inside accordingly.
## Enabling additional modules
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/index.md).
```lisp
;;; Uncomment the modules you'd like to use and restart Prelude afterwards
(require 'prelude-c)
;; (require 'prelude-clojure)
;; (require 'prelude-coffee)
;; (require 'prelude-common-lisp)
;; (require 'prelude-css)
(require 'prelude-emacs-lisp)
(require 'prelude-erc)
;; (require 'prelude-erlang)
;; (require 'prelude-elixir)
;; (require 'prelude-haskell)
(require 'prelude-js)
;; (require 'prelude-latex)
(require 'prelude-lisp)
(require 'prelude-org)
(require 'prelude-perl)
;; (require 'prelude-python)
;; (require 'prelude-ruby)
;; (require 'prelude-scala)
(require 'prelude-scheme)
;; (require 'prelude-scss)
;; (require 'prelude-web)
(require 'prelude-xml)
```
You'll need to adjust your `prelude-modules.el` file once the installation is done.
In case of an automated installation, you'll find this file in the `personal` directory of your Emacs installation.
If you are doing a manual install then you first
need to copy the `prelude-modules.el` available in the sample
directory to the root of `path/to/prelude/installation` and then
adjust that one.
After you've uncommented a module you should either restart Emacs or evaluate the module
`require` expression with <kbd>C-x C-e</kbd>.
## Updating Prelude
### Automatic update
Simply run <kbd>M-x prelude-update</kbd> from Emacs itself and restart Emacs afterwards.
### Manual update
The update procedure is fairly straightforward and consists of 3 steps:
#### Update all bundled packages
Just run <kbd>M-x package-list-packages RET U x</kbd>.
!!! Note
Technically speaking, this will update all the packages you've installed,
not just those that were bundled with Prelude. That's fine most of the time.
#### Update Prelude's code
```shellsession
$ cd path/to/prelude/installation
$ git pull
```
The `path/to/prelude/installation` is usually `~/.emacs.d` (at least
on Unix systems).
#### Restart Prelude
It's generally a good idea to stop Emacs after you do the update. The
next time Prelude starts it will install any new dependencies (if
there are such).
## Uninstalling Prelude
Provided you've installed Prelude in `.emacs.d`, all you need to do is delete that folder.
If you opted for the manual installation and making `.emacs.d` a symlink - you remove/update
the link. Yeah, it's as simple as that. No fancy uninstaller required!

28
docs/modules/clojure.md Normal file
View file

@ -0,0 +1,28 @@
# Prelude Clojure
!!! Note
This module builds on top of the shared [Lisp Base](lisp.md) module.
## Clojure Mode
This module bundles `clojure-mode`, a major mode for programming in Clojure,
and some sensible defaults for it.
## CIDER
This module also bundles [CIDER](https://docs.cider.mx), a popular interactive
programming environment for Clojure.
Intentionally, Prelude doesn't install by default popular CIDER plugins like
`clj-refactor`, `sayid`, etc, as those can be overwhelming to newcomers and
are easy to setup if you need them.
## CIDER Alternatives
Depending on your preferences you might want to use `inf-clojure` or `clojure-lsp`
alongside/instead of CIDER, but you'll have to set them up yourselves.
## Fun trivia
I'm the author of CIDER and `inf-clojure` and the primary maintainer of `clojure-mode`. I'm also a co-maintainer of `clj-refactor`. I guess I love Clojure! :-)

View file

@ -0,0 +1,33 @@
# Prelude Common Lisp
!!! Note
This module builds on top of the shared [Lisp Base](lisp.md) module.
## lisp-mode
Not much to say here, as `lisp-mode` is configured in the "Lisp Base" module.
## SLIME
This module bundles [SLIME](https://common-lisp.net/project/slime/), a popular interactive
programming environment for SLIME, and enables many of its essential features.
SLIME supports many Common Lisp implementations:
* CMU Common Lisp (CMUCL)
* Steel Bank Common Lisp (SBCL)
* Clozure CL (a.k.a. OpenMCL)
* LispWorks
* Allegro CL
* CLISP
* Scieneer CL
* ECL
* Corman CL
* ABCL
The default config assumes the usage of [Clozure CL](https://github.com/Clozure/ccl) on macOS and
of [SBCL](http://www.sbcl.org/) everywhere else. That's something you can easily
tweak via `slime-default-lisp`.
You can start SLIME with `M-x slime`.

28
docs/modules/company.md Normal file
View file

@ -0,0 +1,28 @@
# Prelude Company
!!! Note
This module is enabled by default.
[company](https://company-mode.github.io/) is a completion library.
This module simply provides some reasonable defaults for it and enables `company-mode`:
```
(setq company-idle-delay 0.5)
(setq company-show-numbers t)
(setq company-tooltip-limit 10)
(setq company-minimum-prefix-length 2)
(setq company-tooltip-align-annotations t)
;; invert the navigation direction if the the completion popup-isearch-match
;; is displayed on top (happens near the bottom of windows)
(setq company-tooltip-flip-when-above t)
(global-company-mode 1)
```
You can adjust the configuration further in your personal config.
`company-mode` has [many extensions](https://github.com/company-mode/company-mode/wiki/Third-Party-Packages)
for various programming languages.
Some of Prelude's modules will install and enable the relevant extensions when necessary.

23
docs/modules/dart.md Normal file
View file

@ -0,0 +1,23 @@
# Prelude Dart
!!! Note
This module builds on top of the lsp-module.
The dart module is powered by [lsp-dart](https://emacs-lsp.github.io/lsp-dart/).
Some features it provides:
- Flutter integration
- Tree views
- Run pub
- Debug
- Run tests
Some essential commands:
- `lsp-dart-pub-get` - Run pub get or flutter pub get on project root.
- `lsp-dart-pub-upgrade` - Run pub upgrade or flutter pub upgrade on project root.
- `lsp-dart-pub-outdated` - Run pub outdated or flutter pub outdated on project root.
- `lsp-dart-run-all-tests` - Run all tests from project.
- `lsp-dart-run-test-file` - Run all tests from current test buffer.

View file

@ -0,0 +1,33 @@
# Prelude Emacs Lisp
!!! Note
This module builds on top of the shared [Lisp Base](lisp.md) module.
## Elisp-mode
The module establishes some sensible defaults for `elisp-mode` and
shortens its modeline name to "EL".
It establishes a few extra keybidings (inspired by SLIME):
* `C-c C-z` (`prelude-visit-ielm`)
* `C-c C-c` (`eval-defun`)
* `C-c C-b` (`eval-buffer`)
The module also enables auto-recompilation of Elisp files on save.
## IELM
IELM is an Elisp REPL bundled with Emacs. Prelude tweaks a bit it's default
configuration to align it with the `elisp-mode` configuration.
## elisp-slime-nav
The module bundles [elisp-slime-nav](https://github.com/purcell/elisp-slime-nav),
which allows you to jump to definitions with `C-.` (use `C-,` to jump back) and describe a symbol with
`C-c C-d (C-)d`.
## Minibuffer evaluation
`smartparens-mode` is conditionally enabled for `eval-expression` (`M-:`) command.

56
docs/modules/erc.md Normal file
View file

@ -0,0 +1,56 @@
# Prelude ERC
ERC is a popular IRC client bundled with Emacs.
ERC is both powerful and complex, that's why Prelude bundles
some configuration for it, together with a few handy commands
like `start-irc` and `stop-irc`.
## Customizing Server list
If you want to join a list of servers on `M-x start-irc`, other than
the default list, please redefine the variable `my-fav-irc` as follows
in your personal config:
```emacs-lisp
(setq my-fav-irc '("irc.freenode.net"
"irc.oftc.net"
"irc.mozilla.org"
"irc.gnome.org"))
```
## Customizing Last Quit Message
If you want to customize your IRC Last Quit Message from *Asta la
vista* to something more funkier, please redefine `bye-irc-message` as
follows:
```emacs-lisp
(setq bye-erc-message "adios")
```
## Reading NickServ passwords from auth-source plugin
If you want to automatically authenticate while logging into IRC
servers set the `erc-prompt-for-password` to nil as follows:
```emacs-lisp
(setq erc-prompt-for-password nil)
```
Now you can set password in plaintext in `.authinfo` file in the netRC
format or you it encrypted in `.authinfo.gpg` file after setting up gpg
in Emacs.
## Opening all ERC buffers in a new perspective
Many a time when we start IRC with the `start-irc` command, all the
channels open in our existing workspace, which can be annoying to
some; especially to those who like to organize their buffers into
separate groups (perspectives). To avoid this scenario, it is better
to group all the ERC buffers into one perspective called `IRC` when
`start-irc` is called. To enable this set the `prelude-new-irc-persp`
variable to true as follows:
```emacs-lisp
(setq prelude-new-irc-persp t)
```

11
docs/modules/fsharp.md Normal file
View file

@ -0,0 +1,11 @@
# Prelude F#
!!! Note
This module builds on top of the shared [Programming](programming.md) module.
## F# mode
This module uses
[`fsharp-mode`](https://github.com/fsharp/emacs-fsharp-mode) and
`eglot-fsharp` with almost no extra configuration.

94
docs/modules/index.md Normal file
View file

@ -0,0 +1,94 @@
# Modules
!!! Note
Most modules are not currently documented. Helping out with their
documentation is a great way to contribute to the project!
Prelude provides extra functionality through modules. Some modules may
require extra steps to enable all functionality. These steps and the
functionality provided by these modules are documented on the
following links.
## What's a module?
Prelude modules are plain old Elisp libraries - there's absolutely nothing magical about them.
Most of them simply install a few Emacs packages and provide some sensible baseline configuration for them.
Here's a real example.
``` emacs-lisp
;;; prelude-ruby.el --- Emacs Prelude: A nice setup for Ruby (and Rails) devs.
;;
;;; Code:
(require 'prelude-programming)
(prelude-require-packages '(inf-ruby yari))
;; We never want to edit Rubinius bytecode
(add-to-list 'completion-ignored-extensions ".rbc")
(define-key 'help-command (kbd "R") 'yari)
(with-eval-after-load 'ruby-mode
(defun prelude-ruby-mode-defaults ()
(inf-ruby-minor-mode +1)
;; CamelCase aware editing operations
(subword-mode +1))
(setq prelude-ruby-mode-hook 'prelude-ruby-mode-defaults)
(add-hook 'ruby-mode-hook (lambda ()
(run-hooks 'prelude-ruby-mode-hook))))
(provide 'prelude-ruby)
;;; prelude-ruby.el ends here
```
To use a module you simple have to require it. No new concepts. No magic.
## Programming Language Modules
The following programming languages have enhanced support in Prelude:
- C/C++
- [Clojure](clojure.md)
- CoffeeScript
- [Common Lisp](common_lisp.md)
- CSS
- [Dart](dart.md)
- [Emacs Lisp](emacs_lisp.md)
- Erlang
- Elixir
- Go
- Haskell
- JavaScript
- LaTeX
- [Lisp Base](lisp.md) (common foundation for Lisp modules)
- LSP (common foundation for all modules relying on `lsp-mode`)
- Markdown
- OCaml
- Perl
- [Python](python.md)
- [Programming Base](programming.md) (common foundation for programming modules)
- [Ruby](ruby.md)
- Rust
- Scala
- [Scheme](scheme.md)
- SCSS
- Shell
- TypeScript
- Web
- XML
- YAML
## Other Modules
- [Company](company.md)
- [ERC](erc.md)
- evil
- helm
- ido
- ivy
- key-chord
- Org Mode

7
docs/modules/lisp.md Normal file
View file

@ -0,0 +1,7 @@
# Prelude Lisp
Basic shared configuration for Lisp-like programming languages. Currently
it does only two things:
* Enables `smartparens-strict-mode` in Lisp major modes and REPL buffers
* Enables `rainbow-delimiters` in Lisp major modes and REPL buffers

View file

@ -0,0 +1,15 @@
# Prelude Programming
Prelude's programming module enables some additional functionality
for `prog-mode` - the parent mode for all major programming modes in Emacs.
Here are some features it provides:
* spell-checking of comments (via `flyspell-prog-mode`)
* auto-pairing of delimiters like parentheses (via `smartparens`)
* visual ques for whitespace (via `whitespace-mode`)
* highlighting code annotations (via `hl-todo`)
* linter integration (via `flycheck`)
* showing current definition name in the modeline (via `which-func`)
Most of this boils down to enabling a bunch of minor modes in `prog-mode-hook`.

47
docs/modules/python.md Normal file
View file

@ -0,0 +1,47 @@
# Prelude Python
!!! Note
This module builds on top of the shared [Programming](programming.md) module.
## Python Mode
Emacs comes with Python programming support through the built-in
`python-mode`. Whenever you are editing Python code run `C-h m` to
look at the Python mode key bindings. Alternatively look at the
menu bar entries under Python. To toggle the menu bar press `F12`.
## Anaconda Mode
Prelude bundles the powerful
[anaconda-mode](https://github.com/pythonic-emacs/anaconda-mode),
which provides code navigation, documentation lookup and completion for Python.
Anaconda has integration with popular modes like `company` and `eldoc`.
## Syntax checking
Prelude ships with [Flycheck](https://github.com/flycheck/flycheck),
an on the fly syntax checker. Flycheck has support for two Python
syntax checkers, [Pylint](http://www.pylint.org/) and
[Flake8](http://flake8.readthedocs.org/en/latest/). In
order to have Flycheck support on the fly syntax checking for
Python you need to have either of these installed and accessible to
Emacs. In order to manually choose a checker run `C-c ! s`.
## Automatic insertion of file encoding comments
You can have Prelude auto-detect the encoding of a source buffer and
insert the appropriate `# coding:` comments. If you wish to enable
this, add the following to your configuration:
```emacs-lisp
(setq prelude-python-mode-set-encoding-automatically t)
```
!!! Note
Previously `prelude-python` had this feature enabled by default (up to Prelude 1.1), but
it is only necessary on Python 2, because Python 3 uses utf-8
as the default file encoding. In 2020 Python 2 became deprecated, so that
functionality became mostly obsolete.

25
docs/modules/ruby.md Normal file
View file

@ -0,0 +1,25 @@
# Prelude Ruby
!!! Note
This module builds on top of the shared [Programming](programming.md) module.
## Ruby Mode
Emacs comes with Ruby programming support through the built-in
`ruby-mode`. Whenever you are editing Ruby code run `C-h m` to
look at the Python mode key bindings. Alternatively look at the
menu bar entries under Ruby. To toggle the menu bar press `F12`.
Prelude enables `CamelCase` aware editing in Ruby code (via `subword-mode`).
## inf-ruby
The module bundles the [inf-ruby](https://github.com/nonsequitur/inf-ruby) package which allows you to run a Ruby
REPL (e.g. `irb` or `pry`) in an Emacs buffer and interact with it from
Ruby source buffers.
## yari
The module bundles the [yari](https://github.com/hron/yari.el) package which allows you to search in Ruby's RI
documentation. Use `C-h R` to invoke it.

28
docs/modules/scheme.md Normal file
View file

@ -0,0 +1,28 @@
# Prelude Scheme
!!! Note
This module builds on top of the shared [Lisp Base](lisp.md) module.
## lisp-mode
Not much to say here, as `scheme-mode` is configured to use Prelude's
default Lisp settings.
## Geiser
This module bundles [Geiser](https://www.nongnu.org/geiser/), a popular interactive
programming environment for Scheme. People familiar with Common Lisp's SLIME will
feel right at home with Geiser.
Note that Geiser supports many Scheme implementations:
* Guile 2.2 or better
* Chicken 4.8.0 or better
* MIT/GNU Scheme 9.1 or better
* Chibi Scheme 0.7 or better
* Chez Scheme 9.4 or better
* Gambit 4.9 or better
* Racket 6.0 or better
You can fire Geiser with `M-x geiser`.

BIN
docs/prelude-cheatsheet.pdf Normal file

Binary file not shown.

350
docs/prelude-cheatsheet.tex Normal file
View file

@ -0,0 +1,350 @@
\documentclass[10pt]{article}
\usepackage[margin=0.5cm,landscape,a3paper]{geometry}
\pagestyle{empty}
\usepackage{textcomp}
\usepackage{multicol}
\usepackage{menukeys}
\usepackage{enumitem}
\usepackage{xcolor}
\usepackage{xpatch}
\usepackage{xparse}
\usepackage{calc}
\usepackage{tcolorbox}
\definecolor{default}{HTML}{333333}
\definecolor{heading}{HTML}{000000}
\definecolor{command}{HTML}{666666}
\definecolor{key}{HTML}{268BD2}
\renewcommand\section[1]{\bigskip\par\textbf{\color{heading}\large#1}\smallskip}
\renewcommand\subsection[1]{\smallskip\par\textbf{\color{heading}#1}}
\newcommand\humanreadable[1]{{\par\color{default}\small\sffamily#1}}
\newcommand\meta[1]{\textlangle\textit{#1}\textrangle}
\newcommand\keyify[1]{\color{key}\ttfamily#1}
\newlist{keylist}{description}{1}
\setlist[keylist]{
topsep = 1pt,
labelindent = 1pt,
itemsep = -1ex,
labelwidth = \widthof{xxxxxxxxxxxxxx},
font = \keyify,
leftmargin = !,
before = \color{command}\sffamily
}
\setlength\parindent{0em}
\setlength\parsep{0ex}
\renewcommand\baselinestretch{1.2}
\begin{document}
\begin{multicols}{4}
\setlength{\columnsep}{1cm}
\begin{center}
\LARGE\color{heading}\textbf{Emacs Prelude Cheat Sheet}
\end{center}
\section{Getting Help in Emacs}
\begin{keylist}
\item[C-h k \meta{key}] \humanreadable{describe function bound to \meta{key}}
\item[C-h b] \humanreadable{list key-bindings for focused buffer}
\item[C-h m] \humanreadable{describe mode}
\item[C-h l] \humanreadable{show the keys you have pressed}
\item[C-h f] \humanreadable{describe function}
\end{keylist}
\section{Global}
\begin{keylist}
\item[C-x \textbackslash] align-regexp
\item[C-+] text-scale-increase
\item[C--] text-scale-decrease
\item[C-x O] \humanreadable{go to previous window}
\item[C-x m] eshell
\item[C-x M] \humanreadable{start a new eshell if one is active}
\item[C-x M-m] shell
\item[C-x C-m] smex
\item[C-h A] apropos
\item[C-h C-f] find-function
\item[C-h C-k] find-function-on-key
\item[C-h C-v] find-variable
\item[C-h C-l] find-library
\item[C-h C-i] info-display-manual
\item[C-<backspace>] \humanreadable{kill line backward and indent}
\item[C-o] (isearch-mode) isearch-occur
\item[M-/] hippie-expand
\item[C-x C-b] ibuffer
\item[<f12>] menu-bar-mode
\item[C-x g] magit-status
\item[C-x M-g] magit-dispatch
\item[C-c g] magit-file-dispatch
\end{keylist}
\subsection{prelude}
\humanreadable{Keybindings defined in prelude mode}
\begin{keylist}
\item[C-c o] crux-open-with
\item[C-c C-/ g] prelude-google
\item[C-c C-/ h] prelude-github
\item[C-c C-/ y] prelude-youtube
\item[C-c C-/ d] prelude-duckduckgo
\item[C-a] crux-move-beginning-of-line
\item[S-<return>] crux-smart-open-line
\item[M-o] crux-smart-open-line
\item[C-S-<return>] crux-smart-open-line-above
\item[C-S-<up>] move-text-up
\item[C-S-<down>] move-text-down
\item[M-S-<up>] move-text-up
\item[M-S-<down>] move-text-down
\item[C-c n] crux-cleanup-buffer-or-region
\item[C-c f] crux-recentf-ido-find-file
\item[C-M-z] crux-indent-defun
\item[C-c u] crux-view-url
\item[C-c e] crux-eval-and-replace
\item[C-c s] crux-swap-windows
\item[C-c w] prelude-swap-meta-and-super
\item[C-c D] crux-delete-file-and-buffer
\item[C-c d] crux-duplicate-current-line-or-region
\item[C-c M-d] crux-duplicate-and-comment-current-
line-or-region
\item[C-c r] crux-rename-buffer-and-file
\item[C-c t] crux-visit-term-buffer
\item[C-c k] crux-kill-other-buffers
\item[C-c TAB] crux-indent-rigidly-and-copy-
to-clipboard
\item[C-c I] crux-find-user-init-file
\item[C-c S] crux-find-shell-init-file
\item[C-c i] imenu-anywhere
\item[s-p] projectile-command-map
\item[s-r] crux-recentf-ido-find-file
\item[s-j] crux-top-join-line
\item[s-k] crux-kill-whole-line
\item[s-m m] magit-status
\item[s-m l] magit-log
\item[s-m f] magit-log-buffer-file
\item[s-m b] magit-blame
\item[s-o] crux-smart-open-line-above
\end{keylist}
\subsection{ace-window}
\humanreadable{Quickly switch windows in Emacs}
\begin{keylist}
\item[s-w] ace-window
\end{keylist}
\subsection{avy}
\humanreadable{Effectively navigate to visible things}
\begin{keylist}
\item[C-c v] avy-goto-word-or-subword-1
\item[s-.] avy-goto-word-or-subword-1
\end{keylist}
\subsection{anzu}
\humanreadable{Enhances isearch \& query-replace by showing total matches and current match position}
\begin{keylist}
\item[M-\%] anzu-query-replace
\item[s-.] anzu-query-replace-regexp
\end{keylist}
\subsection{browse-kill-ring}
\humanreadable{Smarter kill-ring navigation}
\begin{keylist}
\item[s-y] browse-kill-ring
\end{keylist}
\subsection{crux}
\humanreadable{A Collection of Ridiculously Useful eXtensions for Emacs.}
\begin{keylist}
\item[C-\^] crux-top-join-line
\item[s-k] crux-kill-whole-line
\end{keylist}
\subsection{discover-my-major}
\humanreadable{A quick major mode help with discover-my-major.}
\begin{keylist}
\item[C-h C-m] discover-my-major
\end{keylist}
\subsection{easy-kill}
\humanreadable{Kill \& Mark Things Easily in Emacs.}
\begin{keylist}
\item[M-w] easy-kill
\item[C-M-SPC] easy-mark
\item[C-M-@] easy-mark
\end{keylist}
\subsection{expand-region}
\humanreadable{Increase selected region by semantic units.}
\begin{keylist}
\item[C-=] er/expand-region
\end{keylist}
\subsection{flycheck}
\humanreadable{On the fly syntax checking.}
\begin{keylist}
\item[C-t C-n] flycheck-next-error
\item[C-t C-p] flycheck-previous-error
\end{keylist}
\subsection{projectile}
\humanreadable{Project Interaction Library for Emacs.}
\begin{keylist}
\item[C-c p f] projectile-find-file
\item[C-c p p] projectile-switch-project
\item[C-c p d] projectile-find-dir
\item[C-c p r] projectile-replace
\item[C-c p T] projectile-find-test-file
\item[C-c p s g] projectile-grep
\item[C-c p s s] projectile-ag
\end{keylist}
\subsection{operate-on-number}
\humanreadable{Operate on number at point with arithmetic functions.}
\begin{keylist}
\item[C-c . +] apply-operation-to-number-at-point
\item[C-c . -] apply-operation-to-number-at-point
\item[C-c . *] apply-operation-to-number-at-point
\item[C-c . /] apply-operation-to-number-at-point
\item[C-c . \textbackslash] apply-operation-to-number-at-point
\item[C-c . \textasciicircum] apply-operation-to-number-at-point
\item[C-c . <] apply-operation-to-number-at-point
\item[C-c . >] apply-operation-to-number-at-point
\item[C-c . \#] apply-operation-to-number-at-point
\item[C-c . \%] apply-operation-to-number-at-point
\item[C-c . '] operate-on-number-at-point
\end{keylist}
\subsection{zop-to-char}
\humanreadable{A more powerful alternative to zap-to-char.}
\begin{keylist}
\item[M-z] zop-up-to-char
\item[M-Z] zop-to-char
\end{keylist}
\section{Modules}
\subsection{prelude-ido}
\begin{keylist}
\item[M-x] smex
\item[M-X] smex-major-mode-commands
\end{keylist}
\subsection{prelude-ivy}
\begin{keylist}
\item[C-c C-r] ivy-resume
\item[<f6>] ivy-resume
\item[C-s] swiper
\item[M-x] counsel-M-x
\item[<f1> f] counsel-describe-function
\item[<f1> v] counsel-describe-variable
\item[<f1> l] counsel-find-library
\item[<f1> i] counsel-info-lookup-symbol
\item[<f1> u] counsel-unicode-char
\item[C-c g] counsel-git
\item[C-c j] counsel-git-grep
\item[C-c k] counsel-ag
\item[C-x l] counsel-locate
\item[C-r] (minibuffer) counsel-minibuffer-history
\end{keylist}
\subsection{prelude-helm}
\begin{keylist}
\item[C-c h o] helm-occur
\item[C-c h g] helm-do-grep
\item[C-c h C-c w] helm-wikipedia-suggest
\item[C-c h SPC] helm-all-mark-rings
\item[C-c p h] helm-projectile
\end{keylist}
\subsection{prelude-helm-everywhere}
\begin{keylist}
\item[M-x] helm-M-x
\item[C-c C-m] helm-M-x
\item[M-y] helm-show-kill-ring
\item[C-x b] helm-mini
\item[C-x C-b] helm-buffers-list
\item[C-x C-f] helm-find-files
\item[C-h f] helm-apropos
\item[C-h r] helm-info-emacs
\item[C-h C-l] helm-locate-library
\item[C-c f] (prelude-mode) helm-recentf
\item[C-c C-l] (minibuffer-local) help-minibuffer-history
\item[C-o] (isearch-mode) helm-occur-from-isearch
\item[C-c C-l] (shell-mode) helm-comint-input-ring
\end{keylist}
\subsection{prelude-key-chord}
\begin{keylist}
\item[jj] avy-goto-word-1
\item[jl] avy-goto-line
\item[jk] avy-goto-char
\item[JJ] crux-switch-to-previous-buffer
\item[uu] undo-tree-visualize
\item[xx] execute-extended-command
\item[yy] browse-kill-ring
\end{keylist}
\subsection{prelude-evil}
\begin{keylist}
\item[C-A] (normal-state) evil-numbers/inc-at-pt
\item[C-S-A] (normal-state) evil-numbers/dec-at-pt
\item[>] (visual-state) prelude-shift-right-visual
\item[<] prelude-shift-left-visual
\item[C-S-d] prelude-evil-scroll-down-other-window
\item[C-S-u] prelude-evil-scroll-up-other-window
\item[K] (magit-branch-manager-mode)\\
(emacs-state) magit-discard
\item[L] (magit-branch-manager-mode)\\
(emacs-state) magit-log-popup
\item[K] (magit-status-mode) (emacs-state) magit-discard
\item[l] (magit-status-mode) (emacs-state)\\
magit-log-popup
\item[h] (magit-status-mode) (emacs-state)\\
magit-diff-toggle-refine-hunk
\end{keylist}
\subsection{prelude-emacs-lisp}
\begin{keylist}
\item[C-c C-z] prelude-visit-ielm
\item[C-c C-c] eval-defun
\item[C-c C-b] eval-buffer
\end{keylist}
\subsection{prelude-go}
\begin{keylist}
\item[C-c a] go-test-current-project
\item[C-c m] go-test-current-file
\item[C-c .] go-test-current-test
\item[C-c b] go-run
\item[C-c h] godoc-at-point
\end{keylist}
\subsection{prelude-ocaml}
\begin{keylist}
\item[C-c C-s] utop
\end{keylist}
\subsection{prelude-org}
\begin{keylist}
\item[C-c l] org-store-link
\item[C-c a] org-agenda
\item[C-c b] org-iswitchb
\end{keylist}
\subsection{prelude-rust}
\begin{keylist}
\item[C-c C-d] racer-describe
\item[C-c .] racer-find-definition
\item[C-c ,] pop-tag-mark
\end{keylist}
\end{multicols}
\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:

32
docs/support.md Normal file
View file

@ -0,0 +1,32 @@
# Support
Prelude currently has several official & unofficial support channels.
For questions, suggestions and support refer to one of them. Please, don't
use the support channels to report issues, as this makes them harder to track.
## Gitter
Most internal discussions about the development of Prelude happen on its
[gitter channel](https://gitter.im/bbatsov/prelude). You can often find
Prelude's maintainers there and get some interesting news from the project's
kitchen.
## Mailing List
The [official mailing list](https://groups.google.com/forum/#!forum/emacs-prelude) is
hosted at Google Groups. It's a low-traffic list, so don't be too hesitant to subscribe.
## Freenode
If you're into IRC you can visit the `#prelude` channel on Freenode.
It's not actively
monitored by the Prelude maintainers themselves, but still you can get support
from other Prelude users there.
## Stackoverflow
We're also encouraging users to ask Prelude-related questions on StackOverflow.
When doing so you should use the
[emacs-prelude](https://stackoverflow.com/questions/tagged/emacs-prelude) tag.

103
docs/troubleshooting.md Normal file
View file

@ -0,0 +1,103 @@
# Troubleshooting
## Updating bundled packages
Generally it's a good idea to do a package update before running
updating Prelude, since the latest Prelude code might depend on newer
versions of the bundled packages than you would currently have
installed.
If you're doing manual Prelude updates you should always do a package update first.
M-x package-list-packages RET U x
That's not necessary if you're using `M-x prelude-update`, since it
will automatically update the installed packages.
## Problems with flyspell-mode
Prelude makes heavy use of the flyspell-mode package for spell
checking of various things. The proper operation of flyspell depends
on the presence of the `aspell` program and an `en` dictionary on your
system. You can install `aspell` and the dictionary on macOS with
`homebrew` like this:
```shellsession
$ brew install aspell --with-lang=en
```
On Linux distros - just use your distro's package manager.
## Ugly colors in the terminal Emacs version
If your Emacs looks considerably uglier in a terminal (compared to the
GUI version) try adding this to your `.bashrc` or `.zshrc`:
```bash
export TERM=xterm-256color
```
Source the `.bashrc` file and start Emacs again.
## MELPA error on initial startup
If you get some http connection error related to the MELPA repo
just do a manual `M-x package-refresh-contents` and restart Emacs
afterwards.
## Warnings on arrow navigation in editor buffers
This is not a bug - it's a feature! I firmly believe that the one true
way to use Emacs is by using it the way it was intended to be used (as
far as navigation is concerned at least).
If you'd like to be take this a step further and disable the arrow key navigation
completely put this in your personal config:
```emacs-lisp
(setq guru-warn-only nil)
```
To disable `guru-mode` completely add the following snippet to your
personal Emacs config:
```emacs-lisp
(setq prelude-guru nil)
```
## Customized C-a behavior
Prelude overrides `C-a` to behave as described
[here](http://emacsredux.com/blog/2013/05/22/smarter-navigation-to-the-beginning-of-a-line/). If
you don't like that simply add this to your personal config:
```emacs-lisp
(global-set-key [remap move-beginning-of-line]
'move-beginning-of-line)
```
## Poor ido matching performance on large datasets
Prelude's `ido` module swaps the default `ido` flex matching with the
more powerful [ido-flx](https://github.com/lewang/flx).
The sorting algorithm `flx` uses is more complex, but yields better results.
On slower machines, it may be necessary to lower `flx-ido-threshold` to
ensure a smooth experience.
```emacs-lisp
(setq flx-ido-threshold 1000)
```
You can always disable the improved sorting algorithm all together like this:
```emacs-lisp
(flx-ido-mode -1)
```
## Windows compatibility
While everything in Prelude should work fine in Windows, I test it only
with GNU/Linux & macOS, so there might be Windows-specific problems from time to
time. This situation will probably improve over time.

290
docs/usage.md Normal file
View file

@ -0,0 +1,290 @@
# Usage
## Running
Nothing fancy here. Just start Emacs as usual. Personally I run Emacs
in daemon mode:
```shellsession
$ emacs --daemon
```
Afterwards I connect to the server with either a terminal or a GUI
client like this:
```shellsession
$ emacsclient -t
$ emacsclient -c
```
You'd probably do well to put a few aliases in your `.zshrc` (or
`.bashrc`):
```bash
alias e='emacsclient -t'
alias ec='emacsclient -c'
alias vim='emacsclient -t'
alias vi='emacsclient -t'
```
The last two aliases are helpful if you're used to editing files from
the command line using `vi(m)`.
You can also open a file with the cursor positioned directly on a specific line:
```shellsession
$ emacsclient somefile:1234
```
This will open file `somefile` and set cursor on line 1234.
## Getting to know Prelude
Certainly the best way to understand how Prelude enhances the default
Emacs experience is to peruse Prelude's source code (which is
obviously written in Emacs Lisp). Understanding the code is not
necessary of course. Prelude includes a `prelude-mode` minor Emacs mode
which collects some of the additional functionality added by
Prelude. It also adds an additional keymap that binds many of those
extensions to keybindings.
### Keymap
#### Global
Keybinding | Description
-------------------|------------------------------------------------------------
<kbd>C-x \\</kbd> | `align-regexp`
<kbd>C-+</kbd> | Increase font size(`text-scale-increase`).
<kbd>C--</kbd> | Decrease font size(`text-scale-decrease`).
<kbd>C-x O</kbd> | Go back to previous window (the inverse of `other-window` (`C-x o`)).
<kbd>C-^</kbd> | Join two lines into one(`crux-top-join-line`).
<kbd>C-x p</kbd> | Start `proced` (manage processes from Emacs; works only in Linux).
<kbd>C-x m</kbd> | Start `eshell`.
<kbd>C-x M-m</kbd> | Start your default shell.
<kbd>C-x C-m</kbd> | Alias for `M-x`.
<kbd>M-X</kbd> | Like `M-x` but limited to commands that are relevant to the active major mode.
<kbd>C-h A</kbd> | Run `apropos` (search in all Emacs symbols).
<kbd>C-h C-m</kbd> | Display key bindings of current major mode and descriptions of every binding.
<kbd>M-/</kbd> | Run `hippie-expand` (a replacement for the default `dabbrev-expand`).
<kbd>C-x C-b</kbd> | Open `ibuffer` (a replacement for the default `buffer-list`).
<kbd>F11</kbd> | Make the window full screen.
<kbd>F12</kbd> | Toggle the Emacs menu bar.
<kbd>C-x g</kbd> | Open Magit's status buffer.
<kbd>C-x M-g</kbd> | Open Magit's popup of popups.
<kbd>C-c g</kbd> | Open Magit's file-related commands.
<kbd>M-Z</kbd> | Zap up to char.
<kbd>C-=</kbd> | Run `expand-region` (incremental text selection).
<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.
#### Prelude Mode
Keybinding | Description
-------------------|------------------------------------------------------------
<kbd>C-c o</kbd> | Open the currently visited file with an external program.
<kbd>C-c i</kbd> | Search for a symbol, only for buffers that contain code
<kbd>C-c g</kbd> | Search in Google for the thing under point (or an interactive query).
<kbd>C-c G</kbd> | Search in GitHub for the thing under point (or an interactive query).
<kbd>C-c y</kbd> | Search in YouTube for the thing under point (or an interactive query).
<kbd>C-c U</kbd> | Search in Duckduckgo for the thing under point (or an interactive query).
<kbd>C-S-RET</kbd> or <kbd>Super-o</kbd> | Insert an empty line above the current line and indent it properly.
<kbd>S-RET</kbd> or <kbd>M-o</kbd> | Insert an empty line and indent it properly (as in most IDEs).
<kbd>C-S-up</kbd> or <kbd>M-S-up</kbd> | Move the current line or region up.
<kbd>C-S-down</kbd> or <kbd>M-S-down</kbd>| Move the current line or region down.
<kbd>C-c n</kbd> | Fix indentation in buffer and strip whitespace.
<kbd>C-c f</kbd> | Open recently visited file.
<kbd>C-M-\\</kbd> | Indent region (if selected) or the entire buffer.
<kbd>C-c u</kbd> | Open a new buffer containing the contents of URL.
<kbd>C-c e</kbd> | Eval a bit of Emacs Lisp code and replace it with its result.
<kbd>C-c s</kbd> | Swap two active windows.
<kbd>C-c D</kbd> | Delete current file and buffer.
<kbd>C-c d</kbd> | Duplicate the current line (or region).
<kbd>C-c M-d</kbd> | Duplicate and comment the current line (or region).
<kbd>C-c r</kbd> | Rename the current buffer and its visiting file if any.
<kbd>C-c t</kbd> | Open a terminal emulator (`ansi-term`).
<kbd>C-c k</kbd> | Kill all open buffers except the one you're currently in.
<kbd>C-c TAB</kbd> | Indent and copy region to clipboard
<kbd>C-c I</kbd> | Open user's init file.
<kbd>C-c S</kbd> | Open shell's init file.
<kbd>C-c . +</kbd> | Increment integer at point. Default is +1.
<kbd>C-c . -</kbd> | Decrement integer at point. Default is -1.
<kbd>C-c . *</kbd> | Multiply integer at point. Default is *2.
<kbd>C-c . /</kbd> | Divide integer at point. Default is /2.
<kbd>C-c . \\</kbd> | Modulo integer at point. Default is modulo 2.
<kbd>C-c . ^</kbd> | Power to the integer at point. Default is ^2.
<kbd>C-c . <</kbd> | Left-shift integer at point. Default is 1 position to the left.
<kbd>C-c . ></kbd> | Right-shift integer at point. Default is 1 position to the right.
<kbd>C-c . #</kbd> | Convert integer at point to specified base. Default is 10.
<kbd>C-c . %</kbd> | Replace integer at point with another specified integer.
<kbd>C-c . '</kbd> | Perform arithmetic operations on integer at point. User specifies the operator.
<kbd>Super-r</kbd> | Recent files
<kbd>Super-j</kbd> | Join lines
<kbd>Super-k</kbd> | Kill whole line
<kbd>Super-m m</kbd> | Magit status
<kbd>Super-m l</kbd> | Magit log
<kbd>Super-m f</kbd> | Magit file log
<kbd>Super-m b</kbd> | Magit blame mode
!!! Note
For various arithmetic operations, the prefix `C-c .` only needs to be pressed once for the first operation.
For subsequent operations, only the appropriate operations (i.e. `+`, `-`, `*`, `/`... needs to be pressed).
#### macOS modifier keys
Prelude does not mess by default with the standard mapping of `Command` (to `Super`) and `Option` (to `Meta`).
If you want to swap them add this to your personal config:
```emacs-lisp
(setq mac-command-modifier 'meta)
(setq mac-option-modifier 'super)
```
You can also temporarily swap them with `C-c w` (`M-x prelude-swap-meta-and-super`).
!!! Tip
[The Emacs Mac port](https://bitbucket.org/mituharu/emacs-mac.git) comes
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`.
!!! Tip
I'd highly recommend to all macOS users to consider
[remapping Return to Control](http://emacsredux.com/blog/2013/11/12/a-crazy-productivity-boost-remap-return-to-control/)
instead. That's an epic productivity boost and it's not as crazy as it sounds!
#### Projectile
[Projectile](https://github.com/bbatsov/projectile) is one of the essential packages bundled with Prelude.
It provides an easy way to navigate and switch projects. Take a look at its extensive documentation
to get a feel for everything you can do with Projectile.
Prelude adds an extra keymap prefix `s-p` (`s` stands for
`Super`) in addition to the standard one `C-c p`. By default on Windows keyboard
`Super` is mapped to the `Windows` key and on macOS keyboards `Super` is mapped
to the `Command` key.
If you ever forget any of Projectile's keybindings just do a:
<kbd>C-c p C-h</kbd> or <kbd>s-p C-h</kbd>
Alternatively you can just press <kbd>s-p</kbd> and wait for a moment
for `which-key` to kick in and show you the available keybindings.
#### Helm
Helm is setup according to this guide: [A Package in a league of its own: Helm](http://tuhdo.github.io/helm-intro.html).
You can learn Helm usage and key bindings following the guide. <kbd>C-c h</kbd> is Prelude's default prefix key for Helm.
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.
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)`.
When `prelude-helm-everywhere` is activated, Helm enables these global key bindings:
Key binding | Description
-------------------|----------------------------------------------
<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>.
<kbd>M-y</kbd> | Run [helm-show-kill-ring](http://tuhdo.github.io/helm-intro.html#sec-4), shows the content of `kill-ring`.
<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.
<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.
<kbd>C-h f </kbd> | Run [helm-apropos](http://tuhdo.github.io/helm-intro.html#sec-13), an interactive version of `apropos-command`.
<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`.
<kbd>C-h C-l </kbd>| Run `helm-locate-library` that can search for locations of any file loaded into Emacs.
This key binding is activated in `shell-mode`:
Key Binding | Description
-------------------|----------------------------------------------
<kbd>C-c C-l</kbd> | Run `helm-comint-input-ring` that shows `shell` history using Helm interface.
This key bindings is activated in `eshell-mode`:
Key Binding | Description
-------------------|----------------------------------------------
<kbd>C-c C-l</kbd> | Run `helm-eshell-history` that shows `eshell` history using Helm interface.
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.
You can always reactivate Helm with `(prelude-global-helm-global-mode-on)`.
!!! Note
In `helm-M-x`, you have to pass prefix argument *AFTER* you run `helm-M-x`,
because your prefix argument will be displayed in the modeline when in `helm-M-x`
buffer. Passing prefix argument **BEFORE** `helm-M-x` **has no effect**.
#### Key-chords
!!! Note
Key-chords are available only when the `prelude-key-chord` module has been enabled.
Keybinding | Description
-------------------|----------------------------------------------
<kbd>jj</kbd> | Jump to the beginning of a word(`avy-goto-word-1`)
<kbd>jk</kbd> | Jump to a character(`avy-goto-char`)
<kbd>jl</kbd> | Jump to the beginning of a line(`avy-goto-line`)
<kbd>JJ</kbd> | Jump back to previous buffer(`crux-switch-to-previous-buffer`)
<kbd>uu</kbd> | View edits as a tree(`undo-tree-visualize`)
<kbd>xx</kbd> | Executed extended command(`execute-extended-command`)
<kbd>yy</kbd> | Browse the kill ring(`browse-kill-ring`)
##### Disabling key-chords
In some cases you may not want to have a key-chord that is defined by prelude,
in which case you can disable the binding in your `personal.el` file by setting
its command to `nil`. For example, to disable the `jj` key-chord add the
following line:
```emacs-lisp
(key-chord-define-global "jj" nil)
```
If you're an `evil-mode` user you'll probably do well to disable `key-chord-mode` altogether:
```emacs-lisp
(key-chord-mode -1)
```
#### vim emulation
If you want to use vim keybindings inside of Emacs enable the `prelude-evil` module which provides
support for `evil-mode`.
### Cheatsheet
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.
![cheatsheet](cheatsheet.png)
#### PDF generation
To generate a PDF version of the cheatsheet you'll need to install [LaTeX](https://www.latex-project.org/get/). Afterwards you can do something like:
```shellsession
$ cd modules/doc
$ pdflatex prelude-cheatsheet.tex
```
#### PNG generation
To generate a PDF version of the cheatsheet you'll need to install [Poppler](https://poppler.freedesktop.org/). Afterwards you can do something like:
```shellsession
$ cd modules/doc
$ pdftocairo -png -singlefile prelude-cheatsheet.pdf cheatsheet
```
## Automatic package installation
The default Prelude installation comes with a bare minimum of
functionality. It will however install add-ons for various programming
languages and frameworks on demand. For instance - if you try to open
a `.clj` file `clojure-mode`, `cider` and Prelude's enhanced Lisp
configuration will be installed automatically for you.
You can, of course, install anything you wish manually as well.