mirror of
https://github.com/materusPL/nixos-config
synced 2026-07-02 12:46:42 +00:00
configurations: update emacs config
This commit is contained in:
@@ -72,13 +72,15 @@
|
||||
(setq-default cursor-type '(bar . 1))
|
||||
(pixel-scroll-precision-mode 1)
|
||||
|
||||
(context-menu-mode 1)
|
||||
(setq mouse-wheel-follow-mouse 't)
|
||||
(setq scroll-step 1)
|
||||
(setq mouse-drag-and-drop-region t)
|
||||
(telephone-line-mode 1)
|
||||
(setq-default pixel-scroll-precision-large-scroll-height 10.0)
|
||||
(minions-mode 1)
|
||||
(elcord-mode)
|
||||
(unless (daemonp)
|
||||
(elcord-mode 1))
|
||||
|
||||
;Hide startup screen if started with file
|
||||
(defun startup-screen-advice (orig-fun &rest args)
|
||||
@@ -112,9 +114,15 @@
|
||||
(cua-mode 1)
|
||||
(global-set-key (kbd "C-y") 'undo-redo)
|
||||
|
||||
(global-set-key (kbd "C-<tab>") 'indent-rigidly-right-to-tab-stop)
|
||||
(global-set-key (kbd "<backtab>") 'indent-rigidly-left-to-tab-stop)
|
||||
|
||||
|
||||
(define-key key-translation-map (kbd "<XF86Calculator>") 'event-apply-hyper-modifier )
|
||||
(define-key key-translation-map (kbd "<Calculator>") 'event-apply-hyper-modifier )
|
||||
(define-key key-translation-map (kbd "∇") 'event-apply-hyper-modifier )
|
||||
|
||||
;(global-set-key (kbd "C-∇") (kbd "C-H"))
|
||||
;(global-set-key (kbd "H-∇") (lambda () (interactive) (insert-char #x2207)))
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
(defun lsp-booster--advice-json-parse (old-fn &rest args)
|
||||
"Try to parse bytecode instead of json."
|
||||
(or
|
||||
(when (equal (following-char) ?#)
|
||||
(let ((bytecode (read (current-buffer))))
|
||||
(when (byte-code-function-p bytecode)
|
||||
(funcall bytecode))))
|
||||
(apply old-fn args)))
|
||||
(advice-add (if (progn (require 'json)
|
||||
(fboundp 'json-parse-buffer))
|
||||
'json-parse-buffer
|
||||
'json-read)
|
||||
:around
|
||||
#'lsp-booster--advice-json-parse)
|
||||
|
||||
(defun lsp-booster--advice-final-command (old-fn cmd &optional test?)
|
||||
"Prepend emacs-lsp-booster command to lsp CMD."
|
||||
(let ((orig-result (funcall old-fn cmd test?)))
|
||||
(if (and (not test?) ;; for check lsp-server-present?
|
||||
(not (file-remote-p default-directory)) ;; see lsp-resolve-final-command, it would add extra shell wrapper
|
||||
lsp-use-plists
|
||||
(not (functionp 'json-rpc-connection)) ;; native json-rpc
|
||||
(executable-find "emacs-lsp-booster"))
|
||||
(progn
|
||||
(when-let ((command-from-exec-path (executable-find (car orig-result)))) ;; resolve command from exec-path (in case not found in $PATH)
|
||||
(setcar orig-result command-from-exec-path))
|
||||
(message "Using emacs-lsp-booster for %s!" orig-result)
|
||||
(cons "emacs-lsp-booster" orig-result))
|
||||
orig-result)))
|
||||
(advice-add 'lsp-resolve-final-command :around #'lsp-booster--advice-final-command)
|
||||
|
||||
|
||||
(require 'lsp-mode)
|
||||
(require 'lsp-ui)
|
||||
(require 'dap-lldb)
|
||||
(require 'dap-gdb-lldb)
|
||||
|
||||
(with-eval-after-load 'lsp-mode
|
||||
(lsp-register-client
|
||||
(make-lsp-client :new-connection (lsp-stdio-connection "nixd")
|
||||
:major-modes '(nix-mode)
|
||||
:priority 0
|
||||
:server-id 'nixd)))
|
||||
|
||||
|
||||
;; Hooks
|
||||
(add-hook 'c-mode-hook 'lsp-deferred)
|
||||
(add-hook 'c-mode-hook 'display-line-numbers-mode)
|
||||
|
||||
(add-hook 'c++-mode-hook 'lsp-deferred)
|
||||
(add-hook 'c++-mode-hook 'display-line-numbers-mode)
|
||||
|
||||
|
||||
|
||||
(add-hook 'nix-mode-hook 'lsp-deferred)
|
||||
(add-hook 'nix-mode-hook 'display-line-numbers-mode)
|
||||
|
||||
(add-hook 'java-mode-hook 'lsp-deferred)
|
||||
(add-hook 'nix-mode-hook 'display-line-numbers-mode)
|
||||
Reference in New Issue
Block a user