Initial working version

This commit is contained in:
Vladan Popovic 2019-12-07 23:09:25 +01:00
commit cc1c1af46e
18 changed files with 288 additions and 0 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "evil"]
path = evil
url = https://github.com/emacs-evil/evil.git

12
LICENCE Normal file
View File

@ -0,0 +1,12 @@
Copyright (c) 2019 by Vladan Popovic <vladanovic@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.

17
README.rst Normal file
View File

@ -0,0 +1,17 @@
My custom emacs configuration
=============================
**IT'S EVIL!!!**
Tested on:
* Rust
* Elm
* Systemd
Installation
============
Clone the repository as ~/.emacs.d/ (not inside it), e.g.::
git clone https://path-to-this-repo.git ~/.emacs.d

23
custom.el Normal file
View File

@ -0,0 +1,23 @@
(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.
'(elm-compile-arguments '("--output=elm-couchapp/_attachments/index.html"))
'(elm-compile-command '("elm make"))
'(elm-format-on-save t)
'(elm-interactive-command '("elm" "repl"))
'(elm-package-command '("elm" "package"))
'(elm-package-json "elm.json")
'(elm-reactor-command '("elm" "reactor"))
'(elm-tags-exclude-elm-stuff nil)
'(elm-tags-on-save 1)
'(package-selected-packages
'(material-theme racer evil-mode helm rust-mode highlight-parentheses-mode merlin forge magit yaml-mode neotree lsp-rust hindent hi2 flycheck-haskell ac-haskell-process lsp-haskell haste haskell-snippets haskell-mode rainbow-identifiers elm-test-runner flycheck-elm elm-mode company ztree ac-etags sqlformat cargo evil)))
;;
(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.
)

1
evil Submodule

@ -0,0 +1 @@
Subproject commit c861d2f6be8207a8919675ce76db583df071b4d5

29
init.el Normal file
View File

