Skip to content


Browse files Browse the repository at this point in the history
Literally start over.
  • Loading branch information
mpereira committed Jan 29, 2017
1 parent 3ccb1ed commit 30024f9
Show file tree
Hide file tree
Showing 9 changed files with 268 additions and 115 deletions.
9 changes: 7 additions & 2 deletions .gitignore
@@ -1,2 +1,7 @@
15 changes: 0 additions & 15 deletions .gitmodules

This file was deleted.

296 changes: 261 additions & 35 deletions init.el
@@ -1,48 +1,274 @@
(setq package-archives '(("ELPA" . "")
("gnu" . "")
("marmalade" . "")))
(require 'package)

(when (load (expand-file-name "~/.emacs.d/packages/elpa/package.el"))

(add-to-list 'load-path "~/.emacs.d/")
(require 'mpereira-defuns)
(add-to-list 'package-archives '("melpa" . ""))

;; Paredit.
(add-to-list 'load-path "~/.emacs.d/packages/paredit")
(require 'paredit)
(paredit-mode t)
(unless package-archive-contents

;; Lose the UI.
(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))
(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
(if (fboundp 'menu-bar-mode) (menu-bar-mode -1))
(unless (package-installed-p 'use-package)
(package-install 'use-package))

;; Quiel startup.
(require 'use-package))

;; Color theme ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(use-package ample-theme
:ensure t
(add-hook 'after-init-hook (lambda () (load-theme 'ample t))))

;; Helper functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun describe-thing-at-point ()
"Show the documentation of the Elisp function and variable near point.
This checks in turn:
-- for a function name where point is
-- for a variable name where point is
-- for a surrounding function call"
(let (sym)
(cond ((setq sym (ignore-errors
(with-syntax-table emacs-lisp-mode-syntax-table
(or (not (zerop (skip-syntax-backward "_w")))
(eq (char-syntax (char-after (point))) ?w)
(eq (char-syntax (char-after (point))) ?_)
(forward-sexp -1))
(skip-chars-forward "`'")
(let ((obj (read (current-buffer))))
(and (symbolp obj) (fboundp obj) obj))))))
(describe-function sym))
((setq sym (variable-at-point)) (describe-variable sym))
((setq sym (function-at-point)) (describe-function sym)))))

;; FIXME: popup is showing at random positions.
;; FIXME: help-xref-interned creates a help buffer.
(defun describe-thing-at-point-in-popup ()
(let* ((thing (symbol-at-point))
(help-xref-following t)
(content (with-temp-buffer
(help-xref-interned thing)
(pos-tip-show content nil nil nil 999)))

;; Options ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(menu-bar-mode -1)
(scroll-bar-mode -1)
(tool-bar-mode -1)
(setq inhibit-startup-echo-area-message t)
(setq inhibit-startup-message t)

(global-font-lock-mode t)
(require 'linum)
(add-hook 'prog-mode-hook 'linum-mode)

(require 'uniquify)
(setq uniquify-buffer-name-style 'forward)

(require 'saveplace)
(setq-default save-place t)

(require 'whitespace)
(setq whitespace-style '(face lines-tail trailing))
(global-whitespace-mode t)
(setq-default show-trailing-whitespace t)

(setq-default indent-tabs-mode nil)
(setq-default tab-width 2)
(setq select-enable-clipboard t
select-enable-primary t
save-interprogram-paste-before-kill t
apropos-do-all t
mouse-yank-at-point t
require-final-newline t
load-prefer-newer t
save-place-file (concat user-emacs-directory "places")
backup-directory-alist `(("." . ,(concat user-emacs-directory

;; general ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(use-package general
:ensure t)

;; pos-tip ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(use-package pos-tip
:ensure t)

;; aggresssive-indent ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(use-package aggressive-indent
:ensure t
(add-hook 'prog-mode-hook 'aggressive-indent-mode))

;; Lispy ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(use-package lispy
:ensure t
(add-hook 'emacs-lisp-mode-hook 'lispy-mode))

;; Lispyville ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(use-package lispyville
:ensure t
:after evil lispy
(add-hook 'lispy-mode-hook 'lispyville-mode)

(evil-define-key 'normal global-map
(kbd "y") 'lispyville-yank
(kbd "d") 'lispyville-delete
(kbd "c") 'lispyville-change
(kbd "x") 'lispyville-delete-char-or-splice
(kbd "Y") 'lispyville-yank-line
(kbd "D") 'lispy-kill
(kbd "C") 'lispyville-change-line
(kbd "X") 'lispyville-delete-char-or-splice-backwards
(kbd "B") 'lispyville-backward-sexp
(kbd "W") 'lispyville-forward-sexp
(kbd "(") 'lispyville-backward-up-list
(kbd ")") 'lispyville-up-list
;; FIXME: barfs and slurps
(kbd ">)") 'lispyville->
(kbd "<)") 'lispyville-<
(kbd "<(") 'lispy-slurp
(kbd ">(") 'lispy-barf
(kbd "|") 'lispy-split
(kbd "_") 'lispy-join
(kbd "<f") 'lispyville-move-up
(kbd ">f") 'lispyville-move-down)

(evil-define-key 'visual global-map
(kbd "y") 'lispyville-yank
(kbd "d") 'lispyville-delete
(kbd "c") 'lispyville-change
(kbd "Y") 'lispyville-yank-line
(kbd "D") 'lispy-kill
(kbd "C") 'lispyville-change-line
(kbd "B") 'lispyville-backward-sexp
(kbd "W") 'lispyville-forward-sexp
(kbd "(") 'lispyville-backward-up-list
(kbd ")") 'lispyville-up-list)

(evil-define-key 'insert global-map
(kbd "ESC") 'lispyville-normal-state)

"R" 'lispy-raise-sexp))

;; Auto-Complete ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(use-package auto-complete
:ensure t
(ac-set-trigger-key "TAB")
(setq ac-auto-start nil)
(setq ac-use-quick-help t)
(setq ac-quick-help-delay 0.5)
(setq ac-use-menu-map t)
(define-key ac-menu-map "\C-j" 'ac-next)
(define-key ac-menu-map "\C-k" 'ac-previous))

;; Which-key ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(use-package which-key
:ensure t)

;; Magit ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(use-package magit
:ensure t
:after evil-leader
"gs" 'magit-status))

;; Evil ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(use-package evil
:ensure t
(setq evil-extra-operator-eval-key (kbd "ge"))
(add-hook 'prog-mode-hook 'evil-extra-operator-mode)

(lambda ()
(setq evil-motion-state-modes (append evil-emacs-state-modes
(setq evil-emacs-state-modes nil)

(setq evil-shift-width 2)

(define-key evil-normal-state-map (kbd ";") 'evil-ex)
(define-key evil-normal-state-map (kbd ":") 'evil-repeat-find-char)

(evil-define-key 'normal global-map
(kbd "C-h") 'evil-window-left
(kbd "C-j") 'evil-window-down
(kbd "C-k") 'evil-window-up
(kbd "C-l") 'evil-window-right
(kbd "C-S-k") 'describe-thing-at-point
(kbd "K") 'describe-thing-at-point-in-popup)))

(lambda ()
(evil-add-hjkl-bindings occur-mode-map 'emacs
(kbd "/") 'evil-search-forward
(kbd "j") 'evil-search-next
(kbd "k") 'evil-search-previous
(kbd "C-d") 'evil-scroll-down
(kbd "C-u") 'evil-scroll-up
(kbd "C-w C-w") 'other-window)))

(evil-mode t)

;; Show line numbers.
(global-linum-mode t)
;; Show column number.
(column-number-mode 1)
;; Highlight matching parentheses when the point is on them.
(show-paren-mode 1)
(use-package evil-magit
:after magit
:ensure t)

;; Don't use tabs for indentation.
(setq c-basic-indent 2)
(setq tab-width 2)
(setq indent-tabs-mode nil)
(use-package evil-escape
:ensure t)

;; Give a boost to emacs's poor completion engine.
(setq ido-enable-flex-matching t)
(setq ido-everywhere t)
(ido-mode 1)
(use-package evil-nerd-commenter
:ensure t
(evil-define-key 'normal global-map
(kbd "gc") 'evilnc-comment-operator))

(setq whitespace-style '(face trailing lines-tail tabs tabs-mark))
(global-whitespace-mode 1)
(use-package evil-surround
:ensure t
(global-evil-surround-mode t))

(require 'mpereira-evil)
(require 'mpereira-erlang)
(use-package evil-leader
:ensure t
(evil-leader/set-leader ",")
"," 'mode-line-other-buffer
"dk" 'describe-key
"df" 'describe-function
"dv" 'describe-variable
"b" 'switch-to-buffer
"w" 'save-buffer
"q" 'evil-quit
"hs" 'split-window-vertically
"vs" 'split-window-horizontally)))
10 changes: 0 additions & 10 deletions mpereira-defuns.el

This file was deleted.

23 changes: 0 additions & 23 deletions mpereira-erlang.el

This file was deleted.

26 changes: 0 additions & 26 deletions mpereira-evil.el

This file was deleted.

0 comments on commit 30024f9

Please sign in to comment.