PPaste!

Thooms emacs conf

Home - All the pastes - Authored by Thooms

Raw version

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
;; Set user infos
(setq user-full-name "Thomas Papillon")
(setq user-mail-address "tp@irrealis.me")

;; Ask "y" or "n" instead of "yes" or "no". Yes, laziness is great.
(fset 'yes-or-no-p 'y-or-n-p)

;; Highlight corresponding parentheses when cursor is on one
(show-paren-mode t)

;; Highlight tabulations
(setq-default highlight-tabs t)

;; Show trailing white spaces
(setq-default show-trailing-whitespace t)

;; Remove useless whitespace before saving a file
(add-hook 'before-save-hook 'whitespace-cleanup)
(add-hook 'before-save-hook (lambda() (delete-trailing-whitespace)))

;; Final newline handling
(setq require-final-newline t)

;; Save backup files in a dedicated directory
(setq backup-directory-alist '(("." . "~/.saves")))

;; Set locale to UTF8
(set-language-environment 'utf-8)
(set-terminal-coding-system 'utf-8)
(setq locale-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-selection-coding-system 'utf-8)
(prefer-coding-system 'utf-8)

;;;;;;;;; Package management

;; Add package sources
(package-initialize)
(setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/")
			 ("marmalade" . "https://marmalade-repo.org/packages/")
			 ("melpa" . "https://melpa.org/packages/")))
;; Define user packages
(defvar thooms/packages
  '(
    hipster-theme ; Cool theme
    autopair ; Auto delimiter closing
    company ; Autocompletion framework
    flycheck ; Syntax checking
    helm
    projectile
    helm-projectile
    helm-ag
    smart-mode-line

    scala-mode
    web-mode
    markdown-mode
    haskell-mode
    ;ghc-mod
    ;company-ghc
    )
  "Hallo"
  )

;; Sync packages
(defun thooms/packages-installed-p ()
  (loop for pkg in thooms/packages
	when (not (package-installed-p pkg)) do (return nil)
	finally (return t)))

(unless (thooms/packages-installed-p)
  (message "%s" "Refreshing package database...")
  (package-refresh-contents)
  (dolist (pkg thooms/packages)
    (when (not (package-installed-p pkg))
      (package-install pkg))))

;; Global mode start
(add-hook 'after-init-hook 'global-company-mode)
(autopair-global-mode)
(global-flycheck-mode)

;; Editor mods
(setq inhibit-splash-screen t
      initial-scratch-message nil)
(scroll-bar-mode -1)
(tool-bar-mode -1)
(menu-bar-mode -1)
(setq column-number-mode t)

;; Sets theme and fonts
(defun frame-config (frame)
  "Custom behavior on new frames"
  (with-selected-frame frame
    (when (display-graphic-p)
      (setq frame-title-format '(buffer-file-name "%f" ("%b")))
      (set-face-attribute 'default nil
			  :font "Consolas-12"))
    (if (display-graphic-p)
	(load-theme 'hipster t)
      (load-theme 'hipster t))))
(frame-config (selected-frame))
(add-hook 'after-make-frame-functions 'frame-config)

;; Helm and projectile conf
(require 'helm-config)
(helm-mode 1)
(helm-autoresize-mode 1)
(global-set-key (kbd "M-x") 'helm-M-x)
(global-set-key (kbd "C-x C-f") 'helm-find-files)
(global-set-key (kbd "C-x C-b") 'helm-buffers-list)

(projectile-global-mode)
(helm-projectile-on)
(setq projectile-completion-system 'helm)

;; Smartmodeline conf
(setq sml/no-confirm-load-theme t)
(setq sml/theme 'dark)
(sml/setup)