From: James Bunton Date: Fri, 24 Jun 2016 17:25:56 +0000 (+1000) Subject: switch from vim, simplify vim config a little X-Git-Url: https://code.delx.au/dotemacs/commitdiff_plain/6d652b9dee7924a09306ce59a016367d0877020d switch from vim, simplify vim config a little --- 6d652b9dee7924a09306ce59a016367d0877020d diff --git a/README.md b/README.md new file mode 100644 index 0000000..c00cbf8 --- /dev/null +++ b/README.md @@ -0,0 +1,102 @@ +# General commands +C-x C-c Quit Emacs +C-x C-s Save current buffer +C-g Cancel command +M-x Execute command +C-/ Undo +C-g C-/ Undo undo +C-x z Repeat last command +M-X 'eval-buffer Load current buffer as elisp + +# Help +C-h C-h Help +C-h k Help about key binding +C-h v Describe variable +C-h f Describe function + +# Search +C-M-s Regex search +C-s Search forward +C-r Search backward +M-s . Search for symbol around point +M-s w Start word search +C-s Find next item (while searching) +Backspace Previous search (while searching) +M-% Search and replace + +# Buffers/windows/frames +C-x s Save some buffers +C-x C-f Find (open) file +C-x k Kill buffer +C-x b Select named buffer +C-x C-b Show all buffers +C-x o Switch to other window +C-x 1 Switch to single window +C-x 2 Split vertically +C-x 3 Split horizontally +M-x 'make-frame New frame (X11 window) +M-= Display info about region + +# Text formatting +M-/ Auto-complete +M-; Comment line or region +M-q Reformat paragraph +M-l Lower case word +M-u Upper case word +M-c Capitalise word +C-x C-l Lower case region +C-x C-u Upper case region + +# Macros +F3 , F4 Start recording macro +C-u F3 Play last macro then append keys +F4 Play back macro + +# Selecting/deleting/killing text +C-Space Set mark (start selection) +C-Space C-Space Set mark to point +C-u C-space Return to mark +C-M-p Back to start of balanced expression +C-M-n Forward to end of balanced expression +M-@ Set mark at end of next word +C-w Kill from mark to point +C-y Yank text (paste) +M-y Scroll through kill ring (paste buffer) +M-z Kill until +C-k Kill rest of line +C-M-k Kill balanced expression +C-S-Backspace Delete current line +C-d Delete next character +M-d Delete next word +M-Backspace Delete previous word +M-Space Collpase to one space around point +M-\ Delete spaces around point +C-x C-o Collapse blank lines +'# delete-trailing-whitespace + +# Lines +C-o Insert new line at point +C-j Newline and maybe indent +M-^ Join to previous line + +# Movement +M-m Jump back to start of indentation +M-r Jump to window top/bottom/middle +M-g M-g Jump to line +M-g Tab Jump to column +C-a Beginning of line +C-e End of line +C-p Back one line +C-n Forward one line +C-b Back one character +C-n Forward one character +M-b Back a word +M-f Forward a word +M-a Backward sentence +M-e Forward sentence +M-v Back page +C-v Forward page +M-{ Back one paragraph +M-} Forward one paragraph +M-< Top of file +M-> End of file \ No newline at end of file diff --git a/backups.el b/backups.el new file mode 100644 index 0000000..cb56fa9 --- /dev/null +++ b/backups.el @@ -0,0 +1,6 @@ +(setq backup-directory-alist '(("." . "~/tmp/emacsbak"))) +(setq backup-by-copying t) +(setq delete-old-versions t) +(setq version-control t) +(setq kept-new-versions 10) +(setq kept-old-versions 0) diff --git a/display.el b/display.el new file mode 100644 index 0000000..5c6ae21 --- /dev/null +++ b/display.el @@ -0,0 +1,14 @@ +(load-theme 'deeper-blue) + +(menu-bar-mode -1) +(tool-bar-mode -1) +(scroll-bar-mode -1) + +(setq scroll-conservatively 1) +(setq scroll-margin 1) + +(setq column-number-mode t) + +(show-paren-mode t) + +(setq show-trailing-whitespace t) diff --git a/init.el b/init.el new file mode 100644 index 0000000..d06d658 --- /dev/null +++ b/init.el @@ -0,0 +1,5 @@ +(load "~/.emacs.d/backups.el") +(load "~/.emacs.d/packages.el") +(load "~/.emacs.d/display.el") +(load "~/.emacs.d/keys.el") +(load "~/.emacs.d/modes.el") diff --git a/keys.el b/keys.el new file mode 100644 index 0000000..a8178f9 --- /dev/null +++ b/keys.el @@ -0,0 +1,21 @@ +(global-set-key (kbd "") 'windmove-up) +(global-set-key (kbd "") 'windmove-down) +(global-set-key (kbd "") 'windmove-left) +(global-set-key (kbd "") 'windmove-right) + + +(global-set-key (kbd "M-;") 'toggle-comment-on-line) +(defun toggle-comment-on-line () + (interactive) + (if (and mark-active transient-mark-mode) + (comment-or-uncomment-region (region-beginning) (region-end)) + (comment-or-uncomment-region (line-beginning-position) (line-end-position))) + (next-line)) + + +(setq mouse-wheel-scroll-amount '(3)) +(setq mouse-wheel-progressive-speed nil) + + +(setq read-file-name-completion-ignore-case t) +(setq read-buffer-completion-ignore-case t) diff --git a/modes.el b/modes.el new file mode 100644 index 0000000..640fe44 --- /dev/null +++ b/modes.el @@ -0,0 +1,14 @@ +(setq-default indent-tabs-mode nil) +(setq-default c-basic-offset 4) + +(add-hook 'text-mode-hook 'flyspell-mode) +(add-hook 'prog-mode-hook 'flyspell-prog-mode) + +(require 'saveplace) +(setq save-place-file "~/.emacs.d/save-place-file") +(setq-default save-place t) + +(require 'golden-ratio) +(golden-ratio-mode) + +(server-start) diff --git a/packages.el b/packages.el new file mode 100644 index 0000000..88ed801 --- /dev/null +++ b/packages.el @@ -0,0 +1,18 @@ +(require 'package) + +(add-to-list 'package-archives + '("melpa-stable" . "https://stable.melpa.org/packages/")) + +(package-initialize) + +(if (not (file-exists-p package-user-dir)) + (package-refresh-contents)) + +(defun ensure-package-installed (package) + (if (not (package-installed-p package)) + (if (y-or-n-p (format "Package %s is missing. Install it? " package)) + (package-install package)))) + +(ensure-package-installed 'markdown-mode) +(ensure-package-installed 'haskell-mode) +(ensure-package-installed 'golden-ratio)