@ -0,0 +1,29 @@
;; Load emacs customizations.
;; The customization file shouldn't should be only
(setq custom-file "~/.emacs.d/custom.el")
(load custom-file)
;; Configure emacs packages.
(setq should-install-packages t) ;; Define this before everything to speed up startup.
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
(setq dotfiles-dir (file-name-directory
(or (buffer-file-name) (file-chase-links load-file-name))))
(add-to-list 'load-path (concat dotfiles-dir "modules"))
;; Emacs customization / global plugin configuration
(require 'jenga-company)
(require 'jenga-emacs)
(require 'jenga-evil)
(require 'jenga-helm)
(require 'jenga-magit)
(require 'jenga-org)
(require 'jenga-theme)
;; Custom languages and highlighting
(require 'jenga-elm)
(require 'jenga-rust)
(require 'jenga-systemd)

12
modules/jenga-company.el Normal file
View File

@ -0,0 +1,12 @@
;;;; Company configuration.
(require 'jenga-functions)
(instl 'company)
;; Allign annotations in company auto-complete list.
(setq company-tooltip-align-annotations t)
(add-hook 'after-init-hook 'global-company-mode)
(setq tab-always-indent 'complete)
(add-to-list 'completion-styles 'initials t)
(provide 'jenga-company)

17
modules/jenga-elm.el Normal file
View File

@ -0,0 +1,17 @@
;;;; Elm mode configuration.
(require 'jenga-functions)
(instl 'elm-mode)
(add-hook 'elm-mode-hook #'company-mode)
(add-hook 'elm-mode-hook #'rainbow-delimiters-mode)
(add-hook 'elm-mode-hook (lambda () (setq evil-auto-indent nil)))
;; Turn on Elm mode with *.elm files.
(add-to-list 'auto-mode-alist '("\\.elm\\'" . elm-mode))
(add-to-list 'company-backends 'company-elm)
(setq elm-format-on-save t
elm-tags-on-save t
elm-tags-exclude-elm-stuff nil)
(provide 'jenga-elm)

39
modules/jenga-emacs.el Normal file
View File

@ -0,0 +1,39 @@
;; Persist command history
(savehist-mode 1)
;; Disable the splash screen (to enable it agin, replace the t with 0).
(setq inhibit-splash-screen t)
;; Disable the menu.
(tool-bar-mode -1)
;; Enable transient mark mode.
(transient-mark-mode 1)
;; Highlight paired parentheses when cursor is over one.
(show-paren-mode 1)
;;;; TAGS configuration.
;; Goto tag with M-.
(global-set-key "\M-." 'etags-select-find-tag)
;; Automatically load TAGS file (if exists) when opening emacs.
(let ((my-tags-file (locate-dominating-file default-directory "TAGS")))
(when my-tags-file
(message "Loading tags file: %s" my-tags-file)
(visit-tags-table my-tags-file)))
;;(setq split-height-threshold nil)
;;(setq split-width-threshold 0)
(global-set-key (kbd "S-C-h") 'shrink-window-horizontally)
(global-set-key (kbd "S-C-l") 'enlarge-window-horizontally)
(global-set-key (kbd "S-C-j") 'shrink-window)
(global-set-key (kbd "S-C-k") 'enlarge-window)
(setq-default display-line-numbers-type 'absolute
display-line-numbers-current-absolute t
display-line-numbers-width 4
display-line-numbers-widen t)
(add-hook 'text-mode-hook #'display-line-numbers-mode)
(add-hook 'prog-mode-hook #'display-line-numbers-mode)
(provide 'jenga-emacs)

16
modules/jenga-evil.el Normal file
View File

@ -0,0 +1,16 @@
;;;; Evil mode configuration.
;;(unless (package-installed-p 'evil)
;; (package-refresh-contents)
;; (package-install 'evil))
(add-to-list 'load-path "~/.emacs.d/evil")
(setq evil-want-C-u-scroll t)
;; Enable Evil mode.
(require 'evil)
(evil-mode 1)
(eval-after-load "evil-maps"
;; Unset Evil's "M-." keymap so that TAGS definitions can be followed.
(define-key evil-normal-state-map "\M-." nil))
(provide 'jenga-evil)

View File

@ -0,0 +1,7 @@
(defun instl (pckg)
(unless (and should-install-packages (package-installed-p pckg))
(package-refresh-contents)
(package-install pckg))
(require pckg))
(provide 'jenga-functions)

32
modules/jenga-helm.el Normal file
View File

@ -0,0 +1,32 @@
;;;; Heml mode configuration.
(require 'jenga-functions)
(instl 'helm)
(require 'helm-config)
(helm-mode 1)
(setq helm-autoresize-max-height 0)
(setq helm-autoresize-min-height 20)
(helm-autoresize-mode 1)
;; The default "C-x c" is quite close to "C-x C-c", which quits Emacs.
;; Changed to "C-c h". Note: We must set "C-c h" globally, because we
;; cannot change `helm-command-prefix-key' once `helm-config' is loaded.
(global-set-key (kbd "C-c h") 'helm-command-prefix)
(global-unset-key (kbd "C-x c"))
(define-key helm-map (kbd "<tab>") 'helm-execute-persistent-action) ; rebind tab to run persistent action
(define-key helm-map (kbd "C-i") 'helm-execute-persistent-action) ; make TAB work in terminal
(define-key helm-map (kbd "C-z") 'helm-select-action) ; list actions using C-z
(when (executable-find "firefox")
(setq helm-google-suggest-use-curl-p t))
(setq helm-split-window-in-side-p t ; Open helm buffer inside current window, not occupy whole other window
helm-move-to-line-cycle-in-source t ; Move to end or beginning of source when reaching top or bottom of source.
helm-ff-search-library-in-sexp t ; Search for library in `require' and `declare-function' sexp.
helm-scroll-amount 8 ; Scroll 8 lines other window using M-<next>/M-<prior>
helm-ff-file-name-history-use-recentf t
helm-echo-input-in-header-line t)
(provide 'jenga-helm)

5
modules/jenga-magit.el Normal file
View File

@ -0,0 +1,5 @@
;;;; Magit configuration.
(require 'jenga-functions)
(instl 'magit)
(provide 'jenga-magit)

16
modules/jenga-ocaml.el Normal file
View File

@ -0,0 +1,16 @@
;; OCaml
(let ((opam-share (ignore-errors (car (process-lines "opam" "config" "var" "share")))))
(when (and opam-share (file-directory-p opam-share))
(add-to-list 'load-path (expand-file-name "emacs/site-lisp" opam-share))
(autoload 'merlin-mode "merlin" nil t nil)
(add-hook 'tuareg-mode-hook 'merlin-mode t)
(add-hook 'caml-mode-hook 'merlin-mode t)))
; Make company aware of merlin
(with-eval-after-load 'company
(add-to-list 'company-backends 'merlin-company-backend))
; Enable company on merlin managed buffers
(add-hook 'merlin-mode-hook 'company-mode)
(provide 'jenga-ocaml)

9
modules/jenga-org.el Normal file
View File

@ -0,0 +1,9 @@
;;;; Org mode configuration.
;; Enable Org mode.
(require 'jenga-functions)
(instl 'org)
;; Turn on Org mode on .org files.
(add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
(provide 'jenga-org)

30
modules/jenga-rust.el Normal file
View File

@ -0,0 +1,30 @@
;;;; Rust mode configuration.
;; Add rust load hooks.
(require 'jenga-functions)
(instl 'rust-mode)
(instl 'racer)
(add-hook 'rust-mode-hook #'racer-mode)
(add-hook 'racer-mode-hook #'eldoc-mode)
(add-hook 'racer-mode-hook #'company-mode)
(add-hook 'rust-mode-hook 'cargo-minor-mode)
;; Turn on Rust mode with *.rs files.
(add-to-list 'auto-mode-alist '("\\.rs\\'" . rust-mode))
;; Auto-format with rustfmt on save.
(setq rust-format-on-save t)
;; Show company auto-complete list on *.rs files by pressing TAB.
(define-key rust-mode-map (kbd "TAB") #'company-indent-or-complete-common)
;; Use M-. keybinding to follow tag.
(define-key rust-mode-map (kbd "M-.") 'racer-find-definition)
;; Use M-h keybinding to open symbol documentation.
(define-key rust-mode-map (kbd "M-h") 'racer-describe)
;; Use C-c C-c keybinding to compile with `cargo build`.
(define-key rust-mode-map (kbd "C-c C-b") 'cargo-process-build)
;; Use C-c C-r keybinding to run with `cargo run`.
(define-key rust-mode-map (kbd "C-c C-r") 'cargo-process-run)
;; Use C-c C-t keybinding to test with `cargo test`.
(define-key rust-mode-map (kbd "C-c C-t") 'cargo-process-test)
(provide 'jenga-rust)

13
modules/jenga-systemd.el Normal file
View File

@ -0,0 +1,13 @@
(add-to-list 'auto-mode-alist '("\\.service\\'" . conf-unix-mode))
(add-to-list 'auto-mode-alist '("\\.timer\\'" . conf-unix-mode))
(add-to-list 'auto-mode-alist '("\\.target\\'" . conf-unix-mode))
(add-to-list 'auto-mode-alist '("\\.mount\\'" . conf-unix-mode))
(add-to-list 'auto-mode-alist '("\\.automount\\'" . conf-unix-mode))
(add-to-list 'auto-mode-alist '("\\.slice\\'" . conf-unix-mode))
(add-to-list 'auto-mode-alist '("\\.socket\\'" . conf-unix-mode))
(add-to-list 'auto-mode-alist '("\\.path\\'" . conf-unix-mode))
(add-to-list 'auto-mode-alist '("\\.netdev\\'" . conf-unix-mode))
(add-to-list 'auto-mode-alist '("\\.network\\'" . conf-unix-mode))
(add-to-list 'auto-mode-alist '("\\.link\\'" . conf-unix-mode))
(provide 'jenga-systemd)

7
modules/jenga-theme.el Normal file
View File

@ -0,0 +1,7 @@
;; Use material theme on black background.
(unless (package-installed-p 'material-theme)
(package-refresh-contents)
(package-install 'material-theme))
(require 'material-theme)
(provide 'jenga-theme)