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

236
.emacs
View File

@ -64,6 +64,10 @@
(point))))
(comment-or-uncomment-region start end)))
(use-package undo-tree
:config (global-undo-tree-mode 1)
:diminish undo-tree-mode)
(use-package evil
:ensure t
:init
@ -77,6 +81,7 @@
;; Need to type out :quit to close emacs
(evil-ex-define-cmd "quit" 'evil-quit)
(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 "w") 'evil-backward-word-begin)
(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 "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-M-\\") 'format-all-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))
(define-key evil-normal-state-map (kbd "C-M-\\") 'format-all-region-or-buffer))
(use-package evil-collection
:after evil
@ -106,7 +100,7 @@
:config
(evil-collection-init))
(use-package verb)
(use-package all-the-icons)
(use-package dashboard
:ensure t
@ -116,17 +110,11 @@
(use-package doom-themes
:ensure t
:config
;; Global settings (defaults)
(setq doom-themes-enable-bold t ; if nil, bold is universally disabled
doom-themes-enable-italic t) ; if nil, italics is universally disabled
(setq doom-themes-enable-bold t
doom-themes-enable-italic 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))
(use-package all-the-icons)
(use-package treemacs
:ensure t
:defer t
@ -188,11 +176,7 @@
treemacs-width-is-initially-locked t
treemacs-workspace-switch-cleanup nil)
;; The default width and height of the icons is 22 pixels. If you are
;; using a Hi-DPI display, uncomment this to double the icon size.
;;(treemacs-resize-icons 44)
(treemacs-follow-mode t)
(treemacs-follow-mode nil)
(treemacs-filewatch-mode t)
(treemacs-fringe-indicator-mode 'always)
(when treemacs-python-executable
@ -232,17 +216,6 @@
:after (treemacs magit)
: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
:init
(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-backward)))
(use-package undo-tree
:config (global-undo-tree-mode 1)
: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 vterm
:ensure t)
(use-package elfeed
:config
(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
:ensure t
: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))
(use-package docker-compose-mode)
(use-package web-mode
:config
(add-to-list 'auto-mode-alist '("\\.jsx?$" . web-mode))
(setq web-mode-content-types-alist '(("jsx" . "\\.js[x]?\\'"))))
(use-package json-mode
:ensure t)
(use-package typescript-mode)
(use-package tide
(use-package web-mode
:ensure t
:after (typescript-mode company flycheck)
:hook ((typescript-mode . tide-setup)
(typescript-mode . tide-hl-identifier-mode)
(before-save . tide-format-before-save)))
:config
(setq web-mode-markup-indent-offset 2)
(setq web-mode-code-indent-offset 2)
(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 go-mode)
(use-package rust-mode)
(use-package cargo)
(use-package ccls
:hook ((c-mode c++-mode objc-mode cuda-mode) .
(lambda () (require 'ccls) (lsp))))
(use-package lsp-mode
:commands (lsp lsp-deferred)
:init
(setq lsp-keymap-prefix "C-c l")
:hook
((go-mode) . lsp)
((rust-mode) . lsp))
:hook (
(elm-mode . lsp-deferred)
(go-mode . lsp-deffered)
(rust-mode . lsp-deffered)
(web-mode . lsp-deferred)
(lsp-mode . lsp-enable-which-key-integration)))
(use-package lsp-ui
:hook (lsp-mode . lsp-ui-mode)
(use-package lsp-ui :commands lsp-ui-mode)
(use-package lsp-treemacs :commands lsp-treemacs-errors-list)
(use-package verb)
(use-package slime
:ensure t
:config
(setq lsp-ui-doc-enable t))
(load (expand-file-name "~/quicklisp/slime-helper.el"))
(setq inferior-lisp-program "sbcl"))
(use-package ccls
:ensure t
:init (setq ccls-executable "/usr/bin/ccls"))
;; C-x SPC -- box select mode
(global-set-key [f11] 'toggle-frame-fullscreen)
(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
:ensure t)
;; Auto-insert braces. Has some counter-intuitive behaviour, unfortunately.
(electric-pair-mode 1)
(setf electric-pair-skip-self nil)
(use-package dash)
(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))
(set-frame-font "Fira Code 11")
;; setup fira code font ligatures
(let ((alist '((33 . ".\\(?:\\(?:\\(?:!\\.\\|!\\)\\|\\(?:==\\|=\\)\\)\\)") ;; !
(35 . ".\\(?:\\(?:[!(:={]\\|\\(?:#\\(?:##\\|#\\)\\|#\\)\\|\\?\\|\\[\\|\\(?:_(\\|_\\)\\)\\)") ;; #
(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)
`([,(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)
(tool-bar-mode -1)
@ -482,12 +475,11 @@ Exempt major modes are defined in `display-line-numbers-exempt-modes'."
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(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"))
'(inhibit-startup-screen t)
'(neo-theme 'icons))
'("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))
(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.
)
)