477 lines
12 KiB
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

;; startup
(let ((usr-data (locate-user-emacs-file "data.el")))
(load custom-file)
(load usr-data))
;; mode line
(setq-default mode-line-format
(number-to-string (count-lines (point-min) (point-max))))
;; scrolling
(setq scroll-conservatively 101
scroll-step 1
hscroll-step 1)
(set-scroll-bar-mode nil)
;; `prog-mode'
(add-hook 'prog-mode-hook #'agw-flyspell-prog-mode)
(add-hook 'prog-mode-hook #'prettify-symbols-mode)
(add-hook 'prog-mode-hook #'subword-mode)
;; `text-mode'
(add-hook 'text-mode-hook #'agw-flyspell-prog-mode)
(add-hook 'text-mode-hook #'subword-mode)
;; `hack-local-variables'
(add-hook 'hack-local-variables-hook #'agw-after-local-vars)
;; macros
(setq initial-buffer-choice
(lambda ()
(if (buffer-file-name)
(find-file "~/org/"))))
(add-hook 'emacs-lisp-mode-hook #'agw-fp-mode)
(add-hook 'lisp-mode-hook #'agw-fp-mode)
(add-hook 'reb-lisp-mode-hook #'agw-fp-mode)
(add-hook 'scheme-mode-hook #'agw-fp-mode)
(add-hook 'before-save-hook #'agw-before-save)
(agw-set-key "b d" #'kill-this-buffer)
(agw-set-key "b e" #'ibuffer)
(agw-set-key "m j" #'agw-create-back-link)
(agw-set-key "m k" #'agw-create-memb-link)
(agw-set-key "m l" #'agw-create-mthd-link)
(agw-set-key "a" #'org-archive-to-archive-sibling)
(agw-set-key "A" #'org-force-cycle-archived)
(agw-set-key "k" #'deadgrep)
(global-set-key (kbd "C-x C-<tab>") #'agw-key-map-mode)
;; packages
(require 'package)
(unless (package-installed-p 'use-package)
(package-install 'use-package))
;; theme
(use-package base16-theme
:ensure t
(defvar agw-base16-fira-colors
'(:base00 "#0f0c11" ; default bg
:base01 "#1b161f" ; lighter bg
:base02 "#382c3f" ; selection bg
:base03 "#505170" ; comments
:base04 "#8d6f9f" ; dark fg
:base05 "#ffffff" ; default fg, caret, delims, ops
:base06 "#c59cdf" ; light fg
:base07 "#e1b2ff" ; light bg
:base08 "#e873af" ; vars, tags, lists, deletion
:base09 "#f367f8" ; ints, bools, constants, attribs
:base0A "#53bdb1" ; classes, bold, search bg
:base0B "#5dffae" ; strings, inherited, code, insertion
:base0C "#ff344f" ; support, regexps, escapes, quotes
:base0D "#ba8cc6" ; funcs, methods, attrib ids, headings
:base0E "#e8a8c9" ; keywords, storage, change
:base0F "#b03060")) ; deprecated, open/close tags
(deftheme agw-base16-fira)
(base16-theme-define 'agw-base16-fira agw-base16-fira-colors)
(provide-theme 'agw-base16-fira)
(provide 'agw-base16-fira-theme)
(enable-theme 'agw-base16-fira))
(use-package inkpot-theme
:after base16-theme
:ensure t
(unless (display-graphic-p)
(load-theme 'inkpot t nil))
(set-face-attribute 'mode-line nil
:background "#0a0a0a"
:foreground "#92ebf0"))
;; major modes
(use-package elisp-mode)
(use-package eldoc)
(use-package yaml-mode
:ensure t)
(use-package cmake-mode
:ensure t
(defvaralias 'cmake-tab-width 'tab-width))
(use-package powershell
:ensure t
(defvaralias 'powershell-indent 'tab-width))
(use-package js
(defvaralias 'js-indent-level 'tab-width))
(use-package css-mode
(defvaralias 'css-indent-offset 'tab-width))
(use-package lua-mode
:ensure t
(setq lua-indent-nested-block-content-align nil))
(use-package json-mode
:ensure t
:after js
(defvaralias 'json-reformat:indent-width 'tab-width))
(use-package nim-mode
:ensure t
(defvaralias 'nim-indent-offset 'tab-width))
(use-package mmm-mode
:ensure t)
(use-package mmm-auto
(setq mmm-submode-decoration-level 0)
(mmm-add-mode-ext-class 'ruby-mode nil 'here-doc))
(use-package python
(defvaralias 'python-indent-offset 'tab-width))
(use-package cc-mode
:hook (( c-mode . agw-cc-mode)
(c++-mode . agw-cc-mode))
:mode (("\\.zsc\\'" . c-mode)
("\\.zc\\'" . c-mode)
("\\.build\\'" . c++-mode))
(setq c-auto-align-backslashes nil
c-basic-offset tab-width
c-default-style "linux")
(defvaralias 'c-basic-offset 'tab-width))
(use-package fish-mode
:ensure t
(defvaralias 'fish-indent-offset 'tab-width))
(use-package glsl-mode
:ensure t)
(use-package haskell-mode
:ensure t
:hook (haskell-mode . agw-fp-mode))
(use-package markdown-mode
:ensure t
:hook ((markdown-mode . agw-flyspell-mode))
:mode (("\\.mdwn\\'" . markdown-mode)))
(use-package ninja-mode
:ensure t)
(use-package ruby-mode
:hook ((ruby-mode . mmm-mode))
(defvaralias 'ruby-indent-level 'tab-width)
(setq ruby-insert-encoding-magic-comment nil))
(use-package rust-mode
:ensure t
(defvaralias 'rust-indent-offset 'tab-width))
(use-package sgml-mode
:hook (html-mode . agw-fp-mode))
;; org-mode
(use-package org
:hook ((org-mode . agw-flyspell-mode)
(org-mode . agw-org-mode))
(setq org-fontify-whole-heading-line t
org-hide-emphasis-markers t
org-hide-leading-stars t
org-hide-macro-markers t
org-image-actual-width nil
org-indent-indentation-per-level 2
org-list-indent-offset 2
org-log-done '(note)
org-pretty-entities t
org-return-follows-link t
org-startup-folded nil
org-startup-with-inline-images t
org-link-frame-setup '((vm . vm-visit-folder)
(vm-imap . vm-visit-imap-folder)
(gnus . gnus)
(file . find-file)
(wl . wl)))
'org-document-title nil
:foreground "#aa573c"
:weight 'bold
:height 1.6)
(font-lock-add-keywords 'org-mode
'(("^ +\\([-*+]\\) "
(0 (prog1 ()
(compose-region (match-beginning 1)
(match-end 1)
(dolist (face '((org-level-1 outline-1 1.35 "#ff6161")
(org-level-2 outline-2 1.30 "#ff9b61")
(org-level-3 outline-3 1.25 "#fff861")
(org-level-4 outline-4 1.20 "#81ff61")
(org-level-5 outline-5 1.15 "#61ffb5")
(org-level-6 outline-6 1.10 "#61c8ff")
(org-level-7 outline-7 1.05 "#8161ff")
(org-level-8 outline-8 1.00 "#ff61e2")))
(nth 0 face) nil
:inherit (nth 1 face)
:height (nth 2 face))
(nth 1 face) nil
:foreground (nth 3 face))))
(use-package org-bullets
:ensure t
:after org
:hook (org-mode . org-bullets-mode)
(setq org-bullets-bullet-list '("" "" "" "" "")))
;; adjustments
(use-package smart-tabs-mode
:ensure t
:after (fish-mode glsl-mode rust-mode lua-mode)
(smart-tabs-add-language-support powershell powershell-mode-hook
((powershell-indent-line . powershell-indent)))
(smart-tabs-add-language-support rust rust-mode-hook
((rust-mode-indent-line . rust-indent-offset)))
(smart-tabs-add-language-support fish fish-mode-hook
((fish-indent-line . fish-indent-offset)))
(smart-tabs-add-language-support glsl glsl-mode-hook
((c-indent-line . c-basic-offset)
(c-indent-region . c-basic-offset)))
(smart-tabs-add-language-support lua lua-mode-hook
((lua-indent-line . lua-indent-level)))
(use-package ialign
:ensure t
(setq ialign-initial-repeat t))
(use-package rainbow-delimiters
:ensure t
:hook (prog-mode . rainbow-delimiters-mode)
(setq rainbow-delimiters-max-face-count 8)
(dolist (face '((rainbow-delimiters-depth-1-face . "#e88385")
(rainbow-delimiters-depth-2-face . "#ec79c0")
(rainbow-delimiters-depth-3-face . "#cb88e8")
(rainbow-delimiters-depth-4-face . "#9181e8")
(rainbow-delimiters-depth-5-face . "#8dc8e8")
(rainbow-delimiters-depth-6-face . "#9fe8b6")
(rainbow-delimiters-depth-7-face . "#e2e8ab")
(rainbow-delimiters-depth-8-face . "#e8c498")))
(set-face-attribute (car face) nil :foreground (cdr face))))
(use-package undo-tree
:ensure t)
(use-package whitespace
:hook (prog-mode . whitespace-mode)
(setq whitespace-style '(face
(dolist (face '(whitespace-space whitespace-tab))
(set-face-attribute face nil :background nil :foreground "#7e4594")))
(use-package hl-line
:hook (prog-mode . hl-line-mode))
(use-package image-file
(use-package editorconfig
:ensure t
(editorconfig-mode 1))
;; ergonomics
(use-package mwheel
(setq mouse-wheel-progressive-speed nil))
(use-package vc
(setq vc-follow-symlinks t))
(use-package files
(setq require-final-newline t))
(use-package iedit
:ensure t
(setq iedit-toggle-key-default nil)
(agw-set-key "s" #'iedit-mode))
;; file management
(use-package dired
(setq dired-listing-switches "-alhp --si")
(agw-set-key "f" #'dired-jump)
(agw-set-key "t" #'dired-create-empty-file))
(use-package ranger
:ensure t
:after dired
:hook (dired-mode . ranger-override-dired-fn)
(setq ranger-override-dired 'ranger))
(use-package deadgrep
:ensure t)
;; input
(unless (eq system-type 'windows-nt)
(use-package mule
(setq current-language-environment "UTF-8"
keyboard-coding-system 'utf-8-unix))
(use-package mozc
:ensure t
:after mule
(setq default-input-method "japanese-mozc")))
(use-package evil
:ensure t
(setq evil-cjk-emacs-word-boundary t
evil-cross-lines t
evil-mode-line-format 'after
evil-shift-width 3
evil-vsplit-window-right t
evil-want-keybinding nil
evil-indent-convert-tabs nil)
;; tags
(setq evil-normal-state-tag "~"
evil-insert-state-tag "i"
evil-operator-state-tag "o"
evil-replace-state-tag "r"
evil-visual-state-tag 'agw-evil-visual-state-tag
evil-motion-state-tag "m"
evil-emacs-state-tag "x")
(evil-mode t)
(evil-global-set-key 'visual (kbd "g s") #'sort-lines)
(evil-global-set-key 'visual (kbd "g a") #'ialign))
(use-package evil-collection
:ensure t
:after evil
;; visuals
(use-package simple
(setq line-move-ignore-invisible nil)
(transient-mark-mode t))
(use-package tool-bar
(tool-bar-mode 0))
(use-package menu-bar
(menu-bar-mode 0))
(use-package paren
(setq show-paren-delay 0.0
show-paren-style 'parenthesis)
(show-paren-mode t))
(use-package fringe
(fringe-mode 0))
(use-package subword)
(use-package dim
:ensure t
:after (editorconfig
'((abbrev-mode "Ab")
(editorconfig-mode "Ec")
(eldoc-mode "El")
(isearch-mode "Is")
(subword-mode "Sw")
(undo-tree-mode "Ut")
(whitespace-mode "Ws")
(flyspell-mode "Fs")
(rainbow-mode "Rb"))))
(use-package rainbow-mode
:ensure t
:hook ((prog-mode . rainbow-mode)
(text-mode . rainbow-mode)))
;; end of init
(setq gc-cons-threshold (* 1 1000 1000))
;; EOF