Fix undo tree, add slime, better linum mode, web mode, better lsp ui/treemacs

Fix undo tree, add slime, add better linum mode, add web mode, add better lsp ui/treemacs, move stuff to more logical place
This commit is contained in:
zongor 2023-10-29 19:01:03 -04:00
parent 3fb73b6888
commit c71358cf7e
1 changed files with 114 additions and 122 deletions

234
.emacs
View File

@ -64,6 +64,10 @@
(point)))) (point))))
(comment-or-uncomment-region start end))) (comment-or-uncomment-region start end)))
(use-package undo-tree
:config (global-undo-tree-mode 1)
:diminish undo-tree-mode)
(use-package evil (use-package evil
:ensure t :ensure t
:init :init
@ -77,6 +81,7 @@
;; Need to type out :quit to close emacs ;; Need to type out :quit to close emacs
(evil-ex-define-cmd "quit" 'evil-quit) (evil-ex-define-cmd "quit" 'evil-quit)
(define-key evil-normal-state-map (kbd "C-\\") 'comment-eclipse) (define-key evil-normal-state-map (kbd "C-\\") 'comment-eclipse)
(define-key evil-normal-state-map (kbd "u") 'undo-tree-undo)
(define-key evil-normal-state-map (kbd "q") 'undo-tree-redo) (define-key evil-normal-state-map (kbd "q") 'undo-tree-redo)
(define-key evil-normal-state-map (kbd "w") 'evil-backward-word-begin) (define-key evil-normal-state-map (kbd "w") 'evil-backward-word-begin)
(define-key evil-normal-state-map (kbd "H") 'evil-first-non-blank) (define-key evil-normal-state-map (kbd "H") 'evil-first-non-blank)
@ -87,18 +92,7 @@
(define-key evil-normal-state-map (kbd "M-/") 'dabbrev-expand) (define-key evil-normal-state-map (kbd "M-/") 'dabbrev-expand)
(define-key evil-normal-state-map (kbd "C-,") 'move-to-previous-window) (define-key evil-normal-state-map (kbd "C-,") 'move-to-previous-window)
(define-key evil-normal-state-map (kbd "C-.") 'move-to-next-window) (define-key evil-normal-state-map (kbd "C-.") 'move-to-next-window)
(define-key evil-normal-state-map (kbd "C-M-\\") 'format-all-buffer) (define-key evil-normal-state-map (kbd "C-M-\\") 'format-all-region-or-buffer))
;; (evil-define-key 'normal Buffer-menu-mode-map (kbd "RET") )
(evil-define-key 'normal neotree-mode-map (kbd "TAB") 'neotree-enter)
(evil-define-key 'normal neotree-mode-map (kbd "SPC") 'neotree-quick-look)
(evil-define-key 'normal neotree-mode-map (kbd "q") 'neotree-hide)
(evil-define-key 'normal neotree-mode-map (kbd "RET") 'neotree-enter)
(evil-define-key 'normal neotree-mode-map (kbd "g") 'neotree-refresh)
(evil-define-key 'normal neotree-mode-map (kbd "n") 'neotree-next-line)
(evil-define-key 'normal neotree-mode-map (kbd "p") 'neotree-previous-line)
(evil-define-key 'normal neotree-mode-map (kbd "A") 'neotree-stretch-toggle)
(evil-define-key 'normal neotree-mode-map (kbd "H") 'neotree-hidden-file-toggle))
(use-package evil-collection (use-package evil-collection
:after evil :after evil
@ -106,7 +100,7 @@
:config :config
(evil-collection-init)) (evil-collection-init))
(use-package verb) (use-package all-the-icons)
(use-package dashboard (use-package dashboard
:ensure t :ensure t
@ -116,17 +110,11 @@
(use-package doom-themes (use-package doom-themes
:ensure t :ensure t
:config :config
;; Global settings (defaults) (setq doom-themes-enable-bold t
(setq doom-themes-enable-bold t ; if nil, bold is universally disabled doom-themes-enable-italic t)
doom-themes-enable-italic t) ; if nil, italics is universally disabled
(load-theme 'doom-monokai-classic t) (load-theme 'doom-monokai-classic t)
;; Enable custom neotree theme (all-the-icons must be installed!)
(doom-themes-neotree-config)
;; Corrects (and improves) org-mode's native fontification.
(doom-themes-org-config)) (doom-themes-org-config))
(use-package all-the-icons)
(use-package treemacs (use-package treemacs
:ensure t :ensure t
:defer t :defer t
@ -188,11 +176,7 @@
treemacs-width-is-initially-locked t treemacs-width-is-initially-locked t
treemacs-workspace-switch-cleanup nil) treemacs-workspace-switch-cleanup nil)
;; The default width and height of the icons is 22 pixels. If you are (treemacs-follow-mode nil)
;; using a Hi-DPI display, uncomment this to double the icon size.
;;(treemacs-resize-icons 44)
(treemacs-follow-mode t)
(treemacs-filewatch-mode t) (treemacs-filewatch-mode t)
(treemacs-fringe-indicator-mode 'always) (treemacs-fringe-indicator-mode 'always)
(when treemacs-python-executable (when treemacs-python-executable
@ -232,17 +216,6 @@
:after (treemacs magit) :after (treemacs magit)
:ensure t) :ensure t)
(use-package treemacs-persp ;;treemacs-perspective if you use perspective.el vs. persp-mode
:after (treemacs persp-mode) ;;or perspective vs. persp-mode
:ensure t
:config (treemacs-set-scope-type 'Perspectives))
(use-package treemacs-tab-bar ;;treemacs-tab-bar if you use tab-bar-mode
:after (treemacs)
:ensure t
:config (treemacs-set-scope-type 'Tabs))
(use-package centaur-tabs (use-package centaur-tabs
:init :init
(setq centaur-tabs-enable-key-bindings t) (setq centaur-tabs-enable-key-bindings t)
@ -321,24 +294,63 @@ Other buffer group by `centaur-tabs-get-group-name' with project name."
("g t" . centaur-tabs-forward) ("g t" . centaur-tabs-forward)
("g T" . centaur-tabs-backward))) ("g T" . centaur-tabs-backward)))
(use-package undo-tree (use-package vterm
:config (global-undo-tree-mode 1) :ensure t)
:diminish undo-tree-mode)
(use-package format-all
:hook ((format-all-mode-hook . format-all-ensure-formatter)))
(use-package rainbow-delimiters
:hook ((prog-mode-hook . rainbow-delimiters-mode)))
(use-package dumb-jump
:hook ((xref-backend-functions . dumb-jump-xref-activate)))
(use-package elfeed (use-package elfeed
:config :config
(global-set-key (kbd "C-x w") 'elfeed)) (global-set-key (kbd "C-x w") 'elfeed))
(use-package restclient) (use-package projectile
:config
(setq company-minimum-prefix-length 1
company-idle-delay 0.0))
(use-package company
:ensure t
:config (global-company-mode t))
(use-package which-key
:ensure t
:config
(which-key-mode))
(use-package column-enforce-mode
:init
(global-column-enforce-mode))
(use-package magit
:ensure t
:bind (
("C-x g" . magit-status)))
(use-package magit-lfs
:ensure t
:pin melpa)
(use-package forge
:after magit)
(use-package git-gutter
:ensure t
:init (global-git-gutter-mode t))
(require 'display-line-numbers)
(defcustom display-line-numbers-exempt-modes
'(vterm-mode eshell-mode shell-mode term-mode ansi-term-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 major 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)))
(display-line-numbers--turn-on)
;;(global-display-line-numbers-mode)
(use-package markdown-mode (use-package markdown-mode
:ensure t :ensure t
:mode ("README\\.md\\'" . gfm-mode) :mode ("README\\.md\\'" . gfm-mode)
@ -349,61 +361,73 @@ Other buffer group by `centaur-tabs-get-group-name' with project name."
:bind ("C-c d" . docker)) :bind ("C-c d" . docker))
(use-package docker-compose-mode) (use-package docker-compose-mode)
(use-package web-mode (use-package json-mode
:config :ensure t)
(add-to-list 'auto-mode-alist '("\\.jsx?$" . web-mode))
(setq web-mode-content-types-alist '(("jsx" . "\\.js[x]?\\'"))))
(use-package typescript-mode) (use-package web-mode
(use-package tide
:ensure t :ensure t
:after (typescript-mode company flycheck) :config
:hook ((typescript-mode . tide-setup) (setq web-mode-markup-indent-offset 2)
(typescript-mode . tide-hl-identifier-mode) (setq web-mode-code-indent-offset 2)
(before-save . tide-format-before-save))) (setq web-mode-css-indent-offset 2)
:mode (("\\.js\\'" . web-mode)
("\\.jsx\\'" . web-mode)
("\\.ts\\'" . web-mode)
("\\.tsx\\'" . web-mode)
("\\.html\\'" . web-mode))
:commands web-mode)
(use-package prettier-js
:ensure t)
(add-hook 'web-mode-hook #'(lambda ()
(enable-minor-mode
'("\\.jsx?\\'" . prettier-js-mode))
(enable-minor-mode
'("\\.tsx?\\'" . prettier-js-mode))))
(use-package elm-mode) (use-package elm-mode)
(use-package go-mode) (use-package go-mode)
(use-package rust-mode) (use-package rust-mode)
(use-package cargo) (use-package cargo)
(use-package ccls
:hook ((c-mode c++-mode objc-mode cuda-mode) .
(lambda () (require 'ccls) (lsp))))
(use-package lsp-mode (use-package lsp-mode
:commands (lsp lsp-deferred) :commands (lsp lsp-deferred)
:init :init
(setq lsp-keymap-prefix "C-c l") (setq lsp-keymap-prefix "C-c l")
:hook :hook (
((go-mode) . lsp) (elm-mode . lsp-deferred)
((rust-mode) . lsp)) (go-mode . lsp-deffered)
(rust-mode . lsp-deffered)
(web-mode . lsp-deferred)
(lsp-mode . lsp-enable-which-key-integration)))
(use-package lsp-ui (use-package lsp-ui :commands lsp-ui-mode)
:hook (lsp-mode . lsp-ui-mode) (use-package lsp-treemacs :commands lsp-treemacs-errors-list)
(use-package verb)
(use-package slime
:ensure t
:config :config
(setq lsp-ui-doc-enable t)) (load (expand-file-name "~/quicklisp/slime-helper.el"))
(setq inferior-lisp-program "sbcl"))
(use-package ccls ;; C-x SPC -- box select mode
:ensure t (global-set-key [f11] 'toggle-frame-fullscreen)
:init (setq ccls-executable "/usr/bin/ccls")) (global-set-key (kbd "C-s") 'ripgrep-regexp)
(global-set-key (kbd "M-i") 'xref-find-definitions)
(global-set-key (kbd "C-M-i") 'xref-pop-marker-stack)
(use-package vterm ;; Auto-insert braces. Has some counter-intuitive behaviour, unfortunately.
:ensure t) (electric-pair-mode 1)
(setf electric-pair-skip-self nil)
(use-package dash) (set-frame-font "Fira Code 11")
(use-package column-enforce-mode)
(use-package desktop)
(use-package magit)
(use-package magit-lfs
:ensure t
:pin melpa)
(use-package forge
:after magit)
(use-package ripgrep)
(use-package projectile)
(use-package ivy)
(use-package git-gutter
:ensure t
:init (global-git-gutter-mode t))
;; setup fira code font ligatures
(let ((alist '((33 . ".\\(?:\\(?:\\(?:!\\.\\|!\\)\\|\\(?:==\\|=\\)\\)\\)") ;; ! (let ((alist '((33 . ".\\(?:\\(?:\\(?:!\\.\\|!\\)\\|\\(?:==\\|=\\)\\)\\)") ;; !
(35 . ".\\(?:\\(?:[!(:={]\\|\\(?:#\\(?:##\\|#\\)\\|#\\)\\|\\?\\|\\[\\|\\(?:_(\\|_\\)\\)\\)") ;; # (35 . ".\\(?:\\(?:[!(:={]\\|\\(?:#\\(?:##\\|#\\)\\|#\\)\\|\\?\\|\\[\\|\\(?:_(\\|_\\)\\)\\)") ;; #
(36 . ".\\(?:>\\)") ;; $ (36 . ".\\(?:>\\)") ;; $
@ -437,37 +461,6 @@ Other buffer group by `centaur-tabs-get-group-name' with project name."
(set-char-table-range composition-function-table (car char-regexp) (set-char-table-range composition-function-table (car char-regexp)
`([,(cdr char-regexp) 0 font-shape-gstring])))) `([,(cdr char-regexp) 0 font-shape-gstring]))))
(set-frame-font "Fira Code 11")
;; Auto-insert braces. Has some counter-intuitive behaviour, unfortunately.
(electric-pair-mode 1)
(setf electric-pair-skip-self nil)
(require 'display-line-numbers)
(defcustom display-line-numbers-exempt-modes
'(vterm-mode eshell-mode shell-mode term-mode ansi-term-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 major 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-set-key [f11] 'toggle-frame-fullscreen)
(global-set-key (kbd "C-s") 'ripgrep-regexp)
(global-set-key (kbd "C-,") 'move-to-previous-window)
(global-set-key (kbd "C-.") 'move-to-next-window)
(global-set-key (kbd "M-i") 'xref-find-definitions)
(global-set-key (kbd "C-M-i") 'xref-pop-marker-stack)
(global-column-enforce-mode)
(global-display-line-numbers-mode)
(scroll-bar-mode -1) (scroll-bar-mode -1)
(tool-bar-mode -1) (tool-bar-mode -1)
@ -482,9 +475,8 @@ Exempt major modes are defined in `display-line-numbers-exempt-modes'."
;; 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.
'(elfeed-feeds '(elfeed-feeds
'("https://lemmy.ml/feeds/local.xml?sort=Active" "https://www.hexbear.net/feeds/all.xml?sort=Active" "https://xkcd.com/atom.xml" "https://www.existentialcomics.com/rss.xml" "https://hackaday.com/blog/feed/" "https://itsfoss.com/feed/" "http://git.9front.org/plan9front/plan9front/HEAD/feed.rss" "https://www.gnu.org/software/hurd/index.rss" "https://steamcommunity.com/groups/GrabFreeGames/rss/" "https://feeds.npr.org/1001/rss.xml" "https://www.scmp.com/rss/91/feed" "https://www.currentaffairs.org/feed" "https://libcom.org/rss.xml/feed" "https://itsgoingdown.org/feed" "https://cosmonaut.blog/rss" "https://yewtu.be/feed/private?token=QaRbw6HeUUNTi5K24U6eMWSw9xYjYc0ARTeUcZK1pJA=" "http://feeds.ancientfaith.com/AmonSul" "https://feeds.transistor.fm/the-magnificast" "https://anchor.fm/s/c38df04/podcast/rss" "https://yogpod.libsyn.com/rss" "https://revolutionspodcast.libsyn.com/rss" "https://feeds.acast.com/public/shows/5e7b777ba085cbe7192b0607" "https://www.omnycontent.com/d/playlist/aaea4e69-af51-495e-afc9-a9760146922b/48da3539-5da0-41ed-a1c3-aac50170b88f/f7810480-e2d3-4be5-a559-aac50170b8a6/podcast.rss" "https://feeds.soundcloud.com/users/soundcloud:users:672423809/sounds.rss" "https://www.omnycontent.com/d/playlist/aaea4e69-af51-495e-afc9-a9760146922b/4a3ca742-9a68-4850-a727-ab790176c0e9/d04153b0-fc4c-4191-ab18-ab790179c563/podcast.rss" "https://feeds.soundcloud.com/users/soundcloud:users:211911700/sounds.rss" "https://access.acast.com/rss/5fd1001d81367d4cb41fe325/Q6BVQ6VF" "https://feeds.npr.org/344098539/podcast.xml")) '("https://www.hexbear.net/feeds/all.xml?sort=Active" "https://xkcd.com/atom.xml" "https://www.existentialcomics.com/rss.xml" "https://hackaday.com/blog/feed/" "https://itsfoss.com/feed/" "http://git.9front.org/plan9front/plan9front/HEAD/feed.rss" "https://www.gnu.org/software/hurd/index.rss" "https://steamcommunity.com/groups/GrabFreeGames/rss/" "https://feeds.npr.org/1001/rss.xml" "https://www.scmp.com/rss/91/feed" "https://www.currentaffairs.org/feed" "https://libcom.org/rss.xml/feed" "https://itsgoingdown.org/feed" "https://cosmonaut.blog/rss" "https://yewtu.be/feed/private?token=QaRbw6HeUUNTi5K24U6eMWSw9xYjYc0ARTeUcZK1pJA=" "http://feeds.ancientfaith.com/AmonSul" "https://feeds.transistor.fm/the-magnificast" "https://anchor.fm/s/c38df04/podcast/rss" "https://yogpod.libsyn.com/rss" "https://revolutionspodcast.libsyn.com/rss" "https://feeds.acast.com/public/shows/5e7b777ba085cbe7192b0607" "https://www.omnycontent.com/d/playlist/aaea4e69-af51-495e-afc9-a9760146922b/48da3539-5da0-41ed-a1c3-aac50170b88f/f7810480-e2d3-4be5-a559-aac50170b8a6/podcast.rss" "https://feeds.soundcloud.com/users/soundcloud:users:672423809/sounds.rss" "https://www.omnycontent.com/d/playlist/aaea4e69-af51-495e-afc9-a9760146922b/4a3ca742-9a68-4850-a727-ab790176c0e9/d04153b0-fc4c-4191-ab18-ab790179c563/podcast.rss" "https://feeds.soundcloud.com/users/soundcloud:users:211911700/sounds.rss" "https://access.acast.com/rss/5fd1001d81367d4cb41fe325/Q6BVQ6VF" "https://feeds.npr.org/344098539/podcast.xml"))
'(inhibit-startup-screen t) '(inhibit-startup-screen t))
'(neo-theme 'icons))
(custom-set-faces (custom-set-faces
;; custom-set-faces was added by Custom. ;; custom-set-faces was added by Custom.
;; 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.