Skip to content

Instantly share code, notes, and snippets.

Last active Sep 9, 2016
What would you like to do?
;; Useful stuff for .emacs
;; Key-bindings
(global-set-key (kbd "C-x C-b") 'ibuffer)
(global-set-key (kbd "C-c C-q") 'comment-or-uncomment-region)
;; Variables
;; No tabs goddamnit
(setq-default indent-tabs-mode nil)
;; Prefer to split vertically
(setq split-height-threshold nil)
(setq split-width-threshold 0)
;; Get rid of annoying help screen if on by default
(setq inhibit-startup-screen t)
;; Set up MELPA
(require 'package)
(add-to-list 'package-archives '("melpa" . "") t)
;; Set encoding for open/save explicitly. Necessary for Windows, or you might get Latin-1
(set-language-environment "UTF-8")
(prefer-coding-system 'utf-8-unix)
(setq-default buffer-file-coding-system 'utf-8-unix)
;; Mac specific
;; Set proper user environment
(when (memq window-system '(mac ns))
;; Set proper user environment
;; Fix left ALT button on Mac
(setq ns-right-alternate-modifier nil))
;; Package configuration
;; Bootstrap use-package
(unless (package-installed-p 'use-package)
(package-install 'use-package))
;; helm
(use-package helm
:init (progn
(require 'helm-config)
(require 'helm-ls-git))
:bind (("M-x" . helm-M-x)
("M-y" . helm-show-kill-ring)))
;; helm-projectile
(use-package helm-projectile
:init (progn
(setq projectile-completion-system 'helm)
(setq projectile-use-git-grep 1)))
;; helm-swoop
(use-package helm-swoop
:bind ("C-S-s" . helm-swoop))
;; flycheck
(use-package flycheck
:init (global-flycheck-mode))
;; avy
(use-package avy
:ensure t
:init (setq avy-background t)
:bind (("M-s" . avy-goto-word-1)))
;; Various
;; Delete trailing whitespace when saving
(add-hook 'before-save-hook 'delete-trailing-whitespace)
;; Highlight matching parenthesis
(add-hook 'prog-mode-hook 'show-paren-mode)
;; Theme
;; Use solarized from
(add-to-list 'custom-theme-load-path "~/.emacs.d/emacs-color-theme-solarized/")
(setq frame-background-mode (quote dark))
(load-theme 'solarized t)
;; Add/Overwrite some faces for solarized
'(helm-match ((t (:inherit match :inverse-video nil))))
'(helm-header ((t (:inherit header-line
:height 1.2))))
'(helm-selection ((t (:background "ForestGreen" :foreground "black" :inverse-video nil))))
'(helm-source-header ((t (:foreground "#b2d7ff" :background nil
:weight bold))))
'(helm-swoop-target-word-face ((t (:inherit helm-match))))
'(helm-swoop-target-line-face ((t (:inherit helm-selection))))
'(avy-lead-face ((t (:foreground "#e52b50"))))
'(avy-lead-face-0 ((t (:foreground "white"))))
'(avy-lead-face-1 ((t (:foreground "#4f57f9"))))
'(avy-lead-face-2 ((t (:foreground "#f86bf3")))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment