summaryrefslogtreecommitdiffstats
path: root/emacs.d/init.el
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2017-12-09 13:35:59 +0100
committerDavid Robillard <d@drobilla.net>2017-12-09 13:35:59 +0100
commit743cb2e2c0de2b3bc4033a93613fb3e62ce38fed (patch)
treef2569311801173067b319b0234c3b26aeca82481 /emacs.d/init.el
parentf195dbf02045251ca2cfcd1a26ee92dba71940c7 (diff)
parentdac740b2a5f8a9f4c285eac2d014cd5d138fd7ab (diff)
downloaddotfiles-743cb2e2c0de2b3bc4033a93613fb3e62ce38fed.tar.gz
dotfiles-743cb2e2c0de2b3bc4033a93613fb3e62ce38fed.tar.bz2
dotfiles-743cb2e2c0de2b3bc4033a93613fb3e62ce38fed.zip
Merge branch 'master' of ssh://drobilla.net:/home/drobilla/git.drobilla.net/conf
Diffstat (limited to 'emacs.d/init.el')
-rw-r--r--emacs.d/init.el103
1 files changed, 60 insertions, 43 deletions
diff --git a/emacs.d/init.el b/emacs.d/init.el
index 274046f..3d475bf 100644
--- a/emacs.d/init.el
+++ b/emacs.d/init.el
@@ -2,12 +2,15 @@
(add-to-list 'load-path (expand-file-name "~/.emacs.d/site-lisp"))
-;; Fix paths and key bindings on OSX
-(when (equal system-type 'darwin)
- (setenv "PATH" (concat (getenv "PATH") ":/usr/local/bin"))
- (setq exec-path (append exec-path '("/usr/local/bin")))
- (global-set-key [home] 'move-beginning-of-line)
- (global-set-key [end] 'move-end-of-line))
+;; Platform specific configuration
+(cond ((equal system-type 'darwin)
+ (setenv "PATH" (concat (getenv "PATH") ":/usr/local/bin"))
+ (setq exec-path (append exec-path '("/usr/local/bin")))
+ (setq dired-listing-switches "-al")
+ (global-set-key [home] 'move-beginning-of-line)
+ (global-set-key [end] 'move-end-of-line))
+ ((or (equal system-type 'gnu/linux) (equal system-type 'gnu/kfreebsd))
+ (setq dired-listing-switches "-al --time-style=long-iso")))
(setq-default
gc-cons-threshold 10000000
@@ -21,37 +24,39 @@
;;; Packages
(require 'package)
-(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
- ("melpa" . "http://melpa.org/packages/")))
+(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
(package-initialize)
-(setq package-enable-at-startup nil)
-(if (not (package-installed-p 'use-package))
- (progn
- (package-refresh-contents)
- (package-install 'use-package)))
+(unless (package-installed-p 'use-package)
+ (progn
+ (package-refresh-contents)
+ (package-install 'use-package)))
(require 'use-package)
-(use-package ace-window :ensure ace-window)
-(use-package bind-key :ensure bind-key)
-(use-package clang-format :ensure clang-format)
-(use-package counsel :ensure counsel :config (counsel-mode))
-(use-package counsel-projectile :ensure counsel-projectile)
-(use-package diminish :ensure diminish)
-(use-package dired+ :ensure dired+)
-(use-package epl :ensure epl)
-(use-package ivy :ensure ivy :config (ivy-mode))
-(use-package magit :ensure magit)
-(use-package pdf-tools :ensure pdf-tools)
-(use-package pkg-info :ensure pkg-info)
-(use-package powerline :ensure powerline)
-(use-package projectile :ensure projectile :config (projectile-global-mode))
-(use-package smart-tabs-mode :ensure smart-tabs-mode)
-(use-package spaceline :ensure spaceline)
-(use-package spaceline-config :ensure spaceline)
-(use-package swiper :ensure swiper)
-(use-package tramp :ensure tramp)
-(use-package window-numbering :ensure window-numbering)
+(use-package ace-window :ensure t)
+(use-package bind-key :ensure t)
+(use-package clang-format :ensure t)
+(use-package counsel :ensure t :after (ivy) :config (counsel-mode))
+(use-package counsel-gtags :ensure t)
+(use-package counsel-projectile :ensure t :after (counsel projectile))
+(use-package diminish :ensure t)
+(use-package dired+ :ensure t)
+(use-package dired-rainbow :ensure t :after (dired+))
+(use-package flyspell-correct-ivy :ensure t :after (ivy))
+(use-package ggtags :ensure t)
+(use-package ivy :ensure t :config (ivy-mode))
+(use-package llvm-mode :ensure t)
+(use-package magit :ensure t)
+(use-package markdown-mode :ensure t)
+(use-package pdf-tools :ensure t)
+(use-package projectile :ensure t :config (projectile-global-mode))
+(use-package rainbow-delimiters :ensure t)
+(use-package smart-tabs-mode :ensure t)
+(use-package spaceline :ensure t)
+(use-package spaceline-config :after (spaceline) :config (spaceline-spacemacs-theme))
+(use-package swift-mode :ensure t)
+(use-package swiper :ensure t)
+(use-package tramp :ensure t)
;;; Basic editor configuration
@@ -61,7 +66,6 @@
(setq-default tab-width 4)
(setq-default indent-tabs-mode nil)
(setq-default scroll-margin 3)
-(spaceline-emacs-theme)
(spaceline-toggle-buffer-size-off)
(spaceline-toggle-hud-off)
(spaceline-toggle-buffer-encoding-abbrev-off)
@@ -93,9 +97,9 @@
(_ " ?"))))))))
(spaceline-define-segment buffer-position
- "Buffer position in percent, padded to work around spaceline bug"
- (format "%02d%%%% " (/ (* 100 (- (line-number-at-pos) 1))
- (count-lines (point-min) (point-max)))))
+ "Buffer position in percent"
+ (format "%3d%%%%" (/ (* 100 (- (line-number-at-pos) 1))
+ (count-lines (point-min) (point-max)))))
;;; Variables
@@ -114,9 +118,8 @@
'(custom-enabled-themes (quote (drobillized)))
'(custom-safe-themes
(quote
- ("498d05dd285960bd58847dec6e3035978dd8657786ac519bea9c6498112251b3" default)))
+ ("7d43c7d8df6de48944dd8c2dff6fc12083cbca821e161a73d06e4de2a9c210f2" default)))
'(delete-old-versions t)
- '(dired-listing-switches "-al --time-style=long-iso")
'(dired-omit-files "^\\.?#\\|^\\.$\\|^\\.\\.\\|^\\..*$")
'(diredp-hide-details-initially-flag t)
'(diredp-wrap-around-flag nil)
@@ -190,11 +193,12 @@
'(magit-auto-revert-mode nil)
'(magit-diff-refine-hunk (quote all))
'(menu-bar-mode nil)
+ '(ns-use-srgb-colorspace nil)
'(package-selected-packages
(quote
- (auctex clang-format counsel-gtags counsel-projectile dired+ dired-rainbow flyspell-correct-ivy ggtags glsl-mode ivy magit markdown-mode n3-mode pdf-tools projectile spaceline swift-mode use-package)))
+ (rainbow-delimiters auctex clang-format counsel-gtags counsel-projectile dired+ dired-rainbow flyspell-correct-ivy ggtags glsl-mode ivy magit markdown-mode n3-mode pdf-tools projectile spaceline swift-mode use-package)))
'(pdf-view-midnight-colors (quote ("#C3D1D1" . "#141414")))
- '(powerline-default-separator nil)
+ '(powerline-default-separator (quote arrow))
'(projectile-completion-system (quote ivy))
'(projectile-enable-caching t)
'(projectile-mode-line nil)
@@ -209,7 +213,14 @@
'(speedbar-use-images nil)
'(split-window-preferred-function (quote split-window-horizontally))
'(tool-bar-mode nil)
- '(version-control t))
+ '(version-control t)
+ '(visible-bell nil))
+
+(setq ring-bell-function
+ (lambda ()
+ (lexical-let ((fg (face-foreground 'mode-line)))
+ (set-face-foreground 'mode-line "#F2804F")
+ (run-with-idle-timer 0.1 nil (lambda () (set-face-foreground 'mode-line fg))))))
;;; Colours
@@ -261,8 +272,11 @@
;;; Key bindings
+(define-key magit-mode-map (kbd "C-<tab>") 'magit-section-cycle)
+
(global-set-key (kbd "C-<left>") 'previous-buffer)
(global-set-key (kbd "C-<right>") 'next-buffer)
+(global-set-key (kbd "C-<tab>") 'ace-window)
(global-set-key (kbd "C-b") 'compile)
(global-set-key (kbd "C-m") 'newline-and-indent)
(global-set-key (kbd "C-n") 'next-error)
@@ -281,7 +295,6 @@
(global-set-key (kbd "C-c g") 'grep-find)
(global-set-key (kbd "C-c i") 'clang-format-buffer)
(global-set-key (kbd "C-c m") 'magit-status)
-(global-set-key (kbd "C-c o") 'ace-window)
(global-set-key (kbd "C-c r") 'replace-string)
(global-set-key (kbd "C-c s") 'sort-lines)
(global-set-key (kbd "C-c t") 'toggle-truncate-lines)
@@ -290,6 +303,8 @@
;;; File modes
+(add-hook 'prog-mode-hook #'rainbow-delimiters-mode)
+
;; C/C++
(defconst my-c-style
@@ -357,10 +372,12 @@
(auto-fill-mode 1)
(abbrev-mode -1)
(set-fill-column 79)
+ (smart-tabs-mode-enable)
(setq tab-width 4)
(setq indent-tabs-mode t)
(setq truncate-lines t)
(setq show-trailing-whitespace t)
+ (smart-tabs-advice c-indent-line c-basic-offset)
(c-set-style "drobilla"))
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)