Initial commit
This commit is contained in:
commit
63c0eee536
|
@ -0,0 +1,279 @@
|
||||||
|
(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))
|
||||||
|
|
||||||
|
(set-face-attribute 'default nil :font "JetBrains Mono" :height 130)
|
||||||
|
|
||||||
|
(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)
|
||||||
|
|
||||||
|
;;(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)
|
||||||
|
|
||||||
|
;; 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)
|
||||||
|
|
||||||
|
;; theming starts here:
|
||||||
|
|
||||||
|
(use-package modus-themes
|
||||||
|
:ensure t)
|
||||||
|
|
||||||
|
(load-theme 'modus-operandi-tinted t)
|
||||||
|
|
||||||
|
;;(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/")
|
||||||
|
|
||||||
|
;;(use-package doom-themes
|
||||||
|
;; :ensure t
|
||||||
|
;; :config
|
||||||
|
;; (load-theme 'doom-monokai-pro t))
|
||||||
|
|
||||||
|
;; (use-package zenburn-theme
|
||||||
|
;; :ensure t)
|
||||||
|
|
||||||
|
;; (load-theme 'zenburn t)
|
||||||
|
|
||||||
|
;; (use-package birds-of-paradise-plus-theme
|
||||||
|
;; :ensure t)
|
||||||
|
|
||||||
|
;; (load-theme 'birds-of-paradise-plus t)
|
||||||
|
|
||||||
|
;; (use-package spacemacs-theme
|
||||||
|
;; :defer t
|
||||||
|
;; :init (load-theme 'spacemacs-light t))
|
||||||
|
|
||||||
|
;; (use-package poet-theme
|
||||||
|
;; :ensure t)
|
||||||
|
;; (load-theme 'poet t)
|
||||||
|
;; ;;(set-face-attribute 'default nil :family "DejaVu Sans Mono" :height 130)
|
||||||
|
;; (set-face-attribute 'fixed-pitch nil :family "DejaVu Sans Mono")
|
||||||
|
;; (set-face-attribute 'variable-pitch nil :family "IBM Plex Serif")
|
||||||
|
;; (add-to-list
|
||||||
|
;; 'default-frame-alist'(ns-transparent-titlebar . t))
|
||||||
|
;; (add-to-list
|
||||||
|
;; 'default-frame-alist'(ns-appearance . light))
|
||||||
|
;; (add-hook 'text-mode-hook
|
||||||
|
;; (lambda ()
|
||||||
|
;; (variable-pitch-mode 1)))
|
||||||
|
|
||||||
|
(use-package magit
|
||||||
|
:ensure t)
|
||||||
|
|
||||||
|
(use-package doom-modeline
|
||||||
|
:ensure t
|
||||||
|
:hook (after-init . doom-modeline-mode))
|
||||||
|
|
||||||
|
(use-package all-the-icons
|
||||||
|
:if (display-graphic-p))
|
||||||
|
|
||||||
|
;; prettier setup goes here
|
||||||
|
(use-package prettier-js
|
||||||
|
:ensure t)
|
||||||
|
|
||||||
|
;;________________________________________________________
|
||||||
|
|
||||||
|
(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
|
||||||
|
'(tide which-key use-package pyenv-mode flycheck exec-path-from-shell elpy doom-themes doom-modeline all-the-icons)))
|
||||||
|
(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.
|
||||||
|
)
|
Loading…
Reference in New Issue