[fde9de8] | 1 | #+TITLE: Emacs configuration
|
---|
| 2 | #+AUTHOR: Kirillov <w96k.dev> Mikhail
|
---|
[e915268] | 3 | #+OPTIONS: toc:nil
|
---|
| 4 | #+PROPERTY: header-args:elisp :results silent
|
---|
[3600aa2] | 5 | #+STARTUP: showeverything
|
---|
[e915268] | 6 |
|
---|
[fde9de8] | 7 | * About this Emacs configuration
|
---|
| 8 |
|
---|
| 9 | Configuration uses org-mode to tangle its contents to init.el and then
|
---|
| 10 | be used by emacs. I use guix home for my emacs config on gnu guix
|
---|
| 11 | system.
|
---|
| 12 |
|
---|
| 13 | If you see :tangle nil it means that snippet is not used anymore, but
|
---|
| 14 | it is left because it might be valuable in a future for me.
|
---|
| 15 |
|
---|
| 16 | This configuration is available here:
|
---|
[51683a8] | 17 | https://w96k.dev/emacs.html
|
---|
| 18 |
|
---|
[fde9de8] | 19 | The git source code is hosted on Sourcehut:
|
---|
[51683a8] | 20 | https://git.sr.ht/~w96k/dotfiles/tree/master/item/emacs
|
---|
[128f35c] | 21 |
|
---|
[fde9de8] | 22 | The license of emacs config and dotfiles is CC0 which is Public Domain.
|
---|
| 23 |
|
---|
| 24 | ** Packets
|
---|
| 25 | Only needed when I need to install a package from Melpa and not GNU Guix
|
---|
[43feba7] | 26 | #+begin_src elisp :tangle nil
|
---|
[4b9efc5] | 27 | (require 'package)
|
---|
[8217b6f] | 28 |
|
---|
| 29 | (setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
|
---|
[fc6fa17] | 30 | ("melpa" . "http://melpa.org/packages/")))
|
---|
[8217b6f] | 31 |
|
---|
| 32 | (when (< emacs-major-version 27)
|
---|
| 33 | (package-initialize))
|
---|
| 34 |
|
---|
| 35 | (require 'gnutls)
|
---|
[8658e39] | 36 | #+end_src
|
---|
| 37 |
|
---|
[3ec75a9] | 38 | ** EXWM
|
---|
| 39 |
|
---|
[6782e9b] | 40 | #+begin_src emacs-lisp :tangle nil
|
---|
[3ec75a9] | 41 | (require 'exwm)
|
---|
| 42 | (require 'exwm-config)
|
---|
| 43 | (exwm-config-example)
|
---|
| 44 | #+end_src
|
---|
| 45 |
|
---|
| 46 |
|
---|
[fde9de8] | 47 | ** Init.el
|
---|
[8658e39] | 48 | #+begin_src emacs-lisp :tangle init.el
|
---|
[128f35c] | 49 | ;; -*- lexical-binding: t -*-
|
---|
[b968867] | 50 |
|
---|
[8658e39] | 51 | ;; Show/Hide errors
|
---|
| 52 | ;; (setq debug-on-error nil)
|
---|
| 53 | ;; (setq debug-on-quit nil)
|
---|
[b968867] | 54 |
|
---|
[8658e39] | 55 | ;; Timer
|
---|
| 56 | (add-hook 'emacs-startup-hook
|
---|
| 57 | (lambda ()
|
---|
| 58 | (message
|
---|
| 59 | "Emacs ready in %s with %d garbage collections."
|
---|
| 60 | (format "%.2f seconds"
|
---|
| 61 | (float-time
|
---|
| 62 | (time-subtract after-init-time before-init-time)))
|
---|
| 63 | gcs-done)))
|
---|
[b968867] | 64 |
|
---|
[8658e39] | 65 | ;; Dont ask when following symlinks
|
---|
| 66 | (setq vc-follow-symlinks t)
|
---|
[b968867] | 67 |
|
---|
[128f35c] | 68 | ;; Load your custom settings
|
---|
[8658e39] | 69 | (setq custom-file "~/.emacs.d/custom-settings.el")
|
---|
| 70 | (load custom-file t)
|
---|
| 71 | #+end_src
|
---|
[68658dc] | 72 |
|
---|
[f61bcc6] | 73 | * Meta
|
---|
[fde9de8] | 74 | ** About me
|
---|
[128f35c] | 75 | #+BEGIN_SRC emacs-lisp :tangle init.el
|
---|
[8658e39] | 76 | ;; Information about me
|
---|
| 77 | (setq user-full-name "Mikhail Kirillov"
|
---|
[0d11196] | 78 | user-mail-address "w96k@runbox.com")
|
---|
[8658e39] | 79 | #+END_SRC
|
---|
[68658dc] | 80 |
|
---|
[fde9de8] | 81 | ** Configuration
|
---|
[23f3d53] | 82 | #+BEGIN_SRC emacs-lisp :tangle init.el
|
---|
[254aa1d] | 83 | (setq config-dotfiles-path "/home/w96k/projects/dotfiles/emacs/.emacs.d/"
|
---|
[fc6fa17] | 84 | config-path "~/.emacs.d/"
|
---|
| 85 | config-name ".emacs-config.org")
|
---|
[23f3d53] | 86 |
|
---|
| 87 | (defun config-visit ()
|
---|
| 88 | (interactive)
|
---|
| 89 | (find-file (concat config-path config-name)))
|
---|
| 90 |
|
---|
| 91 | (defun config-tangle ()
|
---|
| 92 | (interactive)
|
---|
| 93 | (org-babel-tangle-file (concat config-dotfiles-path config-name))
|
---|
| 94 | ;; Configuration stored in another directory,
|
---|
| 95 | ;; so I need to move files .emacs.d manually
|
---|
[3ec75a9] | 96 | ;; (rename-file (concat config-dotfiles-path "early-init.el") config-path t)
|
---|
[74b40da] | 97 | (rename-file (concat config-dotfiles-path "init.el") config-path t))
|
---|
[23f3d53] | 98 | #+END_SRC
|
---|
[426ea33] | 99 |
|
---|
[fde9de8] | 100 | * Appereance
|
---|
[68658dc] | 101 |
|
---|
[fde9de8] | 102 | ** Line numbers
|
---|
[bb02749] | 103 | Изначально они отключены, но можно вызвать по клавише F7.
|
---|
[128f35c] | 104 | #+BEGIN_SRC emacs-lisp :tangle init.el
|
---|
[8658e39] | 105 | (define-key global-map
|
---|
| 106 | (kbd "<f7>") 'global-display-line-numbers-mode)
|
---|
[0d11196] | 107 |
|
---|
[8658e39] | 108 | (define-key global-map
|
---|
| 109 | (kbd "<f6>") 'whitespace-mode)
|
---|
| 110 | #+END_SRC
|
---|
[68658dc] | 111 |
|
---|
[fde9de8] | 112 | * Editing
|
---|
| 113 | ** Dired
|
---|
[128f35c] | 114 | #+BEGIN_SRC emacs-lisp :tangle init.el
|
---|
[8658e39] | 115 | ;; Show files in KiB
|
---|
[e915268] | 116 | (setq dired-listing-switches "-hlap"
|
---|
| 117 | dired-kill-when-opening-new-dired-buffer t)
|
---|
| 118 |
|
---|
[8e15ad4] | 119 | (customize-set-variable 'global-auto-revert-non-file-buffers t)
|
---|
| 120 | (global-auto-revert-mode 1)
|
---|
[8658e39] | 121 | #+END_SRC
|
---|
[68658dc] | 122 |
|
---|
[fde9de8] | 123 | ** Linter
|
---|
| 124 | I use Flymake and Flycheck
|
---|
[52f2a29] | 125 | *** Flymake
|
---|
[43feba7] | 126 | #+BEGIN_SRC emacs-lisp :tangle nil
|
---|
[fde9de8] | 127 | (add-hook 'prog-mode-hook 'flymake-mode)
|
---|
[52f2a29] | 128 |
|
---|
[6188d2e] | 129 | (require 'psalm)
|
---|
| 130 |
|
---|
[8658e39] | 131 | (define-prefix-command 'flymake-map)
|
---|
[569fe43] | 132 | (global-set-key (kbd "C-q") 'flymake-map)
|
---|
[8658e39] | 133 | (define-key flymake-map (kbd "n") 'flymake-goto-next-error)
|
---|
| 134 | (define-key flymake-map (kbd "p") 'flymake-goto-prev-error)
|
---|
| 135 | (define-key flymake-map (kbd "l") 'flymake-show-diagnostics-buffer)
|
---|
| 136 | (define-key flymake-map (kbd "e") 'flymake-show-diagnostic)
|
---|
| 137 | #+END_SRC
|
---|
[0979ded] | 138 |
|
---|
[52f2a29] | 139 | *** Flycheck
|
---|
[3ec75a9] | 140 | #+BEGIN_SRC emacs-lisp :tangle nil
|
---|
[74bc208] | 141 | ;; (require 'psalm)
|
---|
[6188d2e] | 142 |
|
---|
[b968867] | 143 | (when (package-loaded? "flycheck")
|
---|
[6188d2e] | 144 |
|
---|
| 145 | (defun flycheck-phanclient-start-daemon ()
|
---|
| 146 | "Start the phan daemon"
|
---|
| 147 | (interactive)
|
---|
| 148 | (let* ((default-directory (php-project-get-root-dir))
|
---|
| 149 | (phan-executable (or flycheck-phanclient--phan-executable
|
---|
| 150 | (if (file-exists-p "vendor/bin/phan")
|
---|
| 151 | (concat default-directory "vendor/bin/phan")
|
---|
| 152 | (executable-find "phan"))))
|
---|
| 153 | (cmd (list phan-executable "--daemonize-tcp-port" "4846" "--quick")))
|
---|
| 154 | (apply #'start-process "PhanDaemon" "*phan daemon*" cmd)))
|
---|
| 155 |
|
---|
| 156 | (flycheck-define-checker php-phanclient
|
---|
[74bc208] | 157 | "Phan"
|
---|
[6188d2e] | 158 | :command ("phan_client" "-l" source-original "-f" source)
|
---|
| 159 | :error-patterns
|
---|
| 160 | ((warning line-start (or "Parse" "Fatal" "syntax" "Phan") " error" (any ":" ",") " " (message) " in " (file-name) " on line " line line-end))
|
---|
| 161 | :modes (php-mode php+-mode))
|
---|
| 162 |
|
---|
| 163 | (add-to-list 'flycheck-checkers 'php-phanclient)
|
---|
| 164 |
|
---|
[74bc208] | 165 | (flycheck-add-next-checker 'php '(warning . php-phanclient))
|
---|
[6188d2e] | 166 |
|
---|
| 167 | (add-hook 'prog-mode-hook 'flycheck-mode))
|
---|
[52f2a29] | 168 | #+END_SRC
|
---|
| 169 |
|
---|
[fde9de8] | 170 | ** Imenu List
|
---|
[3cb0c7b] | 171 | #+begin_src emacs-lisp :tangle init.el
|
---|
[fde9de8] | 172 |
|
---|
| 173 | (setq imenu-list-focus-after-activation nil
|
---|
| 174 | imenu-list-auto-resize nil
|
---|
| 175 | imenu-list-mode-line-format '()
|
---|
| 176 | imenu-list-size 0.4)
|
---|
| 177 | (global-set-key (kbd "C-x C-d") #'imenu-list-smart-toggle)
|
---|
[58d51ef] | 178 | #+end_src
|
---|
| 179 |
|
---|
[fde9de8] | 180 | ** Version Control System
|
---|
[bb02749] | 181 | Модуль VC + Magit.
|
---|
[70a99de] | 182 |
|
---|
[a9e4461] | 183 | | Operation | VC | Magit |
|
---|
| 184 | |----------------+-----------------------------------------+----------------------|
|
---|
| 185 | | Project status | project-vc-dir (C-x p v) | magit-status (C-x g) |
|
---|
| 186 | | Pull | vc-update (F, in my case) | magit-pull (F p) |
|
---|
| 187 | | New branch | vc-retrieve-tag (C-u B s) | magit-branch (b c) |
|
---|
| 188 | | Commit | vc-next-action (C-x v v) | magit-commit (c c) |
|
---|
| 189 | | Rebase | shell-command (M-!) + git rebase master | magit-rebase (r p) |
|
---|
| 190 | | Push | vc-push (P or C-u P) | magit-push (P p) |
|
---|
| 191 | | Stash | mu-vc-git-stash (z) | magit-stash (z) |
|
---|
| 192 | | Log | vc-print-root-log (L) | magit-log (l l) |
|
---|
| 193 | https://www.manueluberti.eu//emacs/2021/11/27/vc/
|
---|
| 194 |
|
---|
[128f35c] | 195 | #+BEGIN_SRC emacs-lisp :tangle init.el
|
---|
[4d3a58c] | 196 | (setq vc-command-messages t)
|
---|
| 197 |
|
---|
| 198 | (global-set-key "\C-xvB" 'git-branch-next-action)
|
---|
| 199 |
|
---|
| 200 | ;; Use magit only when built-in VC fails
|
---|
[86d2deb] | 201 |
|
---|
[fde9de8] | 202 | (use-package magit
|
---|
| 203 | :defer t
|
---|
| 204 | :bind (("C-x g" . magit-status)))
|
---|
| 205 |
|
---|
| 206 | (use-package git-timemachine :defer t)
|
---|
[8658e39] | 207 | #+END_SRC
|
---|
[68658dc] | 208 |
|
---|
[fde9de8] | 209 | ** Jumps
|
---|
[128f35c] | 210 | #+BEGIN_SRC emacs-lisp :tangle init.el
|
---|
[fde9de8] | 211 | ;; Jumps by highlighting symbols on screen
|
---|
| 212 | (use-package avy
|
---|
| 213 | :defer t
|
---|
| 214 | :bind (("M-s M-s" . avy-goto-char)
|
---|
| 215 | ("M-s s" . avy-goto-char)
|
---|
| 216 | ("M-s g" . avy-goto-line)
|
---|
| 217 | ("M-s l" . avy-goto-char-in-line)
|
---|
| 218 | ("M-s M-l" . avy-goto-char-in-line)
|
---|
| 219 |
|
---|
| 220 | ("M-g g" . avy-goto-line)
|
---|
| 221 | ("M-s M-g" . avy-goto-line)))
|
---|
| 222 |
|
---|
| 223 | (use-package link-hint
|
---|
| 224 | :defer t
|
---|
| 225 | :bind (("M-s j" . link-hint-open-link)))
|
---|
| 226 |
|
---|
| 227 | ;; Jumps to last change
|
---|
| 228 | (use-package goto-chg
|
---|
| 229 | :defer t
|
---|
| 230 | :bind (("C-z" . goto-last-change)
|
---|
| 231 | ("M-z" . goto-last-change-reverse)))
|
---|
| 232 |
|
---|
| 233 | ;; Jumps using grep and similar tools
|
---|
| 234 | (use-package dumb-jump
|
---|
| 235 | :defer t
|
---|
| 236 | :bind (("C-." . dumb-jump-go)))
|
---|
[d100c77] | 237 |
|
---|
[8658e39] | 238 | #+END_SRC
|
---|
[68658dc] | 239 |
|
---|
[0979ded] | 240 | ** Проекты
|
---|
[8658e39] | 241 | Использую встроенный project.el
|
---|
| 242 | I use built-in project.el
|
---|
[d1eb4b0] | 243 | ** Ограничение ширины строки
|
---|
[128f35c] | 244 | #+BEGIN_SRC emacs-lisp :tangle init.el
|
---|
[fde9de8] | 245 | (add-hook 'prog-mode-hook 'display-fill-column-indicator-mode)
|
---|
[8c09fc7] | 246 |
|
---|
[fde9de8] | 247 | ;;; Set column width to 79 according to pep8 for python
|
---|
| 248 | (add-hook 'python-mode-hook
|
---|
| 249 | (lambda () (set-fill-column 79)))
|
---|
[8658e39] | 250 | #+END_SRC
|
---|
[68658dc] | 251 |
|
---|
[9691479] | 252 | ** Ввод парных скобок и кавычек (electric)
|
---|
[128f35c] | 253 | #+BEGIN_SRC emacs-lisp :tangle init.el
|
---|
[8658e39] | 254 | ;;; Input of pair delimiters
|
---|
| 255 | (electric-pair-mode)
|
---|
| 256 | (add-hook 'prog-mode-hook 'electric-pair-mode)
|
---|
[fde9de8] | 257 | (add-hook 'prog-mode-hook 'electric-indent-mode)
|
---|
[8658e39] | 258 | #+END_SRC
|
---|
[68658dc] | 259 |
|
---|
[68217df] | 260 | ** Kill-ring
|
---|
[fde9de8] | 261 | #+BEGIN_SRC emacs-lisp :tangle init.el
|
---|
| 262 | (use-package browse-kill-ring
|
---|
| 263 | :defer t
|
---|
| 264 | :bind ("C-M-y" . browse-kill-ring))
|
---|
[8658e39] | 265 | #+END_SRC
|
---|
[68658dc] | 266 |
|
---|
[3aa3dbc] | 267 | ** Tags
|
---|
[8658e39] | 268 | Для прыжков и поиска функций/классов и т.д.
|
---|
[0d11196] | 269 | #+BEGIN_SRC emacs-lisp :tangle nil
|
---|
[8658e39] | 270 | (setq path-to-ctags "~/.guix-profile/bin/ctags")
|
---|
| 271 |
|
---|
| 272 | (defun tags-create (dir-name)
|
---|
| 273 | "Create tags file."
|
---|
| 274 | (interactive "DDirectory: ")
|
---|
| 275 | (shell-command
|
---|
| 276 | (format "%s -f TAGS -e -R %s" path-to-ctags
|
---|
| 277 | (directory-file-name dir-name))))
|
---|
| 278 |
|
---|
| 279 | (defun tags-create-python (dir-name)
|
---|
| 280 | "Create tags with python interpreter"
|
---|
| 281 | (interactive "DDirectory: ")
|
---|
| 282 | (shell-command
|
---|
| 283 | (format "%s -f TAGS -e -R --fields=+l --languages=python --python-kinds=-iv $(python -c \"import os, sys; print(' '.join('{}'.format(d) for d in sys.path if os.path.isdir(d)))\") %s" path-to-ctags
|
---|
[ca768b6] | 284 | (directory-file-name dir-name))))
|
---|
[8658e39] | 285 | #+END_SRC
|
---|
[68658dc] | 286 |
|
---|
[d000862] | 287 | ** Дебаггер
|
---|
[3ec75a9] | 288 | #+begin_src emacs-lisp :tangle nil
|
---|
[d000862] | 289 | (when (package-loaded? "realgud")
|
---|
| 290 | (load "~/.emacs.d/site-lisp/realgud-xdebug/realgud-xdebug.el"))
|
---|
| 291 | #+end_src
|
---|
| 292 |
|
---|
[3ec75a9] | 293 | #+begin_src emacs-lisp :tangle nil
|
---|
[864b0b5] | 294 | (when (package-loaded? "geben")
|
---|
| 295 | (setq geben-dbgp-default-port 9003))
|
---|
| 296 | #+end_src
|
---|
| 297 |
|
---|
[07d6016] | 298 | *** Автодополнение кода и документация
|
---|
| 299 | По большей части я использую дефолтный Completion Buffer и Corfu
|
---|
[3ec75a9] | 300 | #+begin_src elisp :tangle nil
|
---|
[09e91e8] | 301 | (when (package-loaded? "corfu")
|
---|
| 302 | (progn
|
---|
| 303 | (setq corfu-preview-current 'nil
|
---|
| 304 | corfu-popupinfo-delay t)
|
---|
| 305 | (corfu-mode 1)
|
---|
| 306 | (corfu-popupinfo-mode 1)
|
---|
| 307 | (defun show-default-completion-buffer ()
|
---|
| 308 | (interactive)
|
---|
| 309 | (corfu-quit)
|
---|
[279dc2a] | 310 | (corfu-mode -1)
|
---|
[09e91e8] | 311 | (completion-at-point)
|
---|
| 312 | (corfu-mode 1)
|
---|
| 313 | (corfu-popupinfo-mode 1))
|
---|
| 314 | (define-key corfu-map (kbd "M-TAB") 'show-default-completion-buffer)
|
---|
| 315 | (define-key corfu-map (kbd "TAB") 'show-default-completion-buffer)
|
---|
| 316 | (define-key corfu-map (kbd "C-M-i") 'show-default-completion-buffer)
|
---|
| 317 | (corfu-mode -1)
|
---|
| 318 | (add-hook 'prog-mode-hook 'corfu-mode)
|
---|
[d881dae] | 319 |
|
---|
[09e91e8] | 320 | (defun corfu-send-shell (&rest _)
|
---|
| 321 | "Send completion candidate when inside comint/eshell."
|
---|
| 322 | (cond
|
---|
| 323 | ((and (derived-mode-p 'eshell-mode) (fboundp 'eshell-send-input))
|
---|
| 324 | (eshell-send-input))
|
---|
| 325 | ((and (derived-mode-p 'comint-mode) (fboundp 'comint-send-input))
|
---|
| 326 | (comint-send-input))))
|
---|
[d881dae] | 327 |
|
---|
[09e91e8] | 328 | (advice-add #'corfu-insert :after #'corfu-send-shell)
|
---|
| 329 |
|
---|
| 330 | (add-hook 'eshell-mode-hook 'corfu-mode)))
|
---|
[d881dae] | 331 |
|
---|
[951b531] | 332 | #+end_src
|
---|
[bf3cbfb] | 333 | *** Агрессивный дефолтный комплит
|
---|
[e915268] | 334 | #+BEGIN_SRC emacs-lisp :tangle nil
|
---|
[ff56340] | 335 | (setq aggressive-completion-delay 0.5)
|
---|
[bf3cbfb] | 336 | (aggressive-completion-mode t)
|
---|
| 337 | #+END_SRC
|
---|
[32f04fb] | 338 | ** Полнотекстовый поиск
|
---|
[8658e39] | 339 | Для выхода из поиска -- C-c C-q
|
---|
[ab9549b] | 340 | #+begin_src emacs-lisp :tangle nil
|
---|
[8658e39] | 341 | (load "deft-autoloads")
|
---|
| 342 |
|
---|
| 343 | (define-key global-map
|
---|
| 344 | (kbd "C-c n s") 'deft)
|
---|
| 345 |
|
---|
| 346 | (setq deft-recursive t
|
---|
| 347 | deft-use-filter-string-for-filename t
|
---|
| 348 | deft-default-extension "org md"
|
---|
[5acd0cd] | 349 | deft-directory "~/projects/at-w96k/content/digarden")
|
---|
[8658e39] | 350 | #+end_src
|
---|
[68658dc] | 351 |
|
---|
[62b2200] | 352 | ** Визуализирование откатов
|
---|
[8658e39] | 353 | При помощи пакета undo-tree
|
---|
[4f6c5c4] | 354 | #+begin_src emacs-lisp :tangle init.el
|
---|
[fde9de8] | 355 | (use-package undo-tree
|
---|
| 356 | :defer t
|
---|
| 357 | :hook
|
---|
| 358 | (prog-mode . undo-tree-mode)
|
---|
| 359 | (org-mode . undo-tree-mode))
|
---|
[8658e39] | 360 | #+end_src
|
---|
[62b2200] | 361 |
|
---|
[f67dddc] | 362 | ** Сниппеты
|
---|
[1e08614] | 363 | #+begin_src emacs-lisp :tangle nil
|
---|
[8c09fc7] | 364 | (when (package-loaded? "yasnippet")
|
---|
| 365 | (progn
|
---|
| 366 | (add-hook 'prog-mode-hook #'yas-minor-mode)))
|
---|
[8658e39] | 367 | #+end_src
|
---|
[68658dc] | 368 |
|
---|
[09d671c] | 369 | ** Клиент LSP
|
---|
[6782e9b] | 370 | #+begin_src emacs-lisp :tangle init.el
|
---|
| 371 | ;; (with-eval-after-load 'eglot
|
---|
| 372 | ;; (add-to-list 'eglot-server-programs '((php-mode phps-mode) . ("~/projects/phpactor/bin/phpactor" "language-server" "-vvv")))
|
---|
| 373 | ;; (add-to-list 'eglot-server-programs '((php-mode phps-mode) . ("intelephense" "--stdio")))
|
---|
[09e91e8] | 374 |
|
---|
[6782e9b] | 375 | ;; ;; No event buffers, disable providers cause a lot of hover traffic. Shutdown unused servers.
|
---|
| 376 | ;; (setq eglot-events-buffer-size 0
|
---|
| 377 | ;; eglot-ignored-server-capabilities '(:hoverProvider
|
---|
| 378 | ;; :documentHighlightProvider)
|
---|
| 379 | ;; eglot-autoshutdown t))
|
---|
[09e91e8] | 380 |
|
---|
| 381 | ;; Show all of the available eldoc information when we want it. This way Flymake errors
|
---|
| 382 | ;; don't just get clobbered by docstrings.
|
---|
| 383 | (add-hook 'eglot-managed-mode-hook
|
---|
| 384 | (lambda ()
|
---|
| 385 | "Make sure Eldoc will show us all of the feedback at point."
|
---|
| 386 | (setq-local eldoc-documentation-strategy
|
---|
| 387 | #'eldoc-documentation-compose)))
|
---|
[8658e39] | 388 | #+end_src
|
---|
[09e91e8] | 389 |
|
---|
[f63641c] | 390 | ** Линтеры
|
---|
[3ec75a9] | 391 | #+begin_src emacs-lisp :tangle nil
|
---|
[864b0b5] | 392 | (defun my-php-mode-setup ()
|
---|
| 393 | "My PHP-mode hook."
|
---|
| 394 | (require 'flycheck-phpstan)
|
---|
| 395 | (flycheck-mode t))
|
---|
| 396 |
|
---|
| 397 | (add-hook 'php-mode-hook 'my-php-mode-setup)
|
---|
| 398 | #+end_src
|
---|
| 399 |
|
---|
[0d11196] | 400 | #+BEGIN_SRC emacs-lisp :tangle nil
|
---|
[09e91e8] | 401 | ;; (add-hook 'php-mode-hook 'flymake-php-load)
|
---|
| 402 | ;; (add-hook 'php-mode-hook 'flymake-phpstan-turn-on)
|
---|
| 403 |
|
---|
| 404 | ;; (require 'flycheck-phpstan)
|
---|
| 405 |
|
---|
[e915268] | 406 |
|
---|
| 407 | ;;(add-to-list 'auto-mode-alist '("\\.\\(php\\|phtml\\)\\'" . phps-mode))
|
---|
| 408 |
|
---|
[8c09fc7] | 409 | ;; (phps-mode-flycheck-setup)
|
---|
[e915268] | 410 |
|
---|
[8c09fc7] | 411 | ;; (setq phps-mode-async-process t)
|
---|
| 412 | ;; (setq phps-mode-async-process-using-async-el t)
|
---|
[f63641c] | 413 | #+END_SRC
|
---|
[e915268] | 414 |
|
---|
[d43c749] | 415 | ** Выделение
|
---|
| 416 | #+BEGIN_SRC emacs-lisp :tangle init.el
|
---|
[fde9de8] | 417 | (use-package expand-region
|
---|
| 418 | :defer t
|
---|
| 419 | :bind (("C-=" . er/expand-region)))
|
---|
[d43c749] | 420 | #+END_SRC
|
---|
| 421 |
|
---|
[8b20cb2] | 422 | ** Сессия
|
---|
[fde9de8] | 423 | #+BEGIN_SRC emacs-lisp :tangle init.el
|
---|
[0d11196] | 424 | (desktop-save-mode 1)
|
---|
[8b20cb2] | 425 | #+END_SRC
|
---|
[e2cb5ad] | 426 | ** Скроллинг
|
---|
| 427 | #+BEGIN_SRC emacs-lisp :tangle init.el
|
---|
| 428 | (setq scroll-margin 0)
|
---|
| 429 | #+END_SRC
|
---|
[41796cb] | 430 | ** Поиск
|
---|
[34558f1] | 431 | *** Isearch
|
---|
| 432 | #+begin_src emacs-lisp :tangle init.el
|
---|
| 433 | (with-eval-after-load 'isearch
|
---|
| 434 | (define-key isearch-mode-map "\C-h" 'isearch-delete-char)
|
---|
| 435 | (define-key isearch-mode-map "\C-ch" 'isearch-help-for-help))
|
---|
| 436 | #+end_src
|
---|
| 437 |
|
---|
[ca768b6] | 438 | *** Подсчёт кандидатов
|
---|
[fde9de8] | 439 | #+BEGIN_SRC emacs-lisp :tangle init.el
|
---|
| 440 | (use-package anzu
|
---|
| 441 | :config
|
---|
| 442 | (global-anzu-mode t))
|
---|
[ca768b6] | 443 | #+END_SRC
|
---|
| 444 | *** Swiper (не используется)
|
---|
[054e643] | 445 | #+BEGIN_SRC emacs-lisp :result nil :tangle nil
|
---|
[41796cb] | 446 | (load "swiper-autoloads")
|
---|
| 447 | (global-set-key (kbd "C-s") 'swiper)
|
---|
| 448 |
|
---|
| 449 | (setq swiper-include-line-number-in-search t
|
---|
| 450 | swiper-use-visual-line t
|
---|
| 451 | swiper-stay-on-quit t)
|
---|
| 452 | #+END_SRC
|
---|
[fde9de8] | 453 | ** Which function
|
---|
| 454 | #+begin_src emacs-lisp :tangle init.el
|
---|
| 455 | (which-function-mode t)
|
---|
| 456 | #+end_src
|
---|
| 457 |
|
---|
[c39a878] | 458 | ** Подсказка биндов
|
---|
| 459 | Пакет Which-key
|
---|
[1f45158] | 460 | #+begin_src elisp :tangle nil
|
---|
[c39a878] | 461 | (load "which-key-autoloads")
|
---|
| 462 | (which-key-setup-side-window-right)
|
---|
| 463 | (which-key-mode)
|
---|
| 464 |
|
---|
[ece4aba] | 465 | (setq which-key-side-window-max-width 0.5
|
---|
[c39a878] | 466 | which-key-show-remaining-keys t
|
---|
| 467 | which-key-max-display-columns 50
|
---|
[fd65e09] | 468 | which-key-max-description-length 35
|
---|
[c39a878] | 469 | which-key-sort-order 'which-key-local-then-key-order
|
---|
[fd65e09] | 470 | which-key-idle-delay 0.25)
|
---|
[c39a878] | 471 | #+end_src
|
---|
| 472 |
|
---|
[8f5263a] | 473 | ** Права суперпользователя
|
---|
| 474 | Sudo-edit
|
---|
[fde9de8] | 475 | #+begin_src emacs-lisp :tangle init.el
|
---|
| 476 | (use-package sudo-edit
|
---|
| 477 | :defer t)
|
---|
[b968867] | 478 | #+end_src
|
---|
| 479 |
|
---|
[a649060] | 480 | ** Промежуточный код
|
---|
| 481 | Показывает собранное состояние будь то собранный куски на ассемблере
|
---|
| 482 | или байт-код при помощи пакета RMSbolt.
|
---|
[fde9de8] | 483 | #+begin_src emacs-lisp :tangle init.el
|
---|
| 484 | (use-package rmsbolt
|
---|
[fc6fa17] | 485 | :defer t)
|
---|
[a649060] | 486 | #+end_src
|
---|
[8f5263a] | 487 |
|
---|
[864b0b5] | 488 | ** Быстрый запуск программы
|
---|
[7f6d0e1] | 489 | #+begin_src emacs-lisp :tangle nil
|
---|
| 490 | ;; (when (package-loaded? "quickrun")
|
---|
| 491 | ;; (define-key global-map (kbd "C-c C-c") 'quickrun))
|
---|
[864b0b5] | 492 | #+end_src
|
---|
| 493 |
|
---|
| 494 |
|
---|
[f61bcc6] | 495 | * Языки программирования
|
---|
[9989e84] | 496 | ** Common Lisp
|
---|
| 497 | *** REPL
|
---|
[3ec75a9] | 498 | #+BEGIN_SRC emacs-lisp :tangle nil
|
---|
[cfa5680] | 499 | (load "sly-autoloads")
|
---|
| 500 |
|
---|
| 501 | (setq sly-lisp-implementations
|
---|
| 502 | '((clisp ("clisp"))
|
---|
| 503 | (cmucl ("cmucl" "-quiet"))
|
---|
| 504 | (sbcl ("/opt/sbcl/bin/sbcl") :coding-system utf-8-unix)))
|
---|
[8658e39] | 505 | #+END_SRC
|
---|
[68658dc] | 506 |
|
---|
[559d5be] | 507 | ** Ruby
|
---|
[0d11196] | 508 | #+BEGIN_SRC emacs-lisp :tangle nil
|
---|
[8c09fc7] | 509 | (when (package-loaded? "inf-ruby")
|
---|
| 510 | (add-hook 'ruby-mode-hook 'inf-ruby-minor-mode))
|
---|
| 511 |
|
---|
| 512 | (when (package-loaded? "inf-ruby")
|
---|
| 513 | (add-hook 'ruby-mode-hook 'robe-mode))
|
---|
[8658e39] | 514 | #+END_SRC
|
---|
[68658dc] | 515 |
|
---|
[b38b2f3] | 516 | ** Scheme
|
---|
[128f35c] | 517 | #+BEGIN_SRC emacs-lisp :tangle init.el
|
---|
[4deaed7] | 518 | (setq geiser-active-implementations '("guile"))
|
---|
[8658e39] | 519 | #+END_SRC
|
---|
[68658dc] | 520 |
|
---|
[559d5be] | 521 | ** Python
|
---|
[c3f858e] | 522 | *** Автодополнение и линт
|
---|
[3ec75a9] | 523 | #+BEGIN_SRC emacs-lisp :tangle nil
|
---|
[8c09fc7] | 524 | (when (package-loaded? "anaconda-mode")
|
---|
| 525 | (progn
|
---|
| 526 | (add-hook 'python-mode-hook 'anaconda-mode)
|
---|
[4f6c5c4] | 527 | (add-hook 'python-mode-hook 'anaconda-eldoc-mode)))
|
---|
[c3f858e] | 528 |
|
---|
[bf3e737] | 529 | ;; (when (load "flymake" t)
|
---|
| 530 | ;; (defun flymake-pylint-init ()
|
---|
| 531 | ;; (let* ((temp-file (flymake-init-create-temp-buffer-copy
|
---|
| 532 | ;; 'flymake-create-temp-inplace))
|
---|
| 533 | ;; (local-file (file-relative-name
|
---|
| 534 | ;; temp-file
|
---|
| 535 | ;; (file-name-directory buffer-file-name))))
|
---|
| 536 | ;; (list "epylint" (list local-file))))
|
---|
| 537 |
|
---|
| 538 | ;; (add-to-list 'flymake-allowed-file-name-masks
|
---|
| 539 | ;; '("\\.py\\'" flymake-pylint-init)))
|
---|
| 540 |
|
---|
| 541 | ;; (add-hook 'python-mode-hook 'flymake-mode)
|
---|
[8658e39] | 542 | #+END_SRC
|
---|
[c3f858e] | 543 | *** Прыжки в функции стандартной библиотеки на си
|
---|
[37c47af] | 544 | ** SML
|
---|
[ab9549b] | 545 | #+BEGIN_SRC emacs-lisp :tangle nil
|
---|
[8658e39] | 546 | (add-hook 'sml-mode-hook 'sml-mode)
|
---|
| 547 | #+END_SRC
|
---|
[68658dc] | 548 |
|
---|
[4ece9d5] | 549 | ** PHP
|
---|
[e741bd8] | 550 | *** PHP-Mode
|
---|
[56a7a86] | 551 | Необходимо скачать и распаковать мануал PHP (в формате html) в
|
---|
| 552 | директорию ~~/.emacs.d/php-manual/~.
|
---|
[3ec75a9] | 553 | #+begin_src emacs-lisp :tangle nil
|
---|
[8c09fc7] | 554 | ;; (add-to-list 'load-path "~/.emacs.d/site-lisp/realgud-xdebug/")
|
---|
| 555 | ;; (require 'realgud-xdebug)
|
---|
[e915268] | 556 |
|
---|
[864b0b5] | 557 | ;; (defun init-php-mode ()
|
---|
| 558 | ;; (eglot-ensure))
|
---|
[6782e9b] | 559 |
|
---|
[09e91e8] | 560 | (with-eval-after-load 'php-mode
|
---|
[6782e9b] | 561 |
|
---|
[09e91e8] | 562 | ;; (add-hook 'php-mode-hook #'init-php-mode)
|
---|
| 563 | )
|
---|
| 564 |
|
---|
[37e7af8] | 565 | (when (package-loaded? "php-mode")
|
---|
[b968867] | 566 | (progn
|
---|
| 567 | (add-hook 'php-mode-hook 'php-enable-symfony2-coding-style)
|
---|
[864b0b5] | 568 | (setq lsp-intelephense-php-version "8.1.16")
|
---|
[6782e9b] | 569 | (defvar phpactor-executable "~/.bin/phpactor")
|
---|
[864b0b5] | 570 | (custom-set-variables '(lsp-phpactor-path "~/usr/local/bin/phpactor"))
|
---|
[be6d215] | 571 |
|
---|
| 572 | (add-hook 'php-mode-hook
|
---|
| 573 | '(lambda ()
|
---|
[864b0b5] | 574 | ;; (require 'yasnippet)
|
---|
| 575 | ;; (require 'yasnippet-snippets)
|
---|
[56a7a86] | 576 |
|
---|
| 577 | (set-fill-column 120)
|
---|
| 578 |
|
---|
[09e91e8] | 579 | ;; (make-local-variable 'eldoc-documentation-function)
|
---|
| 580 | ;; (setq eldoc-documentation-function
|
---|
| 581 | ;; 'phpactor-hover)
|
---|
[864b0b5] | 582 | ;; (yas-minor-mode t)
|
---|
[1a961f6] | 583 | (define-key php-mode-map (kbd "C-c h") 'php-quickhelp-at-point)))
|
---|
[be6d215] | 584 |
|
---|
[b968867] | 585 | (setq php-manual-path
|
---|
[864b0b5] | 586 | "~/php/php-manual/"
|
---|
| 587 | php-quickhelp-dir "~/php/php-manual/"
|
---|
[b968867] | 588 | php-quickhelp--dest "~/.emacs.d/php-manual/php_manual_en.json")
|
---|
| 589 |
|
---|
| 590 |
|
---|
[be6d215] | 591 | ;; (add-hook 'php-mode-hook
|
---|
| 592 | ;; '(lambda ()
|
---|
| 593 | ;; ;; (auto-complete-mode t)
|
---|
[43749e5] | 594 |
|
---|
[be6d215] | 595 | ;; ;; (require 'ac-php)
|
---|
| 596 | ;; (require 'php-quickhelp)
|
---|
| 597 | ;; (require 'company)
|
---|
| 598 | ;; (company-mode t)
|
---|
| 599 | ;; (require 'company-php)
|
---|
| 600 | ;; (require 'company-quickhelp)
|
---|
[951b531] | 601 |
|
---|
[be6d215] | 602 | ;; (require 'yasnippet)
|
---|
| 603 | ;; (require 'yasnippet-snippets)
|
---|
[951b531] | 604 |
|
---|
[be6d215] | 605 | ;; (set (make-local-variable 'company-backends)
|
---|
| 606 | ;; '((company-ac-php-backend company-dabbrev-code)
|
---|
| 607 | ;; php-quickhelp-company-php
|
---|
| 608 | ;; company-capf company-files))
|
---|
[951b531] | 609 |
|
---|
[be6d215] | 610 | ;; (company-quickhelp-mode t)
|
---|
[951b531] | 611 |
|
---|
[be6d215] | 612 | ;; (define-key php-mode-map (kbd "C-M-i") 'company-complete)
|
---|
| 613 | ;; (define-key company-mode-map (kbd "M-TAB") 'company-complete)
|
---|
[951b531] | 614 |
|
---|
[be6d215] | 615 | ;; ;; (setq ac-sources '(ac-source-php php-quickhelp-company-php))
|
---|
| 616 | ;; ;; (setq eldoc-documentation-function
|
---|
| 617 | ;; ;; 'php-quickhelp-eldoc-func)
|
---|
[b7d25b5] | 618 |
|
---|
[be6d215] | 619 | ;; (yas-minor-mode t)
|
---|
[b7d25b5] | 620 |
|
---|
[be6d215] | 621 | ;; ;; (define-key php-mode-map (kbd "C-M-i") 'auto-complete)
|
---|
| 622 | ;; ;; (define-key ac-mode-map (kbd "M-TAB") 'auto-complete)
|
---|
[b7d25b5] | 623 |
|
---|
[be6d215] | 624 | ;; (define-key php-mode-map (kbd "C-c H")
|
---|
| 625 | ;; 'php-local-manual-search)
|
---|
| 626 |
|
---|
| 627 | ;; (define-key php-mode-map (kbd "C-c h") 'php-quickhelp-at-point)
|
---|
| 628 | ;; (define-key company-mode-map (kbd "C-c h") 'php-quickhelp-at-point)
|
---|
[b7d25b5] | 629 |
|
---|
[be6d215] | 630 | ;; ;; (define-key php-mode-map (kbd "C-c t") 'ac-php-show-tip)
|
---|
[b7d25b5] | 631 |
|
---|
[be6d215] | 632 | ;; ;; Jump to definition (optional)
|
---|
| 633 | ;; (define-key php-mode-map
|
---|
| 634 | ;; (kbd "M-.") 'ac-php-find-symbol-at-point)
|
---|
[43749e5] | 635 |
|
---|
[be6d215] | 636 | ;; ;; Return back (optional)
|
---|
| 637 | ;; (define-key php-mode-map
|
---|
| 638 | ;; (kbd "M-,") 'ac-php-location-stack-back)))
|
---|
| 639 | ))
|
---|
[4ece9d5] | 640 | #+end_src
|
---|
| 641 |
|
---|
[e741bd8] | 642 | *** Composer
|
---|
[6782e9b] | 643 | #+begin_src emacs-lisp :tangle init.el
|
---|
| 644 | (setq composer-executable-bin "~/.bin/composer")
|
---|
| 645 | #+end_src
|
---|
| 646 |
|
---|
[e741bd8] | 647 | *** Flymake PHP
|
---|
| 648 | *** REPL
|
---|
| 649 | *** LSP сервер
|
---|
| 650 | PHPactor
|
---|
[43749e5] | 651 | #+begin_src emacs-lisp :tangle nil
|
---|
[6782e9b] | 652 | (setq phpactor-executable "~/.bin/phpactor")
|
---|
| 653 | (custom-set-variables '(lsp-phpactor-path "~/.bin/phpactor"))
|
---|
| 654 |
|
---|
| 655 | (use-package phpactor :ensure t)
|
---|
| 656 | (use-package company-phpactor :ensure t)
|
---|
| 657 |
|
---|
| 658 |
|
---|
| 659 |
|
---|
| 660 | ;; (with-eval-after-load 'php-mode
|
---|
| 661 | ;; (define-key php-mode-map (kbd "M-.") #'phpactor-goto-definition)
|
---|
| 662 | ;; (define-key php-mode-map (kbd "M-?") #'phpactor-find-references))
|
---|
[e741bd8] | 663 | #+end_src
|
---|
| 664 |
|
---|
[af9ef4a] | 665 | *** Transient меню
|
---|
[c39a878] | 666 | #+begin_src emacs-lisp :tangle nil
|
---|
[d100c77] | 667 | (require 'transient)
|
---|
[f63641c] | 668 | (define-transient-command php-menu ()
|
---|
[d100c77] | 669 | "Php"
|
---|
| 670 | [["Class"
|
---|
| 671 | ("cc" "Copy" phpactor-copy-class)
|
---|
| 672 | ("cn" "New" phpactor-create-new-class)
|
---|
| 673 | ("cr" "Move" phpactor-move-class)
|
---|
| 674 | ("ci" "Inflect" phpactor-inflect-class)
|
---|
| 675 | ("n" "Namespace" phpactor-fix-namespace)]
|
---|
| 676 | ["Properties"
|
---|
| 677 | ("a" "Accessor" phpactor-generate-accessors)
|
---|
| 678 | ("pc" "Constructor" phpactor-complete-constructor)
|
---|
| 679 | ("pm" "Add missing props" phpactor-complete-properties)
|
---|
| 680 | ("r" "Rename var locally" phpactor-rename-variable-local)
|
---|
| 681 | ("R" "Rename var in file" phpactor-rename-variable-file)]
|
---|
| 682 | ["Extract"
|
---|
| 683 | ("ec" "constant" phpactor-extract-constant)
|
---|
| 684 | ("ee" "expression" phpactor-extract-expression)
|
---|
| 685 | ("em" "method" phpactor-extract-method)]
|
---|
| 686 | ["Methods"
|
---|
| 687 | ("i" "Implement Contracts" phpactor-implement-contracts)
|
---|
| 688 | ("m" "Generate method" phpactor-generate-method)]
|
---|
| 689 | ["Navigate"
|
---|
| 690 | ("x" "List refs" phpactor-list-references)
|
---|
| 691 | ("X" "Replace refs" phpactor-replace-references)
|
---|
| 692 | ("." "Goto def" phpactor-goto-definition)]
|
---|
| 693 | ["Phpactor"
|
---|
| 694 | ("s" "Status" phpactor-status)
|
---|
| 695 | ("u" "Install" phpactor-install-or-update)]])
|
---|
[af9ef4a] | 696 | #+end_src
|
---|
[d06a87f] | 697 | * Языки декларирования
|
---|
| 698 | ** SQL
|
---|
[7f6d0e1] | 699 | to install lsp-server called sqls
|
---|
[93c87eb] | 700 | https://emacs-lsp.github.io/lsp-mode/page/lsp-sqls/
|
---|
[0d11196] | 701 | #+BEGIN_SRC emacs-lisp :tangle nil
|
---|
[8658e39] | 702 | ;; Empty for now (was using emacsql)
|
---|
[b08cfaa] | 703 | (setq lsp-sqls-server "~/go/bin/sqls")
|
---|
[313ec50] | 704 |
|
---|
[ee24a4b] | 705 | ;; (setq lsp-sqls-workspace-config-path nil)
|
---|
[313ec50] | 706 |
|
---|
| 707 | (setq lsp-sqls-connections
|
---|
[ee24a4b] | 708 | '(((driver . "mysql") (dataSourceName . "dbuser:mangoworms@tcp(localhost:3306)/profile24"))))
|
---|
[8658e39] | 709 | #+END_SRC
|
---|
[f63641c] | 710 |
|
---|
[a198d42] | 711 | The main way to interact with SQL is using org-mode
|
---|
[0d11196] | 712 | #+begin_src emacs-lisp :tangle nil
|
---|
[a198d42] | 713 | (when (package-loaded? "org-sql")
|
---|
| 714 | (setq org-sql-files "~/projects/profile24/org"))
|
---|
[313ec50] | 715 |
|
---|
[acdb8ab] | 716 | (add-hook 'sql-interactive-mode-hook
|
---|
[8faea87] | 717 | (lambda ()
|
---|
[e6b57ae] | 718 | (sql-connect "profile24")
|
---|
[8faea87] | 719 | (toggle-truncate-lines t)))
|
---|
[acdb8ab] | 720 |
|
---|
[313ec50] | 721 | (setq sql-connection-alist
|
---|
[ee24a4b] | 722 | '((profile24
|
---|
| 723 | (sql-product 'mysql)
|
---|
| 724 | (sql-server "localhost")
|
---|
| 725 | (sql-user "dbuser")
|
---|
[0d11196] | 726 | (sql-password "123456")
|
---|
| 727 | (sql-database "testdb")
|
---|
[ee24a4b] | 728 | (sql-port 3306))))
|
---|
[a198d42] | 729 | #+end_src
|
---|
| 730 |
|
---|
| 731 |
|
---|
[f61bcc6] | 732 | ** Веб шаблоны
|
---|
| 733 | *** Web-mode
|
---|
[128f35c] | 734 | #+BEGIN_SRC emacs-lisp :tangle init.el
|
---|
[fde9de8] | 735 | (use-package web-mode
|
---|
| 736 | :defer t
|
---|
| 737 | :config
|
---|
| 738 | (add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode))
|
---|
| 739 | (add-to-list 'auto-mode-alist '("\\.twig.html\\'" . web-mode))
|
---|
| 740 | (setq web-mode-markup-indent-offset 2)
|
---|
| 741 | (setq web-mode-enable-auto-pairing t)
|
---|
| 742 | (setq web-mode-enable-css-colorization t)
|
---|
| 743 | (setq web-mode-enable-block-face t)
|
---|
| 744 | (setq web-mode-enable-current-element-highlight t))
|
---|
[8658e39] | 745 | #+END_SRC
|
---|
[68658dc] | 746 |
|
---|
[e53abd3] | 747 | ** Org
|
---|
| 748 | *** Org-mode
|
---|
[128f35c] | 749 | #+BEGIN_SRC emacs-lisp :tangle init.el
|
---|
[fde9de8] | 750 | (use-package org
|
---|
| 751 | :defer t
|
---|
| 752 | :config
|
---|
| 753 | (org-babel-do-load-languages
|
---|
| 754 | 'org-babel-load-languages
|
---|
| 755 | '((R . t)
|
---|
| 756 | (ditaa . t)
|
---|
| 757 | (dot . t)
|
---|
| 758 | ;; (php . t)
|
---|
| 759 | (emacs-lisp . t)
|
---|
| 760 | (gnuplot . t)
|
---|
| 761 | (haskell . nil)
|
---|
| 762 | (latex . t)
|
---|
| 763 | ;;(ledger . t)
|
---|
| 764 | (ocaml . nil)
|
---|
| 765 | (octave . t)
|
---|
| 766 | (python . t)
|
---|
| 767 | (ruby . t)
|
---|
| 768 | (screen . nil)
|
---|
| 769 | (shell . t)
|
---|
| 770 | (sql . t)
|
---|
| 771 | (js . t)))
|
---|
| 772 | (setq org-default-notes-file "~/Documents/todo.org"
|
---|
[877bb6c] | 773 | system-time-locale "C"
|
---|
[c39a878] | 774 | org-use-speed-commands t
|
---|
| 775 | org-adapt-indentation nil
|
---|
| 776 | org-return-follows-link t
|
---|
[7f6d0e1] | 777 | org-agenda-include-diary t
|
---|
[ea0b945] | 778 | org-display-remote-inline-images 'download
|
---|
[7f6d0e1] | 779 | org-agenda-start-with-log-mode t
|
---|
[edf34a3] | 780 | org-image-actual-width (list 400)
|
---|
[c39a878] | 781 | org-hide-emphasis-markers t
|
---|
| 782 | org-outline-path-complete-in-steps nil
|
---|
| 783 | org-src-tab-acts-natively t
|
---|
[09e91e8] | 784 | org-id-track-globally t
|
---|
[c39a878] | 785 | org-confirm-babel-evaluate nil)
|
---|
[fde9de8] | 786 | (setq org-todo-keywords
|
---|
[c39a878] | 787 | (quote ((sequence "TODO(t)"
|
---|
[254aa1d] | 788 | "MIGRATE(m)"
|
---|
[c39a878] | 789 | "IN PROGRESS(p)"
|
---|
| 790 | "DONE(d)")
|
---|
[7f6d0e1] | 791 | (sequence "BLOCKED(w@/!)"
|
---|
[c39a878] | 792 | "HOLD(h@/!)" "|"
|
---|
| 793 | "CANCELLED(c@/!)"
|
---|
| 794 | "PHONE"
|
---|
[7f6d0e1] | 795 | "MEETING"
|
---|
| 796 | "NEED CLARIFICATION(t)"
|
---|
| 797 | ))))
|
---|
[fde9de8] | 798 | (setq org-todo-keyword-faces
|
---|
[c39a878] | 799 | (quote (("TODO" :foreground "red" :weight bold)
|
---|
| 800 | ("NEXT" :foreground "blue" :weight bold)
|
---|
| 801 | ("DONE" :foreground "forest green" :weight bold)
|
---|
| 802 | ("WAITING" :foreground "orange" :weight bold)
|
---|
| 803 | ("HOLD" :foreground "magenta" :weight bold)
|
---|
| 804 | ("CANCELLED" :foreground "forest green" :weight bold)
|
---|
| 805 | ("MEETING" :foreground "forest cyan" :weight bold)
|
---|
| 806 | ("PHONE" :foreground "blue" :weight bold))))
|
---|
[fde9de8] | 807 | :bind
|
---|
| 808 | ("C-c l" . org-store-link)
|
---|
| 809 | ("C-c a" . org-agenda)
|
---|
| 810 | ("C-c c" . org-capture)
|
---|
| 811 | )
|
---|
| 812 |
|
---|
| 813 | (defun org-babel-edit-prep:sql (babel-info)
|
---|
| 814 | (setq-local buffer-file-name (->> babel-info caddr (alist-get :tangle)))
|
---|
| 815 | (setq-local lsp-buffer-uri (->> babel-info caddr (alist-get :tangle) lsp--path-to-uri))
|
---|
| 816 | (setq-local lsp-headerline-breadcrumb-enable nil)
|
---|
| 817 | (lsp))
|
---|
| 818 |
|
---|
| 819 | ;; (global-set-key (kbd "M-f") 'org-metaright)
|
---|
| 820 | ;; (global-set-key (kbd "M-b") 'org-metaleft)
|
---|
| 821 | ;; (global-set-key (kbd "M-p") 'org-metaup)
|
---|
| 822 | ;; (global-set-key (kbd "M-n") 'org-metadown)
|
---|
[8658e39] | 823 | #+END_SRC
|
---|
[68658dc] | 824 |
|
---|
[fde9de8] | 825 |
|
---|
| 826 | *** Org-ref
|
---|
[d3c0bac] | 827 | #+begin_src emacs-lisp :tangle nil
|
---|
[8658e39] | 828 | (load "org-ref-autoloads")
|
---|
| 829 |
|
---|
| 830 | (setq reftex-default-bibliography '("~/Documents/bibliography/references.bib"))
|
---|
| 831 |
|
---|
| 832 | ;; see org-ref for use of these variables
|
---|
| 833 | (setq org-ref-bibliography-notes "~/Documents/bibliography/notes.org"
|
---|
| 834 | org-ref-default-bibliography '("~/Documents/Bibliography/references.bib")
|
---|
| 835 | org-ref-pdf-directory "~/Documents/bibliography/bibtex-pdfs/")
|
---|
| 836 | #+end_src
|
---|
[e53abd3] | 837 |
|
---|
[d61c4ab] | 838 | *** Org-roam
|
---|
[d652ebb] | 839 | #+begin_src emacs-lisp :tangle init.el
|
---|
[fde9de8] | 840 | (use-package org-roam
|
---|
| 841 | :defer t
|
---|
| 842 | :bind
|
---|
| 843 | ("C-c n l" . org-roam-node-insert)
|
---|
| 844 | ("C-c n b" . org-roam-buffer-toggle)
|
---|
| 845 | ("C-c n f" . org-roam-node-find)
|
---|
| 846 | ("C-c n t t" . org-roam-tag-add)
|
---|
| 847 | ("C-c n t r" . org-roam-tag-remove)
|
---|
| 848 | ("C-c n i" . org-roam-jump-to-index)
|
---|
| 849 | ("C-c n g" . org-roam-graph)
|
---|
| 850 | ("C-c n d" . org-roam-db-build-cache)
|
---|
| 851 | ("C-c n r" . org-roam-node-random)
|
---|
| 852 | ("C-c n j" . org-roam-dailies-find-date)
|
---|
| 853 | :config
|
---|
| 854 | (setq org-roam-directory (file-truename "~/Zettelkasten")
|
---|
| 855 | org-roam-v2-ack t
|
---|
| 856 | org-roam-completion-everywhere t
|
---|
| 857 | org-roam-index-file (concat org-roam-directory "/20210409054712-жизнь.org")
|
---|
| 858 | org-roam-dailies-directory (concat org-roam-directory "journals/"))
|
---|
| 859 |
|
---|
| 860 | (org-roam-db-autosync-mode t))
|
---|
| 861 |
|
---|
| 862 | (defun org-roam-jump-to-index ()
|
---|
| 863 | "Stub of recreating the function from V1"
|
---|
| 864 | (interactive)
|
---|
| 865 | (let
|
---|
| 866 | ((org-roam-index org-roam-index-file))
|
---|
| 867 | (find-file org-roam-index)))
|
---|
[395b6b5] | 868 |
|
---|
[fde9de8] | 869 | (use-package org
|
---|
| 870 | :defer t
|
---|
| 871 | :config
|
---|
| 872 | (customize-set-variable 'org-link-descriptive t)
|
---|
[d61c4ab] | 873 |
|
---|
[fde9de8] | 874 | (add-to-list 'org-agenda-files
|
---|
| 875 | "~/Documents/todo.org")
|
---|
[3a19ca7] | 876 |
|
---|
[fde9de8] | 877 | (setq org-directory "~/Documents"
|
---|
| 878 | org-default-notes-file (concat org-directory "/todo.org")))
|
---|
[cc591cc] | 879 | #+end_src
|
---|
| 880 |
|
---|
[2bb7684] | 881 | ** YAML
|
---|
[fde9de8] | 882 | #+begin_src emacs-lisp :tangle init.el
|
---|
| 883 | (use-package yaml-mode
|
---|
| 884 | :defer t)
|
---|
[2bb7684] | 885 | #+end_src
|
---|
| 886 |
|
---|
[f61bcc6] | 887 | * Коммуникации
|
---|
[7f6d0e1] | 888 | ** Gnus
|
---|
| 889 | #+begin_src emacs-lisp :tangle init.el
|
---|
| 890 |
|
---|
| 891 | #+end_src
|
---|
| 892 |
|
---|
[f61892c] | 893 | ** Telega
|
---|
[3ec75a9] | 894 | #+BEGIN_SRC emacs-lisp :tangle init.el
|
---|
[fde9de8] | 895 | (use-package telega
|
---|
| 896 | :bind (("C-c t" . telega-prefix-map)))
|
---|
[8658e39] | 897 | #+END_SRC
|
---|
[68658dc] | 898 |
|
---|
[1c49a32] | 899 | ** Mastodon
|
---|
[fde9de8] | 900 | #+begin_src emacs-lisp :tangle init.el
|
---|
| 901 | (use-package mastodon
|
---|
| 902 | :defer t
|
---|
| 903 | :config
|
---|
[b968867] | 904 | (setq mastodon-active-user "w96k"
|
---|
| 905 | mastodon-instance-url "https://fosstodon.org/"))
|
---|
[1c49a32] | 906 | #+end_src
|
---|
| 907 |
|
---|
[f61bcc6] | 908 | * Разное
|
---|
[fde9de8] | 909 | ** *Highlight
|
---|
| 910 | #+BEGIN_SRC emacs-lisp :tangle init.el
|
---|
| 911 | (use-package highlight
|
---|
| 912 | :defer t)
|
---|
| 913 | #+end_src
|
---|
[d184fc7] | 914 | ** Минорные твики дефолтного имакса
|
---|
[8e15ad4] | 915 | *** Короткие ответы на вопросы
|
---|
[0d11196] | 916 | #+begin_src emacs-lisp :tangle init.el
|
---|
[8e15ad4] | 917 | (if (boundp 'use-short-answers)
|
---|
| 918 | (setq use-short-answers t)
|
---|
| 919 | (advice-add 'yes-or-no-p :override #'y-or-n-p))
|
---|
| 920 | #+end_src
|
---|
| 921 |
|
---|
| 922 | *** Не сохранять дубликаты в killring
|
---|
| 923 |
|
---|
[d80bfc6] | 924 | *** Подсвечивать текущую строку
|
---|
[0d11196] | 925 | #+begin_src emacs-lisp :tangle nil
|
---|
[fde9de8] | 926 | (global-hl-line-mode t)
|
---|
[395b6b5] | 927 | #+end_src
|
---|
| 928 |
|
---|
[d184fc7] | 929 | *** Автодополнение в echo при M-x и других командах
|
---|
[3ec75a9] | 930 | #+begin_src emacs-lisp :tangle init.el
|
---|
[fde9de8] | 931 | (icomplete-mode t)
|
---|
[d184fc7] | 932 | #+end_src
|
---|
| 933 | *** Проверять орфографию
|
---|
| 934 | #+begin_src emacs-lisp :tangle init.el
|
---|
[fde9de8] | 935 | (flyspell-mode t)
|
---|
[ec71c8e] | 936 | #+end_src
|
---|
| 937 |
|
---|
[f61bcc6] | 938 | *** Не спрашивать о несуществующих буферах
|
---|
[128f35c] | 939 | #+BEGIN_SRC emacs-lisp :tangle init.el
|
---|
[8658e39] | 940 | (setq-default confirm-nonexistent-file-or-buffer t)
|
---|
| 941 | #+END_SRC
|
---|
[68658dc] | 942 |
|
---|
[373ed2d] | 943 | *** Переключение буферов
|
---|
[0d11196] | 944 | #+BEGIN_SRC emacs-lisp :tangle init.el
|
---|
[373ed2d] | 945 | (global-set-key (kbd "M-o") 'mode-line-other-buffer)
|
---|
| 946 | #+END_SRC
|
---|
[ef88711] | 947 |
|
---|
[01e632c] | 948 | *** Минорные твики
|
---|
| 949 | #+begin_src emacs-lisp :tangle init.el
|
---|
[0d11196] | 950 | ;; (setq redisplay-dont-pause t)
|
---|
[3aaa66b] | 951 |
|
---|
| 952 | (setq select-enable-clipboard t
|
---|
| 953 | select-enable-primary t)
|
---|
| 954 |
|
---|
[2107e51] | 955 | (setq completions-detailed nil)
|
---|
[3aaa66b] | 956 |
|
---|
| 957 | (setq kill-buffer-delete-auto-save-files t)
|
---|
| 958 | (setq next-error-message-highlight t)
|
---|
| 959 |
|
---|
| 960 | (setq mode-line-compact 'long)
|
---|
| 961 |
|
---|
[2107e51] | 962 | (setq completions-group t)
|
---|
| 963 |
|
---|
[01e632c] | 964 | ;;(set-frame-parameter nil 'internal-border-width 0)
|
---|
| 965 |
|
---|
| 966 | ;; (set-window-buffer nil (current-buffer))
|
---|
| 967 |
|
---|
[0d11196] | 968 | (setq default-directory "~/"
|
---|
[01e632c] | 969 | custom-safe-themes t
|
---|
| 970 | delete-old-versions t
|
---|
| 971 | enable-local-variables t)
|
---|
| 972 | #+end_src
|
---|
| 973 |
|
---|
[e93b7a8] | 974 | *** Shell
|
---|
[128f35c] | 975 | #+begin_src emacs-lisp :tangle init.el
|
---|
[8658e39] | 976 | (setq ansi-color-for-comint-mode t)
|
---|
| 977 | (setq shell-command-prompt-show-cwd t)
|
---|
| 978 | #+end_src
|
---|
[68658dc] | 979 |
|
---|
[f61bcc6] | 980 | *** Переменная PATH в eshell
|
---|
[0d11196] | 981 | #+BEGIN_SRC emacs-lisp :tangle nil
|
---|
[6eb7430] | 982 | (setq exec-path-from-shell-variables
|
---|
| 983 | '("PATH" "MANPATH"))
|
---|
| 984 |
|
---|
[f63641c] | 985 | (when (and (memq window-system '(mac ns x))
|
---|
| 986 | (not (eq system-type 'berkeley-unix)))
|
---|
| 987 | (exec-path-from-shell-initialize))
|
---|
[8658e39] | 988 | #+END_SRC
|
---|
[68658dc] | 989 |
|
---|
[f61bcc6] | 990 | *** Отображение номера колонки
|
---|
[128f35c] | 991 | #+BEGIN_SRC emacs-lisp :tangle init.el
|
---|
[8658e39] | 992 | (column-number-mode)
|
---|
| 993 | #+END_SRC
|
---|
[68658dc] | 994 |
|
---|
[cc8263e] | 995 | *** nobreak символы
|
---|
[128f35c] | 996 | #+BEGIN_SRC emacs-lisp :tangle init.el
|
---|
[8658e39] | 997 | (setq nobreak-char-display nil)
|
---|
| 998 | #+END_SRC
|
---|
[68658dc] | 999 |
|
---|
[2a1b24a] | 1000 | *** Меню
|
---|
[3176064] | 1001 | *** Сохранять временные файлы не в той же директории
|
---|
[128f35c] | 1002 | #+BEGIN_SRC emacs-lisp :tangle init.el
|
---|
[3aaa66b] | 1003 | (defvar backup-dir "~/.emacs.d/backups/")
|
---|
| 1004 |
|
---|
[8658e39] | 1005 | (setq
|
---|
| 1006 | backup-by-copying t
|
---|
| 1007 | backup-directory-alist
|
---|
[0d11196] | 1008 | '(("~/.emacs.d/backups/"))
|
---|
[e915268] | 1009 | version-control nil)
|
---|
[8658e39] | 1010 | #+END_SRC
|
---|
[68658dc] | 1011 |
|
---|
[1e93232] | 1012 | *** Календарь
|
---|
[8658e39] | 1013 | Делаем начало недели в понедельник.
|
---|
[128f35c] | 1014 | #+BEGIN_SRC emacs-lisp :tangle init.el
|
---|
[8658e39] | 1015 | (setq calendar-week-start-day 1)
|
---|
| 1016 | #+END_SRC
|
---|
[68658dc] | 1017 |
|
---|
[30915d2] | 1018 | *** Вернуться в предыдущий буфер
|
---|
[2107e51] | 1019 | #+BEGIN_SRC emacs-lisp :tangle nil
|
---|
[30915d2] | 1020 | (define-key global-map (kbd "C-q C-q") 'previous-buffer)
|
---|
| 1021 | (define-key global-map (kbd "C-S-q C-S-q") 'next-buffer)
|
---|
| 1022 | #+END_SRC
|
---|
[bbdcdf6] | 1023 | *** Смена раскладки (EN / RU) и поддержка биндов на других языках
|
---|
| 1024 | Работает на C-\
|
---|
[c39a878] | 1025 | #+begin_src elisp :tangle init.el
|
---|
[bbdcdf6] | 1026 | (set-input-method "russian-computer")
|
---|
| 1027 | (toggle-input-method)
|
---|
| 1028 | #+end_src
|
---|
| 1029 |
|
---|
[41a06b7] | 1030 | *** Требовать создания последней пустой строки
|
---|
| 1031 | #+begin_src emacs-lisp :tangle init.el
|
---|
| 1032 | (setq require-final-newline t)
|
---|
| 1033 | #+end_src
|
---|
| 1034 |
|
---|
[e915268] | 1035 | *** Стирать текст на C-h как в Bash
|
---|
[34558f1] | 1036 | И переназначаем старые бинды
|
---|
[be6d215] | 1037 | #+begin_src emacs-lisp :tangle nil
|
---|
[e915268] | 1038 | (define-key global-map (kbd "C-h") 'delete-backward-char)
|
---|
| 1039 | (define-key global-map (kbd "C-c h") 'help-command)
|
---|
| 1040 | #+end_src
|
---|
| 1041 |
|
---|
[499be9d] | 1042 | *** Поддержка CamelCase в навигации
|
---|
| 1043 | #+begin_src emacs-lisp :tangle init.el
|
---|
| 1044 | (global-subword-mode 1)
|
---|
| 1045 | #+end_src
|
---|
| 1046 |
|
---|
[797073d] | 1047 | *** Kills
|
---|
[0901186] | 1048 | #+begin_src emacs-lisp :tangle init.el
|
---|
[fde9de8] | 1049 | (use-package whole-line-or-region
|
---|
| 1050 | :bind (("C-k" . kill-region)
|
---|
| 1051 | ("C-w" . backward-kill-word))
|
---|
| 1052 | :config
|
---|
[877bb6c] | 1053 | (whole-line-or-region-global-mode))
|
---|
[797073d] | 1054 | #+end_src
|
---|
| 1055 |
|
---|
[499be9d] | 1056 |
|
---|
[3d43263] | 1057 | ** Браузер
|
---|
[3ec75a9] | 1058 | #+begin_src emacs-lisp :tangle nil
|
---|
[864b0b5] | 1059 | (setq browse-url-browser-function #'eww-browse-url)
|
---|
| 1060 |
|
---|
[8658e39] | 1061 | (add-hook 'eww-mode-hook
|
---|
| 1062 | (lambda ()
|
---|
| 1063 | (set-fill-column 80)
|
---|
| 1064 | (display-fill-column-indicator-mode)
|
---|
| 1065 | (visual-fill-column-mode)))
|
---|
| 1066 | #+end_src
|
---|
[68658dc] | 1067 |
|
---|
[e915268] | 1068 | ** Tramp
|
---|
[43feba7] | 1069 | #+begin_src emacs-lisp :tangle nil
|
---|
[0d11196] | 1070 | (add-to-list 'tramp-remote-path 'tramp-own-remote-path)
|
---|
[e915268] | 1071 | #+end_src
|
---|
| 1072 |
|
---|
[b737271] | 1073 | ** Docker
|
---|
[b968867] | 1074 | #+begin_src emacs-lisp :tangle init.el
|
---|
[fde9de8] | 1075 | (use-package docker :defer t)
|
---|
| 1076 | (use-package docker-compose-mode :defer t)
|
---|
[b968867] | 1077 | #+end_src
|
---|
[4bde91a] | 1078 | ** Debian
|
---|
| 1079 | Инструменты для работы с пакетным менеджером Debian'а apt'ом и смежными
|
---|
| 1080 | инструментами.
|
---|
[8c09fc7] | 1081 | #+begin_src elisp :tangle nil
|
---|
[4bde91a] | 1082 | (load "debian-el-autoloads")
|
---|
| 1083 | (load "dpkg-dev-el-autoloads")
|
---|
| 1084 | #+end_src
|
---|
| 1085 |
|
---|
[a5e2104] | 1086 | ** Guix
|
---|
| 1087 | #+begin_src emacs-lisp :tangle init.el
|
---|
[fde9de8] | 1088 | ;; (use-package geiser-guile :defer t)
|
---|
[96b30c6] | 1089 |
|
---|
[fde9de8] | 1090 | (use-package guix
|
---|
| 1091 | :defer t
|
---|
| 1092 | :config
|
---|
| 1093 | (setq geiser-guile-binary "guile")
|
---|
| 1094 | (with-eval-after-load 'geiser-guile
|
---|
| 1095 | (progn
|
---|
| 1096 | (add-to-list 'geiser-guile-load-path "~/projects/guix/")))
|
---|
[96b30c6] | 1097 |
|
---|
[fde9de8] | 1098 | (let ((guix-copyright "~/projects/guix/etc/copyright.el"))
|
---|
| 1099 | (if (file-exists-p guix-copyright)
|
---|
| 1100 | (load-file "~/projects/guix/etc/copyright.el")))
|
---|
[96b30c6] | 1101 |
|
---|
[fde9de8] | 1102 | (setq copyright-names-regexp
|
---|
| 1103 | (format "%s <%s>" user-full-name user-mail-address)))
|
---|
[a5e2104] | 1104 | #+end_src
|
---|
| 1105 |
|
---|
[212c521] | 1106 | ** Nix
|
---|
[fde9de8] | 1107 | #+begin_src emacs-lisp :tangle init.el
|
---|
| 1108 | (use-package nix)
|
---|
[212c521] | 1109 | #+end_src
|
---|
[68658dc] | 1110 |
|
---|
[fcd469c] | 1111 | ** Direnv
|
---|
[0d11196] | 1112 | #+BEGIN_SRC emacs-lisp :tangle nil
|
---|
[8c09fc7] | 1113 | (when (package-loaded? "direnv")
|
---|
| 1114 | (direnv-mode))
|
---|
[8658e39] | 1115 | #+END_SRC
|
---|
[68658dc] | 1116 |
|
---|
[f61bcc6] | 1117 | ** Баг-трекеры
|
---|
| 1118 | *** Debbugs
|
---|
| 1119 | ** PDF
|
---|
[68658dc] | 1120 |
|
---|
[25269dd] | 1121 | ** Увеличение/уменьшение шрифта
|
---|
[8c09fc7] | 1122 | #+BEGIN_SRC emacs-lisp :tangle nil
|
---|
[8658e39] | 1123 | (defun zoom-in ()
|
---|
| 1124 | (interactive)
|
---|
| 1125 | (let ((x (+ (face-attribute 'default :height)
|
---|
| 1126 | 10)))
|
---|
| 1127 | (set-face-attribute 'default nil :height x)
|
---|
| 1128 | (set-face-attribute 'mode-line nil :height x)
|
---|
| 1129 | (set-face-attribute 'mode-line-inactive nil :height x)
|
---|
| 1130 | (set-face-attribute 'mode-line-position-face nil :height x)))
|
---|
| 1131 |
|
---|
| 1132 | (defun zoom-out ()
|
---|
| 1133 | (interactive)
|
---|
| 1134 | (let ((x (- (face-attribute 'default :height)
|
---|
| 1135 | 10)))
|
---|
| 1136 | (set-face-attribute 'default nil :height x)
|
---|
| 1137 | (set-face-attribute 'mode-line nil :height x)
|
---|
| 1138 | (set-face-attribute 'mode-line-inactive nil :height x)
|
---|
| 1139 | (set-face-attribute 'mode-line-position-face nil :height x)))
|
---|
| 1140 |
|
---|
| 1141 | (define-key global-map (kbd "C-=") 'zoom-in)
|
---|
[ec5c135] | 1142 | (define-key global-map (kbd "C-+") 'zoom-out)
|
---|
[8658e39] | 1143 |
|
---|
| 1144 | #+END_SRC
|
---|
[25b6477] | 1145 |
|
---|
[1e08614] | 1146 | ** Автокомплит у yes-or-no
|
---|
[688b524] | 1147 | ** Полный экран
|
---|
| 1148 | Открывать Emacs на полный экран
|
---|
[6650241] | 1149 | #+begin_src emacs-lisp :tangle nil
|
---|
[688b524] | 1150 | (add-to-list 'default-frame-alist '(fullscreen . maximized))
|
---|
| 1151 | #+end_src
|
---|
| 1152 |
|
---|
[c39a878] | 1153 | ** Фуллскрин
|
---|
| 1154 | Отображать ровно столько строчек, сколько вмещает экран.
|
---|
| 1155 |
|
---|
| 1156 | Не работает с native-comp.
|
---|
| 1157 |
|
---|
[1e08614] | 1158 | #+begin_src elisp :tangle nil
|
---|
[c39a878] | 1159 | (toggle-frame-fullscreen)
|
---|
[dbba6d8] | 1160 |
|
---|
| 1161 | (defun fullscreen ()
|
---|
| 1162 | "Fullscreen."
|
---|
| 1163 | (interactive)
|
---|
| 1164 | (x-send-client-message nil 0 nil "_NET_WM_STATE" 32
|
---|
| 1165 | ;; if first parameter is '1', can't toggle fullscreen status
|
---|
| 1166 | '(1 "_NET_WM_STATE_FULLSCREEN" 0)))
|
---|
[c39a878] | 1167 | #+end_src
|
---|
[5acd0cd] | 1168 | ** Удаление буфера и файла
|
---|
| 1169 | #+begin_src elisp :tangle init.el
|
---|
| 1170 | (defun delete-file-and-buffer ()
|
---|
| 1171 | "Kill the current buffer and deletes the file it is visiting."
|
---|
| 1172 | (interactive)
|
---|
| 1173 | (let ((filename (buffer-file-name)))
|
---|
| 1174 | (if filename
|
---|
| 1175 | (if (y-or-n-p (concat "Do you really want to delete file " filename " ?"))
|
---|
| 1176 | (progn
|
---|
| 1177 | (delete-file filename)
|
---|
| 1178 | (message "Deleted file %s." filename)
|
---|
| 1179 | (kill-buffer)))
|
---|
| 1180 | (message "Not a file visiting buffer!"))))
|
---|
| 1181 | #+end_src
|
---|
[d652ebb] | 1182 |
|
---|
| 1183 | ** Длинные строки
|
---|
[3ec75a9] | 1184 | #+begin_src emacs-lisp :tangle nil
|
---|
[d652ebb] | 1185 | ;; Better support for files with long lines
|
---|
| 1186 | (setq-default bidi-paragraph-direction 'left-to-right)
|
---|
| 1187 | (setq-default bidi-inhibit-bpa t)
|
---|
| 1188 | (global-so-long-mode 1)
|
---|
| 1189 | #+end_src
|
---|
| 1190 |
|
---|
| 1191 | ** Make shebang (#!) file executable when saved
|
---|
| 1192 | #+begin_src emacs-lisp :tangle init.el
|
---|
| 1193 | (add-hook 'after-save-hook #'executable-make-buffer-file-executable-if-script-p)
|
---|
| 1194 | #+end_src
|
---|
| 1195 |
|
---|
| 1196 | ** Enable savehist-mode for command history
|
---|
| 1197 | #+begin_src emacs-lisp :tangle init.el
|
---|
| 1198 | (savehist-mode 1)
|
---|
| 1199 | #+end_src
|
---|
[7f6d0e1] | 1200 |
|
---|
| 1201 | ** Ignore case sensitive in completions, search and etc
|
---|
| 1202 | #+begin_src emacs-lisp :tangle init.el
|
---|
[fde9de8] | 1203 | (setq completion-ignore-case t
|
---|
| 1204 | read-buffer-completion-ignore-case t
|
---|
| 1205 | read-file-name-completion-ignore-case t)
|
---|
[7f6d0e1] | 1206 | #+end_src
|
---|
[fde9de8] | 1207 |
|
---|
| 1208 | ** Make scripts executable automatically
|
---|
| 1209 | #+begin_src emacs-lisp :tangle init.el
|
---|
| 1210 | (add-hook 'after-save-hook
|
---|
| 1211 | 'executable-make-buffer-file-executable-if-script-p)
|
---|
| 1212 | #+end_src
|
---|
| 1213 |
|
---|
| 1214 | ** F1 for M-x shell and F2 for grep
|
---|
| 1215 | #+begin_src emacs-lisp :tangle init.el
|
---|
| 1216 | (global-set-key (kbd "<f1>") 'shell)
|
---|
| 1217 | (global-set-key (kbd "<f2>") 'rgrep)
|
---|
| 1218 | #+end_src
|
---|
| 1219 |
|
---|
| 1220 | ** Hippie expand
|
---|
| 1221 | #+begin_src emacs-lisp :tangle init.el
|
---|
| 1222 | (global-set-key [remap dabbrev-expand] 'hippie-expand)
|
---|
| 1223 | #+end_src
|
---|
| 1224 |
|
---|
[fc6fa17] | 1225 | ** Window Divider
|
---|
| 1226 | #+begin_src emacs-lisp :tangle init.el
|
---|
| 1227 | (window-divider-mode t)
|
---|
| 1228 | #+end_src
|
---|
| 1229 |
|
---|
| 1230 | ** Use specific font for major modes
|
---|
| 1231 | #+begin_src emacs-lisp :tangle init.el
|
---|
| 1232 | (buffer-face-mode t)
|
---|
| 1233 |
|
---|
| 1234 | (defun set-normal-font ()
|
---|
| 1235 | "Set normal weight font in current buffer"
|
---|
| 1236 | (interactive)
|
---|
| 1237 | (buffer-face-mode 1)
|
---|
| 1238 | (setq buffer-face-mode-face '(:weight normal))
|
---|
| 1239 | (buffer-face-mode))
|
---|
| 1240 |
|
---|
| 1241 | ;; Use monospaced font faces in current buffer
|
---|
| 1242 | (defun set-bold-font ()
|
---|
| 1243 | "Sets a bold font in current buffer"
|
---|
| 1244 | (interactive)
|
---|
| 1245 | (buffer-face-mode 1)
|
---|
| 1246 | (setq buffer-face-mode-face '(:weight bold))
|
---|
| 1247 | (buffer-face-mode))
|
---|
| 1248 |
|
---|
| 1249 | (add-hook 'dired-mode-hook 'set-normal-font)
|
---|
| 1250 | (add-hook 'org-mode-hook 'set-normal-font)
|
---|
| 1251 | #+end_src
|
---|