;;; package --- Summary ;;; Commentary: (require 'package) ;; you might already have this line ;;; Code: (add-to-list 'package-archives '("MELPHA Stable" . "https://stable.melpa.org/packages/")) (when (< emacs-major-version 24) ;; For important compatibility libraries like cl-lib (add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/"))) (package-initialize) ;; You might already have this line (setq-default tab-width 2) (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. '(ansi-color-names-vector ["#242424" "#e5786d" "#95e454" "#cae682" "#8ac6f2" "#333366" "#ccaa8f" "#f6f3e8"]) '(custom-enabled-themes (quote (tsdh-dark))) '(package-selected-packages (quote (shackle fastnav nhexl-mode expand-region flycheck-yamllint yaml-mode protobuf-mode flycheck go-mode)))) (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. ) (defun switch-to-minibuffer () "Switch to minibuffer window." (interactive) (if (active-minibuffer-window) (select-window (active-minibuffer-window)) (error "Minibuffer is not active"))) (global-set-key "\C-co" 'switch-to-minibuffer) ;; Bind to `C-c o' (add-hook 'after-init-hook #'global-flycheck-mode) (add-to-list 'exec-path "$GOPATH/bin") (add-hook 'before-save-hook 'gofmt-before-save) (setq mac-option-modifier 'meta) ; set alt-key to meta (setq mac-escape-modifier nil) ; set esc-key to ;; This stuff is to ansi-colorize the compilation buffer ;; after a test so the terminal colors come through. (define-derived-mode ansi-compilation-mode compilation-mode "ansi compilation" "Compilation mode that understands ansi colors." (require 'ansi-color) (read-only-mode 0) (ansi-color-apply-on-region (point-min) (point-max))) (defun colorize-compilation (one two) "ansi colorize the compilation buffer." (ansi-compilation-mode) ) (setq compilation-finish-function 'colorize-compilation) (setq scroll-conservatively 101) (setq ns-function-modifier 'super) (global-linum-mode 1) (global-set-key (kbd "C-;") 'er/expand-region) (menu-bar-mode -1) (toggle-scroll-bar -1) (tool-bar-mode -1) (defun move-to-top-window () ;; moves to the top of the window (interactive) (move-to-window-line-top-bottom 0)) (defun move-to-bottom-window () ;; moves to the bottom of the window (interactive) (move-to-window-line-top-bottom -1)) (defun pull-up () (interactive) (move-to-top-window) (recenter)) (defun pull-down () (interactive) (move-to-bottom-window) (recenter)) (global-set-key "\C-c\C-n" 'pull-down) (global-set-key "\C-c\C-p" 'pull-up) (global-set-key "\C-cn" 'move-to-bottom-window) (global-set-key "\C-cp" 'move-to-top-window) (defun kill-line () ;; marks to end of line, kills line, and moves up (interactive) (move-beginning-of-line nil) (set-mark-command nil) (move-end-of-line nil) (kill-region (region-beginning) (region-end)) (backward-delete-char-untabify 1 nil) (forward-line 1)) (global-set-key "\C-c\C-k" 'kill-line) ;; unbind the list buffers command (global-unset-key "\C-x\C-b") ;; potentially makes the minibuffer completion happen at bottm ;;(add-to-list 'special-display-buffer-names '("*Completions*" my-display-completions)) ;; (defun my-display-completions (buf) ;; "put the *completions* buffer in the right spot" ;; (let ((windows (delete (minibuffer-window) (window-list)))) ;; (if (eq 1 (length windows)) ;; (progn ;; (select-window (car windows)) ;; (split-window-vertically))) ;; (let ((target-window (window-at 0 (- (frame-height) 2))) ;; (pop-up-windows t)) ;; (set-window-buffer target-window buf) ;; target-window))) ;; (Customize-set-variable ;; 'display-buffer-alist ;; '(("\\*Completions\\*" display-buffer-pop-up-window))) ;; (setq shackle-rules '(("\\*Completions\\*" :popup t)) ;; shackle-default-rule '(:select t)) (require 'popwin) (popwin-mode 1) (require 'fastnav) (global-set-key "\M-z" 'fastnav-zap-up-to-char-forward) (global-set-key "\M-Z" 'fastnav-zap-up-to-char-backward) (global-set-key "\M-S" 'fastnav-jump-to-char-forward) (global-set-key "\M-s" 'fastnav-jump-to-char-backward) (global-set-key "\M-R" 'fastnav-replace-char-forward) (global-set-key "\M-r" 'fastnav-replace-char-backward) (global-set-key "\M-I" 'fastnav-insert-at-char-forward) (global-set-key "\M-i" 'fastnav-insert-at-char-backward) (global-set-key "\M-J" 'fastnav-execute-at-char-forward) (global-set-key "\M-j" 'fastnav-execute-at-char-backward) (global-set-key "\M-K" 'fastnav-delete-char-forward) (global-set-key "\M-k" 'fastnav-delete-char-backward) (global-set-key "\M-M" 'fastnav-mark-to-char-forward) (global-set-key "\M-m" 'fastnav-mark-to-char-backward) (global-set-key "\M-P" 'fastnav-sprint-forward) (global-set-key "\M-p" 'fastnav-sprint-backward) (provide '.emacs) ;;; .emacs ends here (put 'set-goal-column 'disabled nil) (put 'downcase-region 'disabled nil) (put 'erase-buffer 'disabled nil)