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

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)