From 99f8be1b71fc89d75ad8bb377e6befa3492d29fd Mon Sep 17 00:00:00 2001 From: Chris Sexton Date: Sun, 22 Mar 2015 22:57:57 -0400 Subject: [PATCH] Add something evil --- files/init.el | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++ setup.sh | 3 ++ 2 files changed, 93 insertions(+) create mode 100644 files/init.el diff --git a/files/init.el b/files/init.el new file mode 100644 index 0000000..3b7e058 --- /dev/null +++ b/files/init.el @@ -0,0 +1,90 @@ +(require 'package) +(add-to-list 'package-archives + '("melpa" . "http://melpa.milkbox.net/packages/") t) + +;;; from purcell/emacs.d +(defun require-package (package &optional min-version no-refresh) + "Install given PACKAGE, optionally requiring MIN-VERSION. +If NO-REFRESH is non-nil, the available package lists will not be +re-downloaded in order to locate PACKAGE." + (if (package-installed-p package min-version) + t + (if (or (assoc package package-archive-contents) no-refresh) + (package-install package) + (progn + (package-refresh-contents) + (require-package package min-version t))))) + +(package-initialize) + +(require-package 'evil) + +(setq evil-search-module 'evil-search + evil-want-C-u-scroll t + evil-want-C-w-in-emacs-state t) + +(require 'evil) +(evil-mode t) + +;; Remap org-mode meta keys for convenience +(mapcar (lambda (state) + (evil-declare-key state org-mode-map + (kbd "M-l") 'org-metaright + (kbd "M-h") 'org-metaleft + (kbd "M-k") 'org-metaup + (kbd "M-j") 'org-metadown + (kbd "M-L") 'org-shiftmetaright + (kbd "M-H") 'org-shiftmetaleft + (kbd "M-K") 'org-shiftmetaup + (kbd "M-J") 'org-shiftmetadown)) + '(normal insert)) + +(defun my-20-lines-down () + (interactive) + (evil-next-line 20)) + +(defun my-20-lines-up () + (interactive) + (evil-previous-line 20)) + +(define-key evil-normal-state-map "H" 'my-20-lines-down) +(define-key evil-normal-state-map "T" 'my-20-lines-up) + +(define-key evil-visual-state-map "d" 'evil-backward-char) +(define-key evil-visual-state-map "h" 'evil-next-line) +(define-key evil-visual-state-map "t" 'evil-previous-line) +(define-key evil-visual-state-map "n" 'evil-forward-char) +(define-key evil-normal-state-map "j" 'kill-line) + +(define-key evil-normal-state-map "H" 'my-20-lines-down) +(define-key evil-normal-state-map "T" 'my-20-lines-up) + +(define-key evil-normal-state-map "d" 'evil-backward-char) +(define-key evil-normal-state-map "h" 'evil-next-line) +(define-key evil-normal-state-map "t" 'evil-previous-line) +(define-key evil-normal-state-map "n" 'evil-forward-char) +(define-key evil-normal-state-map "j" 'kill-line) +(define-key evil-normal-state-map "l" 'evil-next-match) +(define-key evil-normal-state-map "L" 'evil-previous-match) +(define-key evil-normal-state-map "-" 'evil-end-of-line) +(define-key evil-normal-state-map "_" 'evil-first-non-blank) + +(custom-set-variables + ;; custom-set-variables was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + '(display-battery-mode t) + '(scroll-bar-mode nil) + '(tool-bar-mode nil)) +(custom-set-faces + ;; custom-set-faces was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + ) + +(global-set-key "\C-cl" 'org-store-link) +(global-set-key "\C-cc" 'org-capture) +(global-set-key "\C-ca" 'org-agenda) +(global-set-key "\C-cb" 'org-iswitchb) diff --git a/setup.sh b/setup.sh index 42038a4..6cc8add 100755 --- a/setup.sh +++ b/setup.sh @@ -139,6 +139,9 @@ cat "$DOTFILES"/files/tmux.sh > "$HOME"/bin/tmux.sh mkdir -p "$HOME"/.irssi <"$DOTFILES"/files/irssiconfig sed -e "s/%PASSWORD%/$IRCPASS/" | sed -e "s/%NICK%/$IRCNICK/" | sed -e "s/%SERVER%/$IRCSERVER/" | sed -e "s/%PORT%/$IRCPORT/" > "$HOME"/.irssi/config +mkdir -p "$HOME"/.emacs.d +cat "$DOTFILES"/files/init.el > "$HOME"/.emacs.d/init.el + if [[ ! -L "$HOME"/bin/setup.sh ]]; then ln -s "$DOTFILES"/setup.sh "$HOME"/bin fi