Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

147 lines (117 sloc) 4.445 kb
;-*-Emacs-Lisp-*-
;(setq mac-option-modifier 'alt)
;; Delete selection mode -- Treats selection like programs other than emacs
(delete-selection-mode 1)
(blink-cursor-mode 1)
(defun reload-keys ()
(interactive)
(load-file "~/.emacs.d/.keys"))
(defun reload-emacs ()
(interactive)
(load-file "~/.emacs.d/init.el"))
(defun vi-open-line-above ()
"Insert a newline above the current line and put point at beginning."
(interactive)
(unless (bolp)
(beginning-of-line))
(newline)
(forward-line -1)
(indent-according-to-mode))
(defun vi-open-line-below ()
"Insert a newline below the current line and put point at beginning."
(interactive)
(unless (eolp)
(end-of-line))
(newline-and-indent))
(defun vi-open-line (&optional abovep)
"Insert a newline below the current line and put point at beginning.
With a prefix argument, insert a newline above the current line."
(interactive "P")
(if abovep
(vi-open-line-above)
(vi-open-line-below)))
;Text Surgery
(defun nap-copy-line ()
"Copy current line into kill ring"
(interactive)
(kill-ring-save (line-beginning-position)
(line-beginning-position 2))
(message "Line copied."))
;(define-prefix-command 'text-surgery)
;(global-set-key (kbd "C-i") 'text-surgery)
;(define-key text-surgery (kbd "C-l") 'nap-copy-line)
;(global-set-key (kbd "C-y") 'nap-copy-line)
;(global-set-key (kbd "C-w") 'nap-copy-line)
;(global-set-key (kbd "C-p") 'clipboard-yank)
;(global-set-key (kbd "C-c C-w") 'mark-word)
;(global-set-key (kbd "C-.") 'increase-left-margin)
;(global-set-key (kbd "C-,") 'decrease-left-margin)
;Project Ops
(global-set-key (kbd "C-s-t") 'find-file-in-project)
;Window Operations
;(define-prefix-command 'window-ops)
;(global-set-key (kbd "C-w") 'window-ops)
;(define-key window-ops (kbd "k") 'windmove-up)
;(define-key window-ops (kbd "j") 'windmove-down)
;(define-key window-ops (kbd "h") 'windmove-left)
;(define-key window-ops (kbd "l") 'windmove-right)
;; Movement
;(define-prefix-command 'text-movement)
;(global-set-key (kbd "C-j") 'next-line)
;(global-set-key (kbd "C-k") 'previous-line)
;(global-set-key (kbd "A-C-l") 'forward-char)
;(global-set-key (kbd "A-C-h") 'backward-char)
;(global-set-key (kbd "C-l") 'forward-word)
;(global-set-key (kbd "C-h") 'backward-word)
;(global-set-key (kbd "A-C-j") 'next-line)
;(global-set-key (kbd "A-C-k") 'previous-line)
;(global-set-key (kbd "C-n") 'scroll-up)
;(global-set-key (kbd "C-u") 'scroll-down)
;Smooth Mouse Scrolling
(setq mouse-wheel-scroll-amount '(2 ((shift) . 1))) ;; one line at a time
(setq mouse-wheel-progressive-speed nil) ;; don't accelerate scrolling
(setq mouse-wheel-follow-mosue 't) ;; scroll window under mouse
(setq scroll-step 1) ;; keyboard scroll one line at a time
(defun indent-or-expand (arg)
"Either indent or expand based on context"
(interactive "*P")
(if (and
(or (bobp) (= ?w (char-syntax (char-before))))
(or (eobp) (not (= ?w (char-syntax (char-after))))))
(dabbrev-expand arg)
(indent-according-to-mode)))
(defun my-tab-fix ()
(local-set-key [tab] 'indent-or-expand))
(add-hook 'c-mode-hook 'my-tab-fix)
(add-hook 'sh-mode-hook 'my-tab-fix)
(add-hook 'emacs-lisp-mode-hook 'my-tab-fix)
(add-hook 'fundamental-mode-hook 'my-tab-fix)
(add-hook 'clojure-mode-hook 'my-tab-fix)
;(global-set-key (kbd "A-o") 'scroll-down)
;(global-set-key (kbd "A-l") 'scroll-up)
(global-set-key (kbd "s-r") 'slime-eval-defun)
;(global-set-key (kbd "C-o") 'vi-open-line-below)
(define-prefix-command 'emacs-lisp-ops)
(global-set-key (kbd "C-9") 'emacs-lisp-ops)
(define-key emacs-lisp-ops (kbd "C-d") 'eval-defun)
(define-key emacs-lisp-ops (kbd "C-e") 'eval-buffer)
(define-key emacs-lisp-ops (kbd "C-r") 'eval-defun)
(define-key emacs-lisp-ops (kbd "C-w") 'my-theme-cycle)
(define-key emacs-lisp-ops (kbd "C-k") 'reload-keys)
(define-key emacs-lisp-ops (kbd "C-m") 'reload-emacs)
;Project
(define-prefix-command 'project-opts)
(global-set-key (kbd "C-0") 'project-opts)
(define-key project-opts (kbd "C-0") 'anything)
(define-key project-opts (kbd "C-o") 'open-firefox)
(define-key project-opts (kbd "C-r") 'slime-eval-buffer)
(global-set-key (kbd "s-r") 'slime-eval-defun)
(defun exec-and-open-firefox ()
(interactive)
(slime-eval-defun)
(open-firefox))
(defun open-firefox ()
"Open Firefox"
(interactive)
(shell-command "open http://localhost:8080"))
(global-set-key (kbd "C-\\") 'indent-region)
Jump to Line
Something went wrong with that request. Please try again.