Created
November 23, 2012 20:01
-
-
Save rubic/4137046 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(setq inhibit-startup-message t) ; disables splash screen | |
(setq initial-scratch-message nil) ; suppress initial *scratch* buffer msg | |
(setq transient-mark-mode t) ; highlights the selected region | |
(tool-bar-mode -1) ; remove the toolbar | |
(setq default-major-mode 'text-mode) ; make text-mode default | |
(setq-default fill-column 66) ; set the fill column for word wrap | |
(setq-default indent-tabs-mode nil) ; spaces instead of tabs by default | |
(mouse-wheel-mode t) ; enable mouse wheel | |
(setq scroll-step 1) ; scroll up by a single line | |
(add-to-list 'load-path "~/.emacs.d") ; load path | |
(global-set-key "\M-g" 'goto-line) ; goto the specified line | |
(fset 'yes-or-no-p 'y-or-n-p) ; replace y-e-s by y | |
(setq frame-title-format "%b") ; display just the buffer name in title | |
; rather than the entire path | |
(setq backup-inhibited t) ; disable backups | |
(setq auto-save-default nil) ; disable auto save | |
(setq scroll-bar-mode-explicit t) ; move scrollbar to the right side | |
(set-scroll-bar-mode `right) ; explicitly | |
(line-number-mode 1) ; show the line and column numbers | |
(column-number-mode 1) ; on the mode line | |
(setq visible-bell t) ; flash instead of the annoying bell | |
(setq delete-selection-mode t) ; http://www.emacswiki.org/emacs/DeleteSelectionMode | |
;; ensure my files have no trailing whitespace | |
(add-hook 'before-save-hook 'delete-trailing-whitespace) | |
;; disable visual line mode for everything but text mode | |
(setq line-move-visual nil) ; disable new mode introduced in v23 | |
(add-hook 'text-mode-hook 'turn-on-visual-line-mode) | |
;; Keep places in the load path | |
(setq save-place-file "~/.emacs.d/emacs-places") | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; delete whole line, similar to vi's dd command | |
(defun kill-whole-line nil | |
"Kills the entire line on which the cursor is located, and places the | |
cursor as close to its previous position as possible." | |
(interactive) | |
(progn | |
(let ((y (current-column)) | |
(a (progn (beginning-of-line) (point))) | |
(b (progn (forward-line 1) (point)))) | |
(kill-region a b) | |
(move-to-column y)))) | |
;; Now bind the delete whole line function to control-shift-K | |
(global-set-key [(control shift k)] 'kill-whole-line) | |
;; define keys to scroll up/down one line - 2008/10/03 - jhb | |
(defun scroll-up-one-line () | |
(interactive) | |
(scroll-up 1)) | |
(defun scroll-down-one-line () | |
(interactive) | |
(scroll-down 1)) | |
(global-set-key [(control ?.)] 'scroll-up-one-line) ; C-. | |
(global-set-key [(control ?,)] 'scroll-down-one-line) ; C-, | |
; uncomment below if preference is to use arrow keys | |
;(global-set-key [(control up)] 'scroll-up-one-line) ; C-up | |
;(global-set-key [(control down)] 'scroll-down-one-line) ; C-down | |
;; goto beginning, end of buffer | |
(global-set-key [(control <)] 'beginning-of-buffer) ; C-< | |
(global-set-key [(control >)] 'end-of-buffer) ; C-> | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(color-theme-initialize) | |
(color-theme-gnome2) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; Steve Yegge's rebinding of kill-region, backward-kill-word | |
;; http://steve.yegge.googlepages.com/effective-emacs | |
;; "As an added benefit, many Unix command shells provide | |
;; Emacs-like command-line editing keys, and Ctrl-w is | |
;; usually the default binding for backward-kill-word. So | |
;; your usage will be consistent in shells." | |
(global-set-key "\C-w" 'backward-kill-word) | |
(global-set-key "\C-x\C-k" 'kill-region) | |
; making buffer names unique | |
; http://emacs-fu.blogspot.com/2009/11/making-buffer-names-unique.html | |
(require 'uniquify) | |
(setq | |
uniquify-buffer-name-style 'post-forward | |
uniquify-separator ":") | |
;; http://emacs-fu.blogspot.com/2009/11/copying-lines-without-selecting-them.html | |
;; When I'm programming, I often need to copy a line. Normally, this | |
;; requires me to first select ('mark') the line I want to | |
;; copy. That does not seem like a big deal, but when I'm in the | |
;; 'flow' I want to avoid any little obstacle that can slow me down. | |
;; | |
;; The code below simply embellishes the normal functions with the | |
;; functionality 'if nothing is selected, assume we mean the current | |
;; line'. The key bindings stay the same (M-w, C-w). | |
;; | |
;; Update: C-w is mapped to backward-kill-word, so use C-x C-k to | |
;; kill-region | |
(defadvice kill-ring-save (before slick-copy activate compile) "When called | |
interactively with no active region, copy a single line instead." | |
(interactive (if mark-active (list (region-beginning) (region-end)) (message | |
"Copied line") (list (line-beginning-position) (line-beginning-position | |
2))))) | |
(defadvice kill-region (before slick-cut activate compile) | |
"When called interactively with no active region, kill a single line instead." | |
(interactive | |
(if mark-active (list (region-beginning) (region-end)) | |
(list (line-beginning-position) | |
(line-beginning-position 2))))) | |
;; save-place: When you visit a file, point goes to the last | |
;; place where it was when you previously visited the same | |
;; file. http://www.emacswiki.org/emacs/SavePlace | |
(require 'saveplace) | |
(setq-default save-place t) | |
;; ido mode | |
(ido-mode 1) | |
(setq ido-enable-flex-matching t) | |
(setq ido-everywhere t) | |
(setq ido-max-directory-size 100000) | |
;; ReSTructured Text | |
(add-to-list 'auto-mode-alist '("\\.rstx\\'" . rst-mode)) | |
;; Maybe better if I could limit hl-line for just code editing ... | |
(global-hl-line-mode 1) | |
(set-face-background 'hl-line "#666") | |
(set-face-foreground 'hl-line "white") | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; edit via emacs in chrome | |
(require 'edit-server) | |
(edit-server-start) | |
;; links to use chrome | |
(setq browse-url-browser-function 'browse-url-generic | |
browse-url-generic-program "chromium-browser") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment