Emacs Commands

Published January 01, 2004

I use emacs by default. This website was built entirely using emacs, except one or two edits which were done by vi.

Here are settings of my .emacs file:

;; Arul's Emacs customisations
;; Last updated: 25 August 2009

;; Don't show startup message
(setq inhibit-startup-message t)

;; Font lock mode
(when (fboundp 'global-font-lock-mode)
  (global-font-lock-mode t))

;; Maximum colours
(setq font-lock-maximum-decoration t)

;; Show trailing spaces with something
(setq show-trailing-whitespace t)

;; Set tab width to 4 spaces
(setq tab-width 4)

;; Force tabs to become spaces
(setq-default indent-tabs-mode nil)

;; Show blocked area
(setq transient-mark-mode t)

;; Highlight matching parenthesis
(show-paren-mode 1)

;; Highlight current line
;(global-hl-line-mode 1)

;; Show time
(display-time)

;; Make backspace WORK
(normal-erase-is-backspace-mode 0)

;; Show lines and columns
(line-number-mode "on")
(column-number-mode "on")

;; External packages
(add-to-list 'load-path "~/.emacs.d")

(require 'linum)
(global-linum-mode 1)
(setq linum-format "%d ")

;; PHP colouring
;(require 'php-mode)

;;python mode stuff
;(setq auto-mode-alist
;      (cons '("\\.py$" . python-mode) auto-mode-alist))
;(setq interpreter-mode-alist
;      (cons '("python" . python-mode)
;            interpreter-mode-alist))
;(autoload 'python-mode "python-mode" "Python editing mode." t)

Emacs Commands

====================================================
FILE AND BUFFERS
====================================================
  C-x C-f      Find or Create file
  C-x C-s      Save file
  C-x C-w      Write to new filename (it prompts you)
  C-x C-b      Lists buffers
  C-x C-c      Quit emacs

====================================================
COMMAND RELATED
====================================================
  ESC ESC ESC  Cancelling whatever I am doing
  C-g          Abort command (like Ctrl C)
  C-_ or C-x u Undo/Redo (toggles)
  C-z         Suspend (to return, type %emacs)
  A-x         Run any command

====================================================
CUTTING COPYING AND PASTING
====================================================
  C-k          Cut text from cursor to end of line
  C-y          Paste text
  C-space      Mark the start for the block
  C-w         Mark the end of the block and CUT it
  A-w         Mark the end of the block and COPY it

====================================================
FIND REPLACE a STRING
====================================================
  A-x replace-string ENTER  String replace from cursor to end of buffer
  A-x query-replace ENTER   String replace with querying
  A-%           Search and replace (press y when prompted)
  A-x grep ENTER        Perform a 'grep' search

====================================================
SCROLLING AND WINDOWS
====================================================
  C-x 1       One window on current buffer
  C-x 2        Split window horizontally
  C-x 3        Split window vertically
  C-x o        Shift between windows
  C-x 0        Close current window
  C-v          Go forward one screen
  A-v          Go backward one screen

====================================================
CURSOR MOVEMENT
====================================================
  A-v   Beginning of buffer
  C-v   End of buffer
  C-a   Beginning of line
  C-e   End of line
  A-f   Forward one word
  A-b   Back one word

====================================================
MORE
====================================================
  A-x what-line ENTER   Display current line number
  A-< C-u 20 C-n    Go to line number 20

Related Posts

If you have any questions, please contact me at arulbOsutkNiqlzziyties@gNqmaizl.bkcom. You can also post questions in our Facebook group. Thank you.

Disclaimer: Our website is supported by our users. We sometimes earn affiliate links when you click through the affiliate links on our website.

Last Updated: January 01, 2004.     This post was originally written on January 02, 2004.