Skip to content

Instantly share code, notes, and snippets.

@hidsh
Created October 7, 2011 08:37
Show Gist options
  • Save hidsh/fb23d5be7208457bd774 to your computer and use it in GitHub Desktop.
Save hidsh/fb23d5be7208457bd774 to your computer and use it in GitHub Desktop.
.emacs
;;;
;;; .emacs
;;;
(push "~/elisp" load-path)
(transient-mark-mode nil)
;; C-h --> BS
(keyboard-translate ?\C-h ?\C-?)
(global-set-key "\C-h" nil)
;;
;; global unbinding
;;
(global-unset-key "\C-o")
(global-unset-key "\C-z")
(global-unset-key "\M-`")
(global-unset-key "\M-h")
(global-unset-key "\377") ;; M-DEL
(global-unset-key "\C-t")
;;(global-unset-key "\C-[") ;; Why doesn't work M-x??
(global-unset-key "\C-]")
(global-unset-key "\C-_")
;(global-unset-key "\C-/")
;; (global-unset-key "\C-#") ;; not work on emacs21
(global-unset-key "\C-v")
(global-unset-key "\C-j")
(global-unset-key "\C-x\C-z")
(global-unset-key "\C-\\")
(global-unset-key [f1])
(global-unset-key [f2])
(global-unset-key [f10])
(global-unset-key "\C-xnp") ;; narrow-to-page
(global-unset-key "\C-xnd") ;; narrow-to-defun
;; (global-unset-key "\C-xnw") ;; widen
;; (global-unset-key "\C-xnn") ;; narrow-to-region
(global-unset-key "\M-k") ;; kill-sentence
(global-unset-key "\C-x\C-p") ;; mark-page
(global-unset-key "\C-x\C-n") ;; set-goal-colum
(global-unset-key "\C-x-") ;; shrink-window-if-larger-than-buffer
(global-unset-key "\M-p")
;;
;; global new bindings
;;
;; Page UP/DOWN
(global-set-key "\M-n" 'scroll-up)
(global-set-key "\M-p" 'scroll-down)
;; beginning/end of buffer
(global-set-key "\M-\S-n" 'end-of-buffer)
(global-set-key "\M-\S-p" 'beginning-of-buffer)
;; ;; other window Page UP/DOWN
(global-set-key "\C-x\C-n" 'scroll-other-window)
(global-set-key "\C-x\C-p" 'scroll-other-window-down)
;; goto-line to M-g
(global-set-key "\M-g" 'goto-line)
;; recentf-open-files to C-x r r
(global-set-key "\C-xrr" 'recentf-open-files)
(global-set-key "\C-x\C-b" 'electric-buffer-list)
;;
;; local bindings
;;
;; history in minibuffer
(define-key minibuffer-local-must-match-map "\C-n" 'next-history-element)
(define-key minibuffer-local-must-match-map "\M-n" 'next-history-element)
(define-key minibuffer-local-must-match-map "\C-p" 'previous-history-element)
(define-key minibuffer-local-must-match-map "\M-p" 'previous-history-element)
;; for insert-parentheses
(setq parens-require-spaces nil)
(global-set-key "\M-9" 'insert-parentheses)
;;
;; discrete settings
;;
;; disable auto-saving
(setq auto-save-default nil)
;; visual-bell
(setq visible-bell t)
;; hide toolbar
(tool-bar-mode nil)
;; stop cursor blinking
(blink-cursor-mode 0)
;; Always end a file with a newline
(setq require-final-newline t)
;; case sensitive in dynamic abbrev
(setq dabbrev-case-fold-search nil)
;;
;; hooks and advices
;;
;;
;; additonal emacs lisp
;;
;; my discrete elisp
(require 'discrete)
;; mic-paren
(show-paren-mode t)
;; jump to paren
(require 'mic-paren)
(defvar my-paren-open "\\s(")
(make-variable-buffer-local 'my-paren-open)
(defvar my-paren-close "\\s)")
(make-variable-buffer-local 'my-paren-close)
(defun my-paren (ARG)
(interactive "P")
(let ((FOL-CHAR (char-to-string (following-char)))
(PRE-CHAR (char-to-string (preceding-char))))
(save-match-data
(cond
((and (string-match my-paren-open FOL-CHAR) (string-match my-paren-close PRE-CHAR))
(if ARG (paren-forward-sexp) (paren-backward-sexp)))
((string-match my-paren-open FOL-CHAR) (paren-forward-sexp))
((string-match my-paren-close PRE-CHAR) (paren-backward-sexp))
(t (re-search-backward my-paren-open))))))
(global-set-key "\M-]" 'my-paren)
;; sbcl and slime
(setq inferior-lisp-program "/usr/local/bin/sbcl")
(add-to-list 'load-path "~/slime")
(require 'slime-autoloads)
;;slime-bannerSLIME
;(eval-after-load "slime" (slime-setup '(slime-repl slime-fancy slime-banner slime-editing-commands)))
;;
(setq slime-net-coding-system 'utf-8-unix)
;;
(setq indent-tabs-mode t)
(global-set-key "\C-m" 'newline-and-indent) ;;Return
(global-set-key "\C-j" 'newline)
;;
(put 'narrow-to-region 'disabled nil)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment