Emacs with Prelude

1. Prelude

Prelude provides a pre-defined set of functionalities that modernizes emacs without the user requiring to install countless packages and initializing them manually. Therefore, prelude can be a good starting point for your emacs setup.

However, the default installation of prelude will override all your packages including the startup init.el file. It auto-generates the init.el file.

If you want to manually enable packages or scripts you can do that in ~/.emacs.d/personal directory.

For installation of Prelude with default settings and packages run following command.

curl -L https://git.io/epre | sh

See https://github.com/bbatsov/prelude for more information.

If you start emacs, it should initialize and install the required packages.

2. Enable packages

Copy ~/.emacs.d/sample/prelude-modules.el to ~/.emacs.d directory and un-comment the packages that you use.

I un-commented prelude-helm-everywhere package. After restart, this package will override several emacs global commands to use helm. Helm enables you to auto complete all the commands you type in emacs. It also shows a small buffer window to list the possible commands/files that you are trying to achieve with the current command.

3. Few interesting commands

C-x C-f = Find files
C-c f = helm-recentf
M-x = command history

4. Usage based commands

* Close a window -> C-x 0
* Resize window -> C-x ^ } { - + toggle-window-split
* Add text to beginning of each line
All buffer -> M-< M-x replace-regexp RET ^ RET <text> RET
Region -> Select the region -> M-x string-insert-rectangle RET
* Multi line change text
C-x r t
C-x r k = Kill in rectangle between start and end
* Move horizontal window to vertical -> window-toggle-split-direction (in lisp)
(global-set-key (kbd "C-x t") 'window-toggle-split-direction)
* History files -> C-x C-r

5. Org mode

Add few files to track the list of your activities/TODOs in ~/.emacs.d/personal/03-org-mode.el

(setq org-agenda-files (list "~/org/work.org"
                             "~/org/home.org"))
A-Enter = *
A-<right> = **
C-c C-t or S-<right> = TODO / CLOSED / DONE
C-c C-s = Create Schedule
C-c a = Week's scheduled item list
C-c . = Time stamp
C-c l = Store link

6. Basic commands

C-h C-h = help
C-h k = show documentation for command with key
C-h f = show documentation for command by name
F3 = start recording macro, F4 = stop/playback
C-x b = switch buffers
C-x k = kill buffer
C-w = kill region
C-k = kill line
C-u 10 C-k = kill 10 lines
A-w = Kill region without deleting
C-y = yanks last killed text
A-y = replace yanked text with previously killed text
C-x C-space = last edit position
C-x C-x = hight everything between previous cursor and current location
A-y = move to next item in kill ring
C-_ / C-/ / C-x u = undo
C-s = search (C-r = backward)
A-% = query replace ('space' = replace, n = skip, ! = replace all)
C-A-s = regular expression incremental search
A-q = wrap text
A-e = next sentence
C-u 3 C-p = back 2 lines
A-g g = jump to specified line
C-x C-x = swap point and mark
A-x auto-fill-mode = wraps 70 chars lines
A-x flyspell-mode = highlight mispelled words
A-x follow-mode = makes two windows scroll together
C-space = format selected

7. Bookmarks

- C-x r m RET : Set the bookmark for the visited file, at point.
- C-x r m bookmark RET : Set the bookmark named bookmark at point (bookmark-set).
- C-x r b bookmark RET : Jump to the bookmark named bookmark (bookmark-jump).
- C-x r l : List all bookmarks (list-bookmarks).
- M-x bookmark-save : Save all the current bookmark values in the default bookmark file.

8. References

https://github.com/bbatsov/prelude

Advertisements

Leave a comment

Filed under Uncategorized

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s