2023-06-17 12:25:11 +00:00
|
|
|
(require 'package)
|
|
|
|
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
|
|
|
|
(package-initialize)
|
|
|
|
|
|
|
|
(unless (package-installed-p 'use-package)
|
|
|
|
(package-refresh-contents)
|
|
|
|
(package-install 'use-package))
|
|
|
|
|
|
|
|
(use-package which-key
|
|
|
|
:ensure t
|
|
|
|
:config (which-key-mode))
|
|
|
|
|
2023-08-01 17:40:22 +00:00
|
|
|
;; (set-face-attribute 'default nil :font "JetBrains Mono" :height 130)
|
|
|
|
(set-face-attribute 'default nil :font "VictorMono Nerd Font Mono" :height 110)
|
2023-06-17 12:25:11 +00:00
|
|
|
|
|
|
|
(set-default-coding-systems 'utf-8)
|
|
|
|
|
|
|
|
(setq ring-bell-function 'ignore)
|
|
|
|
|
|
|
|
(setq inhibit-startup-message t)
|
|
|
|
|
|
|
|
(setq backup-directory-alist '(("." . "~/.saves")))
|
|
|
|
|
|
|
|
(setq auto-save-default nil)
|
|
|
|
|
|
|
|
(setq-default indent-tabs-mode nil)
|
|
|
|
|
2023-08-01 17:40:22 +00:00
|
|
|
(tool-bar-mode -1)
|
|
|
|
|
2023-06-17 12:25:11 +00:00
|
|
|
;;(setq ido-everywhere t)
|
|
|
|
|
|
|
|
;;(setq ido-enable-flex-matching t)
|
|
|
|
|
|
|
|
(ido-mode)
|
|
|
|
|
|
|
|
(setq show-paren-delay 0)
|
|
|
|
|
|
|
|
(delete-selection-mode 1)
|
|
|
|
|
|
|
|
(show-paren-mode 1)
|
|
|
|
|
|
|
|
(require 'paren)
|
|
|
|
(set-face-background 'show-paren-match (face-background 'default))
|
|
|
|
(set-face-foreground 'show-paren-match "#def")
|
|
|
|
(set-face-attribute 'show-paren-match nil :weight 'extra-bold)
|
|
|
|
|
|
|
|
(add-hook 'before-save-hook 'whitespace-cleanup)
|
|
|
|
|
|
|
|
(use-package elpy
|
|
|
|
:ensure t)
|
|
|
|
|
|
|
|
(use-package flycheck
|
|
|
|
:ensure t)
|
|
|
|
|
|
|
|
(use-package exec-path-from-shell
|
|
|
|
:ensure t)
|
|
|
|
|
|
|
|
(elpy-enable)
|
|
|
|
|
|
|
|
(exec-path-from-shell-copy-env "PATH")
|
|
|
|
|
|
|
|
(when (require 'flycheck nil t)
|
|
|
|
(setq elpy-modules (delq 'elpy-module-flymake elpy-modules))
|
|
|
|
(add-hook 'elpy-mode-hook 'flycheck-mode))
|
|
|
|
|
|
|
|
(add-hook 'elpy-mode-hook (lambda ()
|
|
|
|
(add-hook 'before-save-hook
|
|
|
|
'elpy-format-code nil t)))
|
|
|
|
(add-hook 'python-mode-hook
|
|
|
|
(lambda () (setq gud-pdb-command-name "python3 -m pdb")))
|
|
|
|
|
|
|
|
(use-package pyenv-mode
|
|
|
|
:ensure t)
|
|
|
|
|
|
|
|
(pyenv-mode)
|
|
|
|
|
2023-07-29 14:47:26 +00:00
|
|
|
(use-package yasnippet
|
|
|
|
:config
|
|
|
|
(setq yas-snippet-dirs '("~/.emacs.d/snippets"))
|
|
|
|
(yas-reload-all)
|
|
|
|
(add-hook 'prog-mode-hook 'yas-minor-mode))
|
|
|
|
|
2023-06-17 12:25:11 +00:00
|
|
|
;; setup dired
|
|
|
|
(put 'dired-find-alternate-file 'disabled nil)
|
|
|
|
|
|
|
|
(add-hook 'dired-mode-hook
|
|
|
|
(lambda ()
|
|
|
|
(define-key dired-mode-map (kbd "RET")
|
|
|
|
(lambda () (interactive) (find-alternate-file (dired-get-file-for-visit))))))
|
|
|
|
|
|
|
|
;; my keybindings
|
|
|
|
|
|
|
|
(defun revert-buffer-no-confirm ()
|
|
|
|
(interactive)
|
|
|
|
(revert-buffer :ignore-auto :noconfirm))
|
|
|
|
|
|
|
|
(defun list-buffers-please ()
|
|
|
|
(interactive)
|
|
|
|
(list-buffers)
|
|
|
|
(other-window 1)
|
|
|
|
(delete-other-windows))
|
|
|
|
|
|
|
|
(defun make-json-great-again ()
|
|
|
|
(interactive)
|
|
|
|
(when (string-match-p ".json\\'" (buffer-name))
|
|
|
|
(mark-whole-buffer)
|
|
|
|
(json-pretty-print (region-beginning) (region-end))))
|
|
|
|
|
|
|
|
(global-unset-key (kbd "C-z"))
|
|
|
|
(global-unset-key (kbd "C-v"))
|
|
|
|
(global-unset-key (kbd "C-f"))
|
|
|
|
(global-unset-key (kbd "C-b"))
|
|
|
|
(global-unset-key (kbd "C-n"))
|
|
|
|
(global-unset-key (kbd "C-p"))
|
|
|
|
(global-unset-key (kbd "M-v"))
|
|
|
|
|
|
|
|
(global-set-key (kbd "<f1>") 'list-buffers-please)
|
|
|
|
(global-set-key (kbd "<f5>") 'revert-buffer-no-confirm)
|
|
|
|
|
|
|
|
(add-hook 'elpy-mode-hook
|
|
|
|
(lambda () (local-set-key [f2] 'elpy-refactor-rename)))
|
|
|
|
|
|
|
|
(add-hook 'typescript-mode-hook
|
|
|
|
(lambda () (local-set-key [f2] 'tide-rename-symbol)))
|
|
|
|
|
|
|
|
(add-hook 'typescript-mode-hook
|
|
|
|
(lambda () (local-set-key [f7] 'tide-references)))
|
|
|
|
|
|
|
|
(add-hook 'hs-minor-mode-hook
|
|
|
|
(lambda () (local-set-key (kbd "C-<escape>") 'hs-toggle-hiding)))
|
|
|
|
|
|
|
|
(add-hook 'mhtml-mode-hook
|
|
|
|
(lambda () (local-set-key (kbd "C-f") 'prettier-js)))
|
|
|
|
|
|
|
|
(add-hook 'typescript-mode-hook
|
|
|
|
(lambda () (local-set-key (kbd "C-f") 'prettier-js)))
|
|
|
|
|
|
|
|
(add-hook 'js-mode-hook
|
|
|
|
(lambda () (local-set-key (kbd "C-f") 'make-json-great-again)))
|
|
|
|
|
|
|
|
;; (add-hook 'prog-mode-hook
|
|
|
|
;; (lambda () (local-set-key (kbd "C-;") 'comment-or-uncomment-region)))
|
|
|
|
|
|
|
|
;; stuff for folding html
|
|
|
|
(defun mhtml-forward (arg)
|
|
|
|
(interactive "P")
|
|
|
|
(pcase (get-text-property (point) 'mhtml-submode)
|
|
|
|
('nil (sgml-skip-tag-forward 1))
|
|
|
|
(submode (forward-sexp))))
|
|
|
|
|
|
|
|
(add-to-list 'hs-special-modes-alist
|
|
|
|
'(mhtml-mode
|
|
|
|
"{\\|<[^/>]+?"
|
|
|
|
"}\\|</[^/>]*[^/]>"
|
|
|
|
"<!--"
|
|
|
|
mhtml-forward
|
|
|
|
nil))
|
|
|
|
|
|
|
|
(add-hook 'prog-mode-hook 'hs-minor-mode)
|
|
|
|
|
|
|
|
(require 'display-line-numbers)
|
|
|
|
|
|
|
|
(defcustom display-line-numbers-exempt-modes
|
|
|
|
'(gud-mode inferior-python-mode dired-mode vterm-mode eshell-mode shell-mode term-mode ansi-tern-mode)
|
|
|
|
"Major modes on which to disable line numbers"
|
|
|
|
:group 'display-line-numbers
|
|
|
|
:type 'list
|
|
|
|
:version "green")
|
|
|
|
|
|
|
|
(defun display-line-numbers--turn-on ()
|
|
|
|
"Turn on line numbers except for certain modes.
|
|
|
|
Exempt major modes are defined in `display-line-numbers-exempt-modes'."
|
|
|
|
(unless (or (minibufferp)
|
|
|
|
(member major-mode display-line-numbers-exempt-modes))
|
|
|
|
(display-line-numbers-mode)))
|
|
|
|
|
|
|
|
(global-display-line-numbers-mode)
|
|
|
|
|
2023-08-01 17:40:22 +00:00
|
|
|
(use-package magit
|
2023-06-17 12:25:11 +00:00
|
|
|
:ensure t)
|
|
|
|
|
2023-08-01 17:40:22 +00:00
|
|
|
(use-package doom-modeline
|
|
|
|
:ensure t
|
|
|
|
:hook (after-init . doom-modeline-mode))
|
2023-06-17 12:25:11 +00:00
|
|
|
|
2023-08-01 17:40:22 +00:00
|
|
|
;; M-x nerd-icons-install-fonts
|
|
|
|
(use-package nerd-icons
|
|
|
|
:ensure t)
|
2023-06-17 12:25:11 +00:00
|
|
|
|
2023-08-01 17:40:22 +00:00
|
|
|
(use-package prettier-js
|
|
|
|
:ensure t)
|
2023-06-17 12:25:11 +00:00
|
|
|
|
2023-08-01 17:40:22 +00:00
|
|
|
;; theming starts here:
|
2023-06-17 12:25:11 +00:00
|
|
|
|
2023-08-01 17:40:22 +00:00
|
|
|
(use-package ef-themes
|
|
|
|
:ensure t)
|
2023-06-17 12:25:11 +00:00
|
|
|
|
2023-08-01 17:40:22 +00:00
|
|
|
(setq ef-themes-to-toggle '(ef-day ef-autumn))
|
2023-06-17 12:25:11 +00:00
|
|
|
|
2023-08-01 17:40:22 +00:00
|
|
|
(setq ef-themes-headings ; read the manual's entry or the doc string
|
|
|
|
'((0 . (variable-pitch light 1.9))
|
|
|
|
(1 . (variable-pitch light 1.8))
|
|
|
|
(2 . (variable-pitch regular 1.7))
|
|
|
|
(3 . (variable-pitch regular 1.6))
|
|
|
|
(4 . (variable-pitch regular 1.5))
|
|
|
|
(5 . (variable-pitch 1.4)) ; absence of weight means `bold'
|
|
|
|
(6 . (variable-pitch 1.3))
|
|
|
|
(7 . (variable-pitch 1.2))
|
|
|
|
(t . (variable-pitch 1.1))))
|
2023-06-17 12:25:11 +00:00
|
|
|
|
2023-08-01 17:40:22 +00:00
|
|
|
(setq ef-themes-mixed-fonts t
|
|
|
|
ef-themes-variable-pitch-ui t)
|
2023-06-17 12:25:11 +00:00
|
|
|
|
2023-08-01 17:40:22 +00:00
|
|
|
(mapc #'disable-theme custom-enabled-themes)
|
2023-06-17 12:25:11 +00:00
|
|
|
|
2023-08-01 17:40:22 +00:00
|
|
|
;; (ef-themes-select 'ef-autumn)
|
|
|
|
(load-theme 'modus-operandi-tinted t)
|
2023-06-17 12:25:11 +00:00
|
|
|
|
|
|
|
;;________________________________________________________
|
|
|
|
|
|
|
|
(use-package orderless
|
|
|
|
:ensure t
|
|
|
|
:custom
|
|
|
|
(completion-styles '(orderless basic))
|
|
|
|
(completion-category-overrides '((file (styles basic partial-completion)))))
|
|
|
|
|
|
|
|
(use-package json-mode :ensure t)
|
|
|
|
|
|
|
|
;; __________________________________________________
|
|
|
|
|
|
|
|
|
|
|
|
;; typescript setup starts here (TO REVIEW!)
|
|
|
|
(defun setup-tide-mode ()
|
|
|
|
(interactive)
|
|
|
|
(tide-setup)
|
|
|
|
(flycheck-mode +1)
|
|
|
|
(setq flycheck-check-syntax-automatically '(save mode-enabled))
|
|
|
|
(eldoc-mode +1)
|
|
|
|
(tide-hl-identifier-mode +1)
|
|
|
|
;; company is an optional dependency. You have to
|
|
|
|
;; install it separately via package-install
|
|
|
|
;; `M-x package-install [ret] company`
|
|
|
|
;; (company-mode +1)
|
|
|
|
)
|
|
|
|
|
|
|
|
;; aligns annotation to the right hand side
|
|
|
|
;; (setq company-tooltip-align-annotations t)
|
|
|
|
|
|
|
|
;; formats the buffer before saving
|
|
|
|
;; (add-hook 'before-save-hook 'tide-format-before-save)
|
|
|
|
|
|
|
|
(add-hook 'typescript-mode-hook #'setup-tide-mode)
|
|
|
|
|
|
|
|
(use-package tide
|
|
|
|
:ensure t
|
|
|
|
:after (typescript-mode company flycheck)
|
|
|
|
:hook ((typescript-mode . tide-setup)
|
|
|
|
(typescript-mode . tide-hl-identifier-mode)
|
|
|
|
(before-save . tide-format-before-save)))
|
|
|
|
(custom-set-variables
|
|
|
|
;; custom-set-variables was added by Custom.
|
|
|
|
;; If you edit it by hand, you could mess it up, so be careful.
|
|
|
|
;; Your init file should contain only one such instance.
|
|
|
|
;; If there is more than one, they won't work right.
|
|
|
|
'(package-selected-packages
|
2023-08-01 17:40:22 +00:00
|
|
|
'(ef-themes tide which-key use-package pyenv-mode flycheck exec-path-from-shell elpy doom-themes doom-modeline all-the-icons)))
|
2023-06-17 12:25:11 +00:00
|
|
|
(custom-set-faces
|
|
|
|
;; custom-set-faces was added by Custom.
|
|
|
|
;; If you edit it by hand, you could mess it up, so be careful.
|
|
|
|
;; Your init file should contain only one such instance.
|
|
|
|
;; If there is more than one, they won't work right.
|
|
|
|
)
|