source: dotfiles/emacs/.emacs@ 2b2c1ba

Last change on this file since 2b2c1ba was 2b2c1ba, checked in by Mikhail Kirillov <w96k@…>, on Jan 13, 2020 at 11:32:34 PM

Change font in stump and emacs

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