Last active
November 15, 2018 02:34
-
-
Save Darfk/1811023 to your computer and use it in GitHub Desktop.
Tom's init.el
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Tom's .emacs file or How to have a good time using emacs. | |
;; 2018 Edition | |
(require 'package) | |
(add-to-list 'package-archives | |
'("melpa-stable" . "https://stable.melpa.org/packages/")) | |
(add-to-list 'package-archives | |
'("melpa" . "https://melpa.org/packages/")) | |
(package-initialize) | |
(defun ask-before-closing () | |
(interactive) | |
(if window-system | |
(progn (if (y-or-n-p (format "Really close? ")) | |
(kill-emacs))) | |
(kill-emacs))) | |
(load-theme 'tango-dark) | |
;; Revert buffer function | |
(defun revert-buffer-force () | |
(interactive) | |
(revert-buffer t t t)) | |
;; Modes | |
(ido-mode) | |
(menu-bar-mode -1) | |
(tool-bar-mode -1) | |
;; The default tab-width for go is 8! No thanks. | |
(add-hook | |
'go-mode-hook | |
(lambda () | |
(set-variable 'tab-width 2) | |
(local-set-key (kbd "C-c C-f") 'gofmt))) | |
;; Comment or Uncomment region if region exists else C/UC line | |
(defun comment-or-uncomment-region-or-line () | |
"Comments or uncomments the region or the current line if there's no active region." | |
(interactive) | |
(let (beg end) | |
(if (region-active-p) | |
(setq beg (region-beginning) end (region-end)) | |
(setq beg (line-beginning-position) end (line-end-position))) | |
(comment-or-uncomment-region beg end))) | |
;; Delete selection mode | |
(delete-selection-mode 1) | |
(global-set-key (kbd "C-x C-c") 'ask-before-closing) | |
(global-set-key (kbd "M-p") 'backward-paragraph) | |
(global-set-key (kbd "M-n") 'forward-paragraph) | |
(global-set-key (kbd "C-x C-b") 'buffer-menu) | |
(global-set-key (kbd "C-?") 'help-command) | |
(global-set-key (kbd "C-h") 'delete-backward-char) | |
(global-set-key (kbd "C-M-h") 'backward-kill-word) | |
(global-set-key (kbd "C-x C-SPC") 'pop-to-mark-command) | |
(global-set-key (kbd "C-c C-r") 'revert-buffer-force) | |
(global-set-key (kbd "C-\\") 'comment-or-uncomment-region-or-line) | |
(global-set-key (kbd "M-/") 'hippie-expand) | |
(put 'upcase-region 'disabled nil) | |
(put 'downcase-region 'disabled nil) | |
(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 | |
["#212526" "#ff4b4b" "#b4fa70" "#fce94f" "#729fcf" "#e090d7" "#8cc4ff" "#eeeeec"]) | |
'(custom-enabled-themes (quote (tango-light))) | |
'(hippie-expand-dabbrev-as-symbol nil) | |
'(ido-auto-merge-delay-time 0.8) | |
'(ido-enable-flex-matching t) | |
'(inhibit-startup-screen t) | |
'(make-backup-files nil) | |
'(package-selected-packages (quote (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. | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment