From 96355a39baf4e9231560e2ed9e02ff5197fb1f93 Mon Sep 17 00:00:00 2001 From: ksyasuda Date: Wed, 2 Nov 2022 02:15:58 -0700 Subject: [PATCH] update doom config --- doom/config.el | 123 +++++++++++++++++++++++++++++++++++++++++------ doom/custom.el | 2 +- doom/init.el | 11 +++-- doom/packages.el | 3 ++ 4 files changed, 118 insertions(+), 21 deletions(-) diff --git a/doom/config.el b/doom/config.el index e9221bc..78f7f5a 100644 --- a/doom/config.el +++ b/doom/config.el @@ -34,7 +34,7 @@ ;; `load-theme' function. This is the default: (setq doom-theme 'doom-one) -(setq doom-font (font-spec :family "JetBrains Mono Nerd Font" :size 12.0)) +(setq doom-font (font-spec :family "JetBrainsMono Nerd Font" :size 16 :weight 'medium :dpi 144) doom-unicode-font (font-spec :family "JetBrainsMono Nerd Font" :size 16 :weight 'medium :dpi 144)) ;; This determines the style of line numbers in effect. If set to `nil', line ;; numbers are disabled. For relative line numbers, set this to `relative'. @@ -77,6 +77,55 @@ ;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how ;; they are implemented. +;; make _ part of word +(defadvice evil-inner-word (around underscore-as-word activate) + (let ((table (copy-syntax-table (syntax-table)))) + (modify-syntax-entry ?_ "w" table) + (with-syntax-table table + ad-do-it))) + +;; COPILOT ;; +;; accept completion from copilot and fallback to company +(use-package! copilot + :hook (prog-mode . copilot-mode) + :bind (("C-TAB" . 'copilot-accept-completion-by-word) + ("C-" . 'copilot-accept-completion-by-word) + :map copilot-completion-map + ("C-" . 'copilot-accept-completion) + ("C-SPC" . 'copilot-accept-completion))) + +;; (use-package lsp-pyright +;; :ensure t +;; :hook (python-mode . (lambda () +;; (require 'lsp-pyright) +;; (lsp)))) ; or lsp-deferred + +(use-package lsp-jedi + :ensure t + :config + (with-eval-after-load "lsp-mode" + (add-to-list 'lsp-disabled-clients 'pyls) + (add-to-list 'lsp-enabled-clients 'jedi) + (add-to-list 'lsp-enabled-clients 'bash-ls) + (add-to-list 'lsp-enabled-clients 'lsp))) + + +;; (setq lsp-jedi-workspace-extra-paths +;; (vconcat lsp-jedi-workspace-extra-paths +;; ["/home/me/src/my-project/.venv/lib/python3.10/site-packages"])) + +;; EAF ;; +(add-load-path! (expand-file-name "~/Downloads/emacs-application-framework")) +(require 'eaf) +(require 'eaf-pdf-viewer) +(require 'eaf-browser) +(require 'eaf-jupyter) +(require 'eaf-markdown-previewer) +(require 'eaf-image-viewer) +(require 'eaf-org-previewer) +(require 'eaf-video-player) +(require 'eaf-rss-reader) + ;;-------;; ;; VTERM ;; ;;-------;; @@ -119,10 +168,27 @@ (all-the-icons-dired-mode 1))) (add-hook 'dired-mode-hook 'all-the-icons-dired-mode) + +;; DIRED ;; +(evil-define-key 'normal dired-mode-map + (kbd "M-i") 'dired-display-file + (kbd "h") 'dired-up-directory + (kbd "l") 'dired-open-file + (kbd "C") 'dired-do-copy + (kbd "D") 'dired-do-delete + (kbd "J") 'dired-goto-file + (kbd "M") 'dired-do-chmod + (kbd "O") 'dired-do-chown + (kbd "P") 'dired-do-print + (kbd "R") 'dired-do-rename + (kbd "T") 'dired-do-touch + (kbd "Y") 'dired-copy-filenamecopy + (kbd "+") 'dired-create-directory + (kbd "-") 'dired-up-directory) + ;;-----------;; ;; VARIABLES ;; ;;-----------;; -;; :set relativenumber (setq display-line-numbers-type 'relative) (setq rainbow-delimiters-mode t) (setq confirm-kill-emacs nil) @@ -131,21 +197,8 @@ (setq +pretty-code-enabled-modes nil) (setq prettify-symbols-mode nil) (setq global-prettify-symbols-mode nil) -(setq lsp-diagnostic-package :none) (setq shfmt-arguments '("-i" "0" "-ci" "-sr")) -;; (setq lsp-ui-doc-position 'bottom) -;; (setq lsp-ui-doc-alignment 'window) -;; (setq lsp-ui-doc-max-height 25) -;; (setq lsp-ui-doc-max-width 350) -;; (setq lsp-ui-doc-mode t) -;; (setq lsp-ui-peek-mode t) -;; (setq lsp-ui-peek-enable t) -;; (setq lsp-ui-doc-delay 0.25) - -;; (setq eaf-terminal-font-size 12) -;; (setq lsp-treemacs-sync-mode 1) - ;;--------;; ;; HOOKS ;; ;;--------;; @@ -154,6 +207,32 @@ (add-hook 'python-mode-hook #'lsp) ; or lsp-deferred (add-hook 'sh-mode-hook 'shfmt-on-save-mode 'flycheck-mode) +(setq lsp-ui-sideline-enable t) +(setq lsp-ui-sideline-show-hover t) +(setq lsp-ui-sideline-show-diagnostics t) +(setq lsp-ui-sideline-show-code-actions t) +(setq lsp-ui-sideline-show-code-lenses t) +(setq lsp-ui-sideline-ignore-duplicate t) +(setq lsp-ui-doc-enable t) +(setq lsp-ui-doc-show-with-cursor nil) +(setq lsp-ui-doc-show-with-mouse t) +(setq lsp-ui-doc-position 'at-point) +(setq lsp-ui-doc-header t) +(setq lsp-ui-doc-include-signature t) +(setq lsp-ui-doc-max-width 150) +(setq lsp-ui-doc-max-height 30) +(setq lsp-ui-doc-use-childframe t) +(setq lsp-ui-doc-use-webkit t) +(setq lsp-ui-flycheck-enable t) +(setq lsp-ui-imenu-enable t) +(setq lsp-ui-imenu-kind-position 'top) +(setq lsp-ui-sideline-enable t) +(setq lsp-ui-sideline-show-hover t) +(setq lsp-ui-sideline-show-diagnostics t) +(setq lsp-ui-sideline-show-code-actions t) +(setq lsp-ui-sideline-show-code-lenses t) +(setq lsp-ui-sideline-ignore-duplicate t) + ;;--------;; ;; AFTER ;; ;;--------;; @@ -163,11 +242,17 @@ ;;--------------;; ;; KEYBINDINGS ;; ;;--------------;; +(define-key! "" #'+popup/toggle) + (map! :leader (:prefix ("o" . "+open") :desc "Launch lsp-ui-imenu" "i" #'lsp-ui-imenu)) +(map! :leader + :desc "Toggle lsp-ui-doc" + "c h" #'lsp-ui-doc-glance) + (map! :leader (:prefix ("c" . "+code") :desc "LSP Peek" @@ -182,6 +267,14 @@ :desc "Find definitions" "d" #'lsp-ui-peek-find-definitions))) +(map! :leader + :desc "Toggle vterm" + "t t" #'+vterm/toggle) + +(map! :leader + :desc "Toggle vterm" + "t p" #'+popup/toggle) + (map! :leader :desc "nohls" "s c" #'evil-ex-nohighlight) diff --git a/doom/custom.el b/doom/custom.el index 034e92f..71c2772 100644 --- a/doom/custom.el +++ b/doom/custom.el @@ -3,7 +3,7 @@ ;; 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 '(wakatime-mode))) + '(warning-suppress-types '((doom-init-ui-hook)))) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. diff --git a/doom/init.el b/doom/init.el index 19fae8f..02cec57 100644 --- a/doom/init.el +++ b/doom/init.el @@ -20,7 +20,7 @@ ;;layout ; auie,ctsrnm is the superior home row :completion - company ; the ultimate code completion backend + (company +childframe) ; the ultimate code completion backend ;;helm ; the *other* search engine for love and life ;;ido ; the other *other* search engine... ;;ivy ; a search engine for love and life @@ -35,7 +35,7 @@ hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW ;;hydra ;;indent-guides ; highlighted indent columns - ;; (ligatures +fira) ; ligatures and symbols to make your code pretty again + (ligatures +fira) ; ligatures and symbols to make your code pretty again minimap ; show a map of the code on the side modeline ; snazzy, Atom-inspired modeline, plus API ;;nav-flash ; blink cursor line after big motions @@ -92,7 +92,7 @@ ;;editorconfig ; let someone else argue about tabs vs spaces ein ; tame Jupyter notebooks with emacs (eval +overlay) ; run code, run (also, repls) - ;;gist ; interacting with github gists + gist ; interacting with github gists lookup ; navigate your code and its documentation (lsp +peek) ; M-x vscode magit ; a git porcelain for Emacs @@ -105,6 +105,7 @@ ;;terraform ; infrastructure as code tmux ; an API for interacting with tmux ;;upload ; map local to remote projects via ssh/ftp + tree-sitter :os (:if IS-MAC macos) ; improve compatibility with macOS @@ -164,7 +165,7 @@ (rust +lsp) ; Fe2O3.unwrap().unwrap().unwrap().unwrap() ;;scala ; java, but good ;;(scheme +guile) ; a fully conniving family of lisps - (sh +lsp) ; she sells {ba,z,fi}sh shells on the C xor + (sh +lsp +tree-sitter) ; she sells {ba,z,fi}sh shells on the C xor ;;sml ;;solidity ; do you need a blockchain? No. ;;swift ; who asked for emoji variables? @@ -187,5 +188,5 @@ ;;twitter ; twitter client https://twitter.com/vnought :config - literate + ;; literate (default +bindings +smartparens)) diff --git a/doom/packages.el b/doom/packages.el index 6a19825..e2219c0 100644 --- a/doom/packages.el +++ b/doom/packages.el @@ -58,3 +58,6 @@ (package! treemacs-icons-dired) (package! flycheck) (package! shfmt) +(package! lsp-jedi) +(package! copilot + :recipe (:host github :repo "zerolfx/copilot.el" :files ("*.el" "dist")))