source: dotfiles/emacs/.emacs@ a1bb8c2

Last change on this file since a1bb8c2 was a1bb8c2, checked in by Mikhail Kirillov <w96k@…>, on Jan 11, 2020 at 10:35:23 AM

Delete org-mode blog config. Add djvu;

  • Property mode set to 100644
File size: 15.6 KB
Line 
1;;;; Emacs --- My config for Emacs that I use in day-to-day work
2;;;;
3;;;; https://w96k.com/
4;;;; 2018-2019 (c) Mikhail w96k Kirillov
5
6;;;; INIT
7
8(eval-when-compile
9 ;; increase GC-limit up to 100M for boot speedup
10 (setq gc-cons-threshold 500000000)
11
12 ;;; Set font
13 (add-to-list 'default-frame-alist '(font . "terminus-12"))
14
15 ;;; Disable emacs gui
16 (menu-bar-mode -1)
17 (scroll-bar-mode -1)
18 (tool-bar-mode -1)
19 (tooltip-mode -1)
20
21 (require 'package)
22
23 (setq package-archives
24 '(("gnu" . "http://elpa.gnu.org/packages/")
25 ("melpa" . "http://melpa.org/packages/")))
26
27 (package-initialize)
28
29 ;; restore GC-limit after timeout
30 (run-with-idle-timer
31 15 nil
32 (lambda ()
33 (setq gc-cons-threshold 100000)))
34
35 ;; Optimize loading
36 (setq load-prefer-newer t
37 package-user-dir "~/.emacs.d/elpa"
38 package--init-file-ensured t
39 package-enable-at-startup nil)
40
41 (require 'use-package))
42
43(use-package use-package
44 :defer nil
45 :config
46 (setq use-package-verbose t)
47 (setq use-package-always-defer t)
48 (setq use-package-always-ensure t))
49
50(use-package use-package-ensure-system-package :ensure)
51
52(add-to-list 'load-path "~/.guix-profile/share/emacs/site-lisp/")
53
54;; Information about me
55(setq user-full-name "Mikhail Kirillov"
56 user-mail-address "w96k@posteo.net")
57
58;;;; VISUALS
59
60;;; Color parens
61(use-package rainbow-delimiters
62 :hook ((prog-mode . rainbow-delimiters-mode)))
63
64;;; Display numbers
65(global-display-line-numbers-mode)
66
67;;; Display current line
68(global-hl-line-mode)
69
70;;; Set Theme
71(use-package color-theme-sanityinc-tomorrow
72 :demand
73 :config (load-theme 'sanityinc-tomorrow-eighties t))
74
75;;; Mood modeline
76(use-package mood-line
77 :config
78 (mood-line-mode))
79
80(use-package simple-httpd)
81
82;;; Bullets for org-mode
83(use-package org-bullets
84 :if window-system
85 :commands org-bullets-mode
86 :hook (org-mode . org-bullets-mode))
87
88;;;; EDITING
89
90;;; Easy undo system
91(use-package undo-tree
92 :diminish
93 :commands
94 (global-undo-tree-mode)
95 :init
96 (setq
97 undo-tree-visualizer-timestamps t
98 undo-tree-enable-undo-in-region nil
99 undo-tree-history-directory-alist
100 `(("." . ,(expand-file-name "undo" user-emacs-directory))))
101 (global-undo-tree-mode))
102
103;;; Jump to defenition
104(use-package dumb-jump
105 :bind (("M-g o" . dumb-jump-go-other-window)
106 ("M-g j" . dumb-jump-go)
107 ("M-g i" . dumb-jump-go-prompt)
108 ("M-g x" . dumb-jump-go-prefer-external)
109 ("M-g z" . dumb-jump-go-prefer-external-other-window))
110 :config (setq dumb-jump-selector 'ivy) ;; (setq dumb-jump-selector 'helm)
111 :ensure)
112
113(progn
114 (show-paren-mode))
115
116;;; Edit with root user
117(use-package sudo-edit)
118
119;;; Look eslint config
120(defun my/use-eslint-from-node-modules ()
121 (let* ((root (locate-dominating-file
122 (or (buffer-file-name) default-directory)
123 "node_modules"))
124 (eslint
125 (and root
126 (expand-file-name "node_modules/.bin/eslint"
127 root))))
128 (when (and eslint (file-executable-p eslint))
129 (setq-local flycheck-javascript-eslint-executable eslint))))
130
131;;; Live-checking text
132(use-package flycheck
133 :config
134 (add-hook 'after-init-hook #'global-flycheck-mode)
135 (add-hook 'flycheck-mode-hook #'my/use-eslint-from-node-modules)
136 (setq-default flycheck-disabled-checkers
137 (append flycheck-disabled-checkers
138 '(javascript-jshint)))
139 (flycheck-add-mode 'javascript-eslint 'web-mode)
140 (setq-default flycheck-temp-prefix ".flycheck"))
141
142;;; No tabs
143(setq-default indent-tabs-mode nil)
144
145;;; Version control
146(use-package magit
147 :defer 2
148 :bind ("C-x g" . magit-status)
149 :config (setq magit-refresh-status-buffer nil))
150
151;;; Magit forge (magit integration with git hostings)
152(use-package forge
153 :after magit)
154
155;;; Git flow
156(use-package magit-gitflow
157 :after magit
158 :init (add-hook 'magit-mode-hook 'turn-on-magit-gitflow))
159
160;;; Show added & removed git lines
161(use-package git-gutter+
162 :ensure t
163 :init (global-git-gutter+-mode)
164 :config
165 (progn
166 (define-key git-gutter+-mode-map (kbd "C-x n") 'git-gutter+-next-hunk)
167 (define-key git-gutter+-mode-map (kbd "C-x p") 'git-gutter+-previous-hunk)
168 (define-key git-gutter+-mode-map (kbd "C-x v =") 'git-gutter+-show-hunk)
169 (define-key git-gutter+-mode-map (kbd "C-x r") 'git-gutter+-revert-hunks)
170 (define-key git-gutter+-mode-map (kbd "C-x t") 'git-gutter+-stage-hunks)
171 (define-key git-gutter+-mode-map (kbd "C-x c") 'git-gutter+-commit)
172 (define-key git-gutter+-mode-map (kbd "C-x C") 'git-gutter+-stage-and-commit)
173 (define-key git-gutter+-mode-map (kbd "C-x C-y") 'git-gutter+-stage-and-commit-whole-buffer)
174 (define-key git-gutter+-mode-map (kbd "C-x U") 'git-gutter+-unstage-whole-buffer))
175 :diminish (git-gutter+-mode . "gg"))
176
177;;; Autoformatting code
178(use-package aggressive-indent
179 :config (global-aggressive-indent-mode))
180
181;;; 80 column width limit highlighter
182(use-package column-enforce-mode
183 :defer t
184 :diminish
185 :config (80-column-rule)
186 :hook (prog-mode . column-enforce-mode))
187
188;;; General autocomplete
189(use-package ivy
190 :demand
191 :diminish
192 :config
193 (ivy-mode)
194 (setq ivy-use-virtual-buffers t)
195 (setq enable-recursive-minibuffers t)
196 (global-set-key "\C-s" 'swiper)
197 (global-set-key (kbd "C-c C-r") 'ivy-resume)
198 (global-set-key (kbd "<f6>") 'ivy-resume))
199
200(use-package counsel
201 :demand
202 :config
203 (global-set-key (kbd "M-x") 'counsel-M-x)
204 (global-set-key (kbd "C-x C-f") 'counsel-find-file)
205 (global-set-key (kbd "<f1> f") 'counsel-describe-function)
206 (global-set-key (kbd "<f1> v") 'counsel-describe-variable)
207 (global-set-key (kbd "<f1> l") 'counsel-find-library)
208 (global-set-key (kbd "<f2> i") 'counsel-info-lookup-symbol)
209 (global-set-key (kbd "<f2> u") 'counsel-unicode-char)
210 (global-set-key (kbd "C-c g") 'counsel-git)
211 (global-set-key (kbd "C-c j") 'counsel-git-grep)
212 (global-set-key (kbd "C-x b") 'counsel-ibuffer)
213 (global-set-key (kbd "C-c k") 'counsel-ag)
214 (global-set-key (kbd "C-x l") 'counsel-locate)
215 (global-set-key (kbd "C-S-o") 'counsel-rhythmbox)
216 (define-key minibuffer-local-map (kbd "C-r") 'counsel-minibuffer-history))
217
218(use-package ivy-hydra)
219
220(use-package company
221 :demand
222 :diminish
223 :custom
224 (company-require-match nil)
225 (company-minimum-prefix-length 1)
226 (company-idle-delay 0.1)
227 (company-tooltip-align-annotation t)
228 :hook ((prog-mode . company-mode))
229 :config
230 (add-hook 'after-init-hook 'global-company-mode)
231 :bind (:map company-active-map
232 ("C-n" . company-select-next)
233 ("C-p" . company-select-previous)))
234
235;;;; LANGUAGES
236
237;;; Python
238(use-package elpy
239 :init
240 (elpy-enable)
241 :config
242 (setq elpy-rpc-python-command "python3")
243 (when (load "flycheck" t t)
244 (setq elpy-modules (delq 'elpy-module-flymake elpy-modules))
245 (add-hook 'elpy-mode-hook 'flycheck-mode)))
246
247;;; Vue
248(use-package vue-mode
249 :config (setq mmm-submode-decoration-level 0))
250
251;;; PHP
252(use-package php-mode)
253
254;;; Templates
255(use-package web-mode
256 :config
257 (add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode))
258 (setq web-mode-markup-indent-offset 2)
259 (setq web-mode-enable-auto-pairing t)
260 (setq web-mode-enable-current-element-highlight t)
261 (setq web-mode-enable-current-column-highlight t))
262
263;;; Javascript
264(use-package js2-mode
265 :config
266 (add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode))
267 (setq-default js2-basic-offset 2)
268 (add-hook 'js2-mode-hook
269 (lambda ()
270 (define-key js-mode-map (kbd "C-x C-e") 'nodejs-repl-send-last-expression)
271 (define-key js-mode-map (kbd "C-c C-j") 'nodejs-repl-send-line)
272 (define-key js-mode-map (kbd "C-c C-r") 'nodejs-repl-send-region)
273 (define-key js-mode-map (kbd "C-c C-l") 'nodejs-repl-load-file)
274 (define-key js-mode-map (kbd "C-c C-z") 'nodejs-repl-switch-to-repl))))
275
276;;; Eslint
277(use-package eslint-fix
278 :ensure-system-package (eslint . "npm install -g eslint")
279 :config
280 (eval-after-load 'js2-mode
281 '(add-hook 'js2-mode-hook (lambda () (add-hook 'after-save-hook 'eslint-fix nil t)))))
282
283(use-package json-mode)
284
285(use-package rjsx-mode
286 :config
287 (add-to-list 'auto-mode-alist '(".*\.js\'" . rjsx-mode)))
288
289;;; Yasnippet
290(use-package yasnippet
291 :demand
292 :diminish
293 :init (yas-global-mode 1))
294
295(use-package yasnippet-snippets
296 :diminish
297 :after yasnippet)
298
299;;; LSP
300(use-package lsp-mode
301 :hook
302 (ruby-mode . lsp)
303 (javascript-mode . lsp)
304 (vue-mode . lsp)
305 :commands lsp)
306
307;;; LSP Flycheck
308(use-package lsp-ui
309 :after (lsp-mode)
310 :hook lsp-mode
311 :commands lsp-ui-mode)
312
313(use-package company-lsp
314 :after (lsp-mode lsp-ui)
315 :commands company-lsp)
316
317;;; Debugger
318(use-package dap-mode
319 :config
320 (dap-mode 1)
321 (dap-ui-mode 1))
322
323;;; Ruby On Rails
324(use-package rinari)
325
326;;; Node.js Repl
327(use-package nodejs-repl)
328
329;;; Haskell
330(use-package haskell-mode)
331
332;;; Haskell support
333(use-package intero
334 :config (add-hook 'haskell-mode-hook 'intero-mode))
335
336;;; Typescript support
337(use-package typescript-mode)
338
339(use-package tide
340 :ensure t
341 :diminish
342 :after (typescript-mode company flycheck)
343 :hook ((typescript-mode . tide-setup)
344 (typescript-mode . tide-hl-identifier-mode)
345 (before-save . tide-format-before-save)))
346
347;;; Clojure REPL
348(use-package cider)
349
350;;;; Emacs Lisp Helping Libraries
351(use-package s)
352
353;;;; MISC
354
355;;; Djvu
356(use-package djvu)
357
358;;; Show last key and command in modeline
359(use-package keycast
360 :config (keycast-mode))
361
362;;; IRC
363(use-package erc
364 :config
365 (erc-autojoin-enable)
366 (setq erc-autojoin-channels-alist
367 '(("freenode.net" "#emacs" "#wiki" "#next-browser"))))
368
369;;; Show TODO, FIX in comments
370(use-package fic-mode)
371
372(electric-pair-mode)
373
374;;; Rest client
375(use-package restclient)
376
377;;; Telegram
378(use-package telega
379 :config (telega-mode-line-mode 1))
380
381(use-package exec-path-from-shell
382 :config
383 (when (memq window-system '(mac ns x))
384 (exec-path-from-shell-initialize)
385 (exec-path-from-shell-copy-env "PATH")))
386
387;; Kill whole line
388(global-set-key (kbd "C-u") 'kill-whole-line)
389
390;;; Volume management using thinkpad volume buttons
391(use-package volume
392 :config
393 (global-set-key (kbd "<XF86AudioRaiseVolume>") 'volume-raise-10)
394 (global-set-key (kbd "<XF86AudioLowerVolume>") 'volume-lower-10))
395
396;;; Screenshot
397(use-package frameshot
398 :if window-system
399 :config (frameshot-setup
400 '((name . "w96k")
401 (height . 800)
402 (width . 1280))))
403
404;;; Change Move to end & beginning of the line behavior
405(use-package mwim
406 :config
407 (global-set-key (kbd "C-a") 'mwim-beginning)
408 (global-set-key (kbd "C-e") 'mwim-end))
409
410(use-package command-log-mode)
411
412;;; Benchmark init
413(use-package benchmark-init
414 :demand
415 :ensure t
416 :config
417 ;; To disable collection of benchmark data after init is done.
418 (add-hook 'after-init-hook 'benchmark-init/deactivate))
419
420;;; Bug-Tracker DebBugs
421(use-package debbugs)
422
423;;; Icons
424(use-package all-the-icons
425 :if window-system)
426
427;;; Icons for dired
428(use-package all-the-icons-dired
429 :if window-system
430 :diminish
431 :after all-the-icons
432 :config
433 (add-hook 'dired-mode-hook 'all-the-icons-dired-mode))
434
435;;; Sidebar File-Manager
436(use-package dired-sidebar
437 :after exwm
438 :bind (("C-x C-n" . dired-sidebar-toggle-sidebar))
439 :diminish
440 :after all-the-icons
441 :commands (dired-sidebar-toggle-sidebar)
442 :init
443 (add-hook 'dired-sidebar-mode-hook
444 (lambda ()
445 (unless (file-remote-p default-directory)
446 (auto-revert-mode))))
447 :config
448 (push 'toggle-window-split dired-sidebar-toggle-hidden-commands)
449 (push 'rotate-windows dired-sidebar-toggle-hidden-commands)
450 (setq dired-sidebar-subtree-line-prefix "__")
451 (setq dired-sidebar-use-term-integration t)
452 (setq dired-sidebar-use-custom-font t))
453
454;;; Manage docker in emacs
455(use-package docker
456 :bind ("C-c d" . docker))
457
458;;; hide some minor modes
459(use-package diminish
460 :demand)
461
462;;; org
463(use-package org
464 :config
465 (setq org-todo-keywords
466 (quote ((sequence "TODO(t)" "MIGRATE(m)" "|" "DONE(d)")
467 (sequence "WAITING(w@/!)" "HOLD(h@/!)" "|" "CANCELLED(c@/!)" "PHONE" "MEETING"))))
468 (setq org-todo-keyword-faces
469 (quote (("TODO" :foreground "red" :weight bold)
470 ("NEXT" :foreground "blue" :weight bold)
471 ("DONE" :foreground "forest green" :weight bold)
472 ("WAITING" :foreground "orange" :weight bold)
473 ("HOLD" :foreground "magenta" :weight bold)
474 ("CANCELLED" :foreground "forest green" :weight bold)
475 ("MEETING" :foreground "forest cyan" :weight bold)
476 ("PHONE" :foreground "blue" :weight bold)))))
477
478;;; Smart mode line
479(use-package smart-mode-line
480 :demand
481 :config
482 (setq sml/no-confirm-load-theme t)
483 (setq sml/theme 'respectful)
484 (sml/setup))
485
486;;; Delete trailing whitespace on save
487(use-package whitespace-cleanup-mode
488 :diminish
489 :config (global-whitespace-cleanup-mode))
490
491;;; convert org to html in gnus
492(use-package org-mime)
493
494;;; Presentation
495(use-package epresent)
496
497;;; Email
498(use-package pinentry
499 :config
500 (setq epa-pinentry-mode 'loopback)
501 (pinentry-start))
502
503;;; Guru mode (disable arrows and stuff)
504(use-package guru-mode
505 :diminish
506 :config (guru-global-mode +1))
507
508;;; Hackernews
509(use-package hackernews)
510
511;;; PDF Tools
512(use-package pdf-tools
513 :if window-system
514 :demand
515 :config (pdf-loader-install))
516
517;;; Twitter
518(use-package twittering-mode
519 :config (setq twittering-use-master-password t))
520
521;;; Short messages
522(defalias 'yes-or-no-p 'y-or-n-p)
523
524(setq-default confirm-nonexistent-file-or-buffer t)
525
526(setq
527 save-place-forget-unreadable-files t
528 save-place-limit 200)
529
530(save-place-mode 1)
531
532;;; Show Emoji in emacs
533(use-package emojify
534 :if window-system
535 :config (add-hook 'after-init-hook #'global-emojify-mode))
536
537
538;;; Server for editing web-forms in emacs
539(use-package edit-server
540 :if window-system
541 :config (edit-server-start))
542
543;;; Markdown preview
544(use-package flymd)
545
546;;; AG Search
547(use-package ag)
548
549;;; Remove permission info from dired
550(defun dired-mode-setup ()
551 "to be run as hook for `dired-mode'."
552 (dired-hide-details-mode 1))
553(add-hook 'dired-mode-hook 'dired-mode-setup)
554
555;;; Dired Ranger like
556(use-package peep-dired)
557
558;;; Project Management
559(use-package projectile
560 :diminish
561 :bind (("s-p" . projectile-command-map)
562 ("C-c p" . projectile-command-map))
563 :config
564 (projectile-global-mode))
565
566;;; Editor Config support
567(use-package editorconfig
568 :ensure t
569 :diminish
570 :config
571 (editorconfig-mode 1))
572
573;;; Parens editing
574(use-package paredit)
575
576;;; Parens colorizing
577(use-package rainbow-delimiters)
578
579;;; Break line at 80 symbols
580(use-package visual-fill-column
581 :config
582 (setq fill-column 80)
583 (global-visual-fill-column-mode)
584 (global-visual-line-mode))
585
586;;; Disable mouse
587(use-package disable-mouse
588 :diminish "NoMouse!"
589 :defer 5
590 :config (global-disable-mouse-mode))
591
592
593(setq create-lockfiles nil)
594(setq
595 make-backup-files nil ; disable backup files
596 auto-save-list-file-name nil ; disable .saves files
597 auto-save-default nil ; disable auto saving
598 ring-bell-function 'ignore) ; turn off alarms completely
599
600;;; No savefiles
601(progn
602 (setq make-backup-files nil)
603 (setq auto-save-default nil)
604 (setq create-lockfiles nil))
605
606;;; Org-mode Setup
607(setq org-agenda-files (list
608 "~/Documents/life.org"))
609
610;;; Pomodoro technique tracking for org-mode
611(use-package org-pomodoro)
612
613;;; Accounting
614(use-package ledger-mode)
615
616;;; Diary
617(use-package org-journal)
618
619;;; Lilypond
620(progn
621 (autoload 'lilypond "lilypond")
622 (autoload 'lilypond-mode "lilypond-mode")
623 (setq auto-mode-alist
624 (cons '("\\.ly$" . LilyPond-mode) auto-mode-alist))
625 (add-hook 'LilyPond-mode-hook (lambda () (turn-on-font-lock))))
626
627;;; Flycheck lilypond
628(use-package flycheck-lilypond)
629
630;;; Publishing system
631(use-package muse)
632
633;; (global-set-key [(control ?h)] 'delete-backward-char)
Note: See TracBrowser for help on using the repository browser.