Skip to content

Latest commit

 

History

History
330 lines (211 loc) · 6.07 KB

Customization.org

File metadata and controls

330 lines (211 loc) · 6.07 KB

Customization

Customization

Basic Settings

Turn-off Alarm Bell

(setq ring-bell-function #'ignore)

Turn-off Cursor Blink

(blink-cursor-mode -1)

Turn-off Startup Screen

(setq inhibit-startup-screen t)

Ask y or n instead of yes or no

(defalias 'yes-or-no-p 'y-or-n-p)

Disable/Enable Blink Cursor

Enable Blink Cursor

(blink-cursor-mode 1)

Stop Blink Cursor

(blink-cursor-mode 0)

Space / Tabs - Indentation

Set indentation with spaces instead of tabs with 4 spaces

(setq tab-width 4 indent-tabs-mode nil)


;; set default tab char's display width to 4 spaces
(setq-default tab-width 4)
(setq-default indent-tabs-mode nil)

;; make tab key always call a indent command.
(setq-default tab-always-indent t)

;; make tab key call indent command or insert tab character, depending on cursor position
(setq-default tab-always-indent nil)

;; make tab key do indent first then completion.
(setq-default tab-always-indent 'complete)

Font Size and Type

(set-default-font "Inconsolata 14")

Character Encoding Default

;; Character encodings default to utf-8.
(prefer-coding-system 'utf-8)

(set-language-environment 'utf-8)

(set-default-coding-systems 'utf-8)

(set-terminal-coding-system 'utf-8)

(set-selection-coding-system 'utf-8)

Disable / Enable Backup Files

Enable

(setq make-backup-files t)

Disable

(setq make-backup-files nil)

Show Match Parenthesis

ELISP> (show-paren-mode 1)
t

Delete trailing whitespace before saving

(add-hook 'before-save-hook 'delete-trailing-whitespace)

Set Default Web Browser

Set the default web browsr used by (browse-url <url>) function and by org-mode.

 ;; Set the default web browser to Chromium Browsr
(setq browse-url-browser-function 'browse-url-generic
      browse-url-generic-program "chromium-browser")

Hide / Show Emacs Widgets

Hide / Show Menu bar

Hide Menu Bar

(menu-bar-mode 0)

Show Menu Bar

(menu-bar-mode 1)

Hide / Show Toolbar

Show Tool Bar

(tool-bar-mode 1)

Hide Tool Bar

(tool-bar-mode 0)

Hide / Show Scroll Bar

Show

(scroll-bar-mode 1)

Hide

(scroll-bar-mode -1)

Quiet Startup

From: Ask HN Emacs Users: What’s in your .emacs file?

;; Don't display the 'Welcome to GNU Emacs' buffer on startup
(setq inhibit-startup-message t)

;; Display this instead of "For information about GNU Emacs and the
;; GNU system, type C-h C-a.". This has been made intentionally hard
;; to customize in GNU Emacs so I have to resort to hackery.
(defun display-startup-echo-area-message ()
  "If it wasn't for this you'd be GNU/Spammed by now"
  (message ""))

;; Don't insert instructions in the *scratch* buffer
(setq initial-scratch-message nil)

Separte Customization from init file

It will keep the user customization created with M-x customize-theme, M-x customize-group in a separate file ~/.emacs.d/custom.el.

(setq custom-file (concat (file-name-as-directory user-emacs-directory)
                            "custom.el"
                            ))
(load custom-file 'noerror)

Languages and Encoding

(prefer-coding-system 'utf-8)

Tab width and Spaces

;; force emacs to always use spaces instead of tab characters
(setq-default indent-tabs-mode nil)

;; set default tab width to 4 spaces
(setq default-tab-width 4)
(setq tab-width 4)

Backup Settings

;disable backup
(setq backup-inhibited t)

;disable auto save
(setq auto-save-default nil)


;;  Get Rid of temporary files ending in ~
;;  The temporary files will be in the temporary directory
;;
(setq backup-directory-alist
      `((".*" . ,temporary-file-directory)))

;; Move Deleted Files to Trash
;;
(setq delete-by-moving-to-trash t)

Show Line number and column number in minibuffer

(setq line-number-mode               t)
(setq column-number-mode             t)

Enable find file at point

When doing C-x C-f use information at point (your cursor) to open file or URL. I.e. if your cursor is on a file path, or URL, it defaults to that filled in the minibuffer.

;;find-file-at-point, smarter C-x C-f when point on path or URL
(ffap-bindings)

Unique buffer names

;; Unique buffer name
(require 'uniquify)
(setq uniquify-buffer-name-style 'forward)

Mark Current Line

Enable Mark Current Line

;; mark current line:
(global-hl-line-mode 1)

Disable Mark Current Line

;; mark current line:
(global-hl-line-mode 0)

Recent Files

Show recent files in the File menu.

;; recentf stuff
;; recentf - F5
(require 'recentf)
(recentf-mode 1)
(setq recentf-max-saved-items 500)
(setq recentf-max-menu-items 60)

Save Minibuffer History

Saves the minibuffer history on every Emacs session.

(savehist-mode 1)
(setq savehist-additional-variables '(kill-ring search-ring regexp-search-ring))

;; To set the file which the minibuffer is saved use:
(setq savehist-file "~/.emacs.d/tmp/savehist")

Themes

Load a color theme

(load-theme 'wombat t)

Choose a color theme

M-x customize-theme