This commit is contained in:
Grant Hunter 2023-09-20 11:30:54 -06:00
parent 158af7a7d1
commit b1261b37cc
2 changed files with 107 additions and 24 deletions

View File

@ -32,9 +32,9 @@
(setq linum-format (setq linum-format
(lambda (line) (lambda (line)
(propertize (number-to-string (1- line)) 'face 'linum))) (propertize (number-to-string (1- line)) 'face 'linum)))
(global-linum-mode) (global-display-line-numbers-mode)
(column-number-mode) (column-number-mode)
(pixel-scroll-precision-mode)
;;keybindings ;;keybindings
(global-set-key (kbd "C-x O") 'previous-multiframe-window) (global-set-key (kbd "C-x O") 'previous-multiframe-window)
@ -88,10 +88,10 @@
(defun my/lsp-mode-setup-completion() (defun my/lsp-mode-setup-completion()
(setf (alist-get 'styles (alist-get 'lsp-capf completion-category-defaults)) (setf (alist-get 'styles (alist-get 'lsp-capf completion-category-defaults))
'(orderless))) ;; Configure orderless '(orderless))) ;; Configure orderless
:hook ((js-mode . lsp-deferred) :hook ((js-ts-mode . lsp-deferred)
(typescript-mode . lsp-deferred) (typescript-ts-mode . lsp-deferred)
(python-mode . lsp-deferred) (python-ts-mode . lsp-deferred)
(sql-mode . lsp-deferred) (sql-ts-mode . lsp-deferred)
(lsp-completion-mode . my/lsp-mode-setup-completion)) (lsp-completion-mode . my/lsp-mode-setup-completion))
:commands (lsp lsp-deferred) :commands (lsp lsp-deferred)
:config (setq lsp-idle-delay 0.500) :config (setq lsp-idle-delay 0.500)
@ -109,12 +109,11 @@
:commands lsp-ui-mode :commands lsp-ui-mode
:config (define-key lsp-ui-mode-map [remap xref-find-definitions] #'lsp-ui-peek-find-definitions) :config (define-key lsp-ui-mode-map [remap xref-find-definitions] #'lsp-ui-peek-find-definitions)
(define-key lsp-ui-mode-map [remap xref-find-references] #'lsp-ui-peek-find-references)) (define-key lsp-ui-mode-map [remap xref-find-references] #'lsp-ui-peek-find-references))
(use-package (use-package
dap-mode dap-mode
:config :config
(setq dap-auto-configure-features '(sessions locals controls tooltip)) (setq dap-auto-configure-features '(sessions locals controls tooltip)))
(require 'dap-node)
(dap-node-setup))
(use-package vertico (use-package vertico
@ -285,14 +284,76 @@
(use-package (use-package
flycheck) flycheck)
(use-package (use-package treesit
tree-sitter :straight nil
:init :preface
(global-tree-sitter-mode) (defun mp-setup-install-grammars ()
:hook (tree-sitter-after-on-hook . #'tree-sitter-hl-mode)) "Install Tree-sitter grammars if they are absent."
(interactive)
(dolist (grammar
'((bash "https://github.com/tree-sitter/tree-sitter-bash")
(cmake "https://github.com/uyha/tree-sitter-cmake")
(css "https://github.com/tree-sitter/tree-sitter-css")
(elisp "https://github.com/Wilfred/tree-sitter-elisp")
(go "https://github.com/tree-sitter/tree-sitter-go")
(html "https://github.com/tree-sitter/tree-sitter-html")
(javascript "https://github.com/tree-sitter/tree-sitter-javascript" "master" "src")
(json "https://github.com/tree-sitter/tree-sitter-json")
(make "https://github.com/alemuller/tree-sitter-make")
(markdown "https://github.com/ikatyang/tree-sitter-markdown")
(python "https://github.com/tree-sitter/tree-sitter-python")
(toml "https://github.com/tree-sitter/tree-sitter-toml")
(tsx "https://github.com/tree-sitter/tree-sitter-typescript" "master" "tsx/src")
(typescript "https://github.com/tree-sitter/tree-sitter-typescript" "master" "typescript/src")
(yaml "https://github.com/ikatyang/tree-sitter-yaml")))
(add-to-list 'treesit-language-source-alist grammar)
;; Only install `grammar' if we don't already have it
;; installed. However, if you want to *update* a grammar then
;; this obviously prevents that from happening.
(unless (treesit-language-available-p (car grammar))
(treesit-install-language-grammar (car grammar)))))
(use-package ;; Optional, but recommended. Tree-sitter enabled major modes are
tree-sitter-langs) ;; distinct from their ordinary counterparts.
;;
;; You can remap major modes with `major-mode-remap-alist'. Note
;; that this does *not* extend to hooks! Make sure you migrate them
;; also
(dolist (mapping '((python-mode . python-ts-mode)
(css-mode . css-ts-mode)
(typescript-mode . tsx-ts-mode)
(json-mode . json-ts-mode)
(js-mode . js-ts-mode)
(css-mode . css-ts-mode)
(yaml-mode . yaml-ts-mode)))
(add-to-list 'major-mode-remap-alist mapping))
:config
(mp-setup-install-grammars)
;; Do not forget to customize Combobulate to your liking:
;;
;; M-x customize-group RET combobulate RET
;;
(use-package combobulate
:preface
;; You can customize Combobulate's key prefix here.
;; Note that you may have to restart Emacs for this to take effect!
(setq combobulate-key-prefix "C-c o")
;; Optional, but recommended.
;;
;; You can manually enable Combobulate with `M-x
;; combobulate-mode'.
:hook ((python-ts-mode . combobulate-mode)
(js-ts-mode . combobulate-mode)
(css-ts-mode . combobulate-mode)
(yaml-ts-mode . combobulate-mode)
(json-ts-mode . combobulate-mode)
(typescript-ts-mode . combobulate-mode)
(tsx-ts-mode . combobulate-mode))
;; Amend this to the directory where you keep Combobulate's source
;; code.
))
;;python ;;python
(use-package (use-package
@ -311,7 +372,7 @@
(use-package (use-package
blacken blacken
:after lsp-mode :after lsp-mode
:hook (python-mode . blacken-mode)) :hook (python-ts-mode . blacken-mode))
(use-package (use-package
py-isort py-isort
@ -323,22 +384,34 @@
:config (setq lsp-pyright-venv-path "~/.pyenv/version") :config (setq lsp-pyright-venv-path "~/.pyenv/version")
:if (executable-find "pyright") :if (executable-find "pyright")
;; To properly load `lsp-pyright', the `require' instruction is important. ;; To properly load `lsp-pyright', the `require' instruction is important.
:hook (python-mode . (lambda () :hook (python-ts-mode . (lambda ()
(require 'lsp-pyright) (require 'lsp-pyright))))
(eglot))))
;; js/ts ;; js/ts
(setq typescript-indent-level 2)
(use-package (use-package
prettier-js prettier-js
:after lsp-mode :after lsp-mode
:hook ((js-mode . prettier-js-mode) :hook ((js-mode . prettier-js-mode)
(typescript-mode . prettier-js-mode))) (typescript-mode . prettier-js-mode))
:config
(setq typescript-indent-level 2)
(require 'dap-node)
(dap-node-setup))
(use-package (use-package
typescript-mode typescript-mode
:hook (before-save . (lambda () (lsp-organize-imports)))) :hook (before-save . (lambda () (lsp-organize-imports))))
(use-package
jest-test-mode
:straight '(jest-test-mode :type git :host github :repo "grantdhunter/jest-test-mode")
:commands jest-test-mode
:hook (typescript-mode))
;; java
(use-package
lsp-java
:config (add-hook 'java-mode-hook 'lsp-deferred))
;; misc langs ;; misc langs
(use-package (use-package
@ -401,6 +474,13 @@
;; If you edit it by hand, you could mess it up, so be careful. ;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance. ;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right. ;; If there is more than one, they won't work right.
'(custom-safe-themes
'("f149d9986497e8877e0bd1981d1bef8c8a6d35be7d82cba193ad7e46f0989f6a" default))
'(jest-test-command-string "yarn run %s jest %s %s")
'(lsp-ui-doc-position 'bottom)
'(lsp-ui-doc-show-with-mouse nil)
'(lsp-ui-sideline-diagnostic-max-line-length 150)
'(lsp-ui-sideline-diagnostic-max-lines 10)
'(safe-local-variable-values '(safe-local-variable-values
'((eval let '((eval let
((sdks-directory ((sdks-directory

7
zshrc
View File

@ -7,8 +7,11 @@ export ZSH=$HOME/.oh-my-zsh
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes # See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="zhann" ZSH_THEME="zhann"
plugins=(git) plugins=(git
aws
kubectx)
RPS1="$RPS1 "'$(kubectx_prompt_info)'
source $ZSH/oh-my-zsh.sh source $ZSH/oh-my-zsh.sh
setopt noincappendhistory setopt noincappendhistory
@ -34,7 +37,7 @@ export PATH=$PATH:$HOME/.krew/bin
export PATH=$PATH:$HOME/.linkerd2/bin export PATH=$PATH:$HOME/.linkerd2/bin
export PATH=$PATH:/usr/local/swift/bin export PATH=$PATH:/usr/local/swift/bin
export PATH=$PATH:$HOME/.cargo/bin export PATH=$PATH:$HOME/.cargo/bin
source <(kubectl completion zsh) [[ $commands[kubectl] ]] && source <(kubectl completion zsh)
# python setup # python setup
export PYENV_ROOT="$HOME/.pyenv" export PYENV_ROOT="$HOME/.pyenv"