Pending changes

This commit is contained in:
outfoxxed 2023-06-14 10:56:28 -07:00
parent 26b32fb80d
commit 7e71c3e4c7
Signed by: outfoxxed
GPG Key ID: 4C88A185FB89301E
2 changed files with 29 additions and 62 deletions

83
init.el
View File

@ -4,7 +4,7 @@
;; Set theme
(load-theme 'my-theme +1)
;; Use JBMono
(set-frame-font "-JB-JetBrainsMonoNL Nerd Font-normal-normal-normal-*-13-*-*-*-m-0-iso10646-1" nil t)
(set-frame-font "-JB-JetBrainsMonoNL Nerd Font-normal-normal-normal-*-18-*-*-*-m-0-iso10646-1" nil t)
;; Hide GTK scroll bar
(toggle-scroll-bar -1))
@ -36,13 +36,18 @@
mouse-wheel-follow-mouse +1
scroll-step 1) ;; C-n C-p scroll step
;; Disable annoying bell sound
(setq ring-bell-function 'ignore)
;; Highlight matching parens faster
(setq show-paren-delay 0)
(setq tab-width 2)
(defun disable-tabs ()
(setq tab-width 2)
(indent-tabs-mode -1))
(defun enable-tabs ()
(setq tab-width 2)
(indent-tabs-mode +1))
(add-hook 'prog-mode-hook 'enable-tabs)
@ -132,9 +137,6 @@
:config
(add-hook 'prog-mode-hook #'ws-butler-mode))
;; Code folding
(use-package ts-fold)
;; Markdown
(use-package markdown-mode
:init
@ -144,60 +146,18 @@
(use-package string-inflection)
;; Treesitter
(use-package tree-sitter
(use-package treesit
:config
(use-package tree-sitter-langs
:config
(tree-sitter-require 'rust)
(tree-sitter-require 'java)
(tree-sitter-require 'nix))
(add-hook 'tree-sitter-after-on-hook #'ts-fold-mode)
(add-hook 'tree-sitter-after-on-hook #'tree-sitter-hl-mode)
(global-tree-sitter-mode +1))
;; Rust support
(use-package rustic
:after lsp-mode)
;; Nix support
(use-package nix-mode
:mode "\\.nix\\'"
:config
(add-hook 'nix-mode-hook 'disable-tabs))
;; Treesitter based navigation
(use-package evil-textobj-tree-sitter
:after (evil tree-sitter)
:config
(let ((define-scope (lambda (key outer inner)
(define-key evil-outer-text-objects-map key outer)
(define-key evil-inner-text-objects-map key inner)))
(define-jumps (lambda (key name)
(let ((key key) (name name))
(define-key evil-normal-state-map (kbd (concat "]" key))
`(lambda () (interactive)
(evil-textobj-tree-sitter-goto-textobj (concat ',name ".outer"))))
(define-key evil-normal-state-map (kbd (concat "[" key))
`(lambda () (interactive)
(evil-textobj-tree-sitter-goto-textobj (concat ',name ".outer") t)))
(define-key evil-normal-state-map (kbd (concat "]" (upcase key)))
`(lambda () (interactive)
(evil-textobj-tree-sitter-goto-textobj (concat ',name ".outer") nil t)))
(define-key evil-normal-state-map (kbd (concat "[" (upcase key)))
`(lambda () (interactive)
(evil-textobj-tree-sitter-goto-textobj (concat ',name ".outer") t t)))))
))
;; Define new scope symbols for use with i and a
(funcall define-scope "c"
(evil-textobj-tree-sitter-get-textobj "class.outer")
(evil-textobj-tree-sitter-get-textobj "class.inner"))
(funcall define-scope "f"
(evil-textobj-tree-sitter-get-textobj "function.outer")
(evil-textobj-tree-sitter-get-textobj "function.inner"))
;; Define jumps with ] and [
(funcall define-jumps "c" "class")
(funcall define-jumps "f" "function")))
(customize-set-variable 'treesit-font-lock-level 4)
(setq major-mode-remap-alist
'((c-mode . c-ts-mode)
(csharp-mode . csharp-ts-mode)
(cmake-mode . cmake-ts-mode)
(c++-mode . c++-ts-mode)
(css-mode . css-ts-mode)
(java-mode . java-ts-mode)
(json-mode . json-ts-mode)
(python-mode . python-ts-mode))))
;; Highlight operations
(use-package evil-goggles
@ -307,5 +267,14 @@
(use-package lsp-treemacs
:after (lsp-mode treemacs))
(add-to-list 'auto-mode-alist '("\\.rs\\'" . rust-ts-mode))
(add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-ts-mode))
(add-to-list 'auto-mode-alist '("\\.tsx\\'" . typescript-ts-mode))
(add-to-list 'auto-mode-alist '("\\.toml\\'" . toml-ts-mode))
(add-to-list 'auto-mode-alist '("\\.yaml\\'" . yaml-ts-mode))
(add-hook 'rust-ts-mode-hook #'lsp-deferred)
(add-hook 'c++-ts-mode-hook #'lsp-deferred)
(add-hook 'typescript-ts-mode-hook #'lsp-deferred)
(setq gc-cons-threshold (* 1024 1024 100)
read-process-output-max (* 1024 1024))

View File

@ -7,7 +7,8 @@
(if (plist-get args :fg) (if (nth type (plist-get args :fg))
`(:foreground ,(nth type (plist-get args :fg)))))
(if (plist-get args :bg) (if (nth type (plist-get args :bg))
`(:background ,(nth type (plist-get args :bg)))))))))
`(:background ,(nth type (plist-get args :bg)))))
(if (plist-member args :italic) '(:slant italic))))))
`(,face
,`(,(funcall build-face '((min-colors 256)) 0 args)
,(funcall build-face '((min-colors 8)) 1 args))))))
@ -85,13 +86,10 @@
(funcall face 'font-lock-preprocessor-face :fg preprocessor)
(funcall face 'font-lock-function-name-face :fg function)
(funcall face 'font-lock-variable-name-face :fg variable)
(funcall face 'font-lock-property-name-face :fg variable :italic)
(funcall face 'font-lock-string-face :fg string)
(funcall face 'font-lock-type-face :fg type)
;; Treesitter
(funcall face 'tree-sitter-hl-face:function\.call :fg function)
(funcall face 'tree-sitter-hl-face:method\.call :fg function)
;; Lsp
(funcall face 'lsp-face-highlight-textual :bg lsp-hover-highlight)
(funcall face 'lsp-face-highlight-read :bg lsp-hover-highlight)