mirror of
https://github.com/materusPL/nixos-config
synced 2026-07-02 12:46:42 +00:00
configurations: emacs and plasma-manger changes, crypt.sh formatting
This commit is contained in:
@@ -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)
|
||||
@@ -0,0 +1,74 @@
|
||||
(defvar bootstrap-version)
|
||||
(defvar straight-base-dir)
|
||||
(setq straight-base-dir (concat user-emacs-directory "var/" ))
|
||||
(let ((bootstrap-file
|
||||
(expand-file-name
|
||||
"straight/repos/straight.el/bootstrap.el"
|
||||
(or (bound-and-true-p straight-base-dir)
|
||||
user-emacs-directory)))
|
||||
(bootstrap-version 7))
|
||||
(unless (file-exists-p bootstrap-file)
|
||||
(with-current-buffer
|
||||
(url-retrieve-synchronously
|
||||
"https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
|
||||
'silent 'inhibit-cookies)
|
||||
(goto-char (point-max))
|
||||
(eval-print-last-sexp)))
|
||||
(load bootstrap-file nil 'nomessage))
|
||||
|
||||
(straight-use-package 'elcord)
|
||||
(straight-use-package 'persp-mode)
|
||||
(straight-use-package 'dashboard)
|
||||
(straight-use-package 'magit)
|
||||
(straight-use-package 'helm)
|
||||
(straight-use-package 'avy)
|
||||
(straight-use-package 'corfu)
|
||||
(straight-use-package 'vterm)
|
||||
(straight-use-package 'centaur-tabs)
|
||||
(straight-use-package 'projectile)
|
||||
(straight-use-package 'company)
|
||||
(straight-use-package 'clipetty)
|
||||
(straight-use-package 'which-key)
|
||||
(straight-use-package 'iedit)
|
||||
(straight-use-package 'hideshowvis)
|
||||
(straight-use-package 'evil)
|
||||
(straight-use-package 'treemacs-evil)
|
||||
(straight-use-package 'treemacs)
|
||||
(straight-use-package 'treemacs-nerd-icons)
|
||||
(straight-use-package 'treemacs-perspective)
|
||||
(straight-use-package 'treemacs-icons-dired)
|
||||
(straight-use-package 'treemacs-magit)
|
||||
(straight-use-package 'treemacs-projectile)
|
||||
(straight-use-package 'tree-edit)
|
||||
(straight-use-package 'vertico)
|
||||
(straight-use-package 'nerd-icons)
|
||||
(straight-use-package 'nerd-icons-completion)
|
||||
(straight-use-package 'perspective)
|
||||
(straight-use-package 'minions)
|
||||
(straight-use-package 'telephone-line)
|
||||
(straight-use-package 'rainbow-delimiters)
|
||||
(straight-use-package 'use-package)
|
||||
(straight-use-package 'cmake-mode)
|
||||
(straight-use-package 'lsp-mode)
|
||||
(straight-use-package 'lsp-java)
|
||||
(straight-use-package 'lsp-jedi)
|
||||
(straight-use-package 'lsp-haskell)
|
||||
(straight-use-package 'lsp-ui)
|
||||
(straight-use-package 'lsp-treemacs)
|
||||
(straight-use-package 'dap-mode)
|
||||
(straight-use-package 'd-mode)
|
||||
(straight-use-package 'lua-mode)
|
||||
(straight-use-package 'multiple-cursors)
|
||||
(straight-use-package 'org)
|
||||
(straight-use-package 'org-rainbow-tags)
|
||||
(straight-use-package 'org-roam)
|
||||
(straight-use-package 'org-roam-ui)
|
||||
(straight-use-package 'org-review)
|
||||
(straight-use-package 'csharp-mode)
|
||||
(straight-use-package 'markdown-mode)
|
||||
(straight-use-package 'json-mode)
|
||||
(straight-use-package 'nix-mode)
|
||||
(straight-use-package 'no-littering)
|
||||
(straight-use-package 'right-click-context)
|
||||
(straight-use-package 'moe-theme)
|
||||
(straight-use-package 'doom-themes)
|
||||
@@ -0,0 +1,132 @@
|
||||
(require 'recentf)
|
||||
(require 'no-littering)
|
||||
(add-to-list 'recentf-exclude
|
||||
(recentf-expand-file-name no-littering-var-directory))
|
||||
(add-to-list 'recentf-exclude
|
||||
(recentf-expand-file-name no-littering-etc-directory))
|
||||
|
||||
(setq native-comp-async-report-warnings-errors nil)
|
||||
(setq package-enable-at-startup nil)
|
||||
(setq frame-inhibit-implied-resize t)
|
||||
(defvar materus/init-early nil)
|
||||
(unless materus/init-early
|
||||
(tool-bar-mode -1)
|
||||
(setq initial-major-mode 'fundamental-mode)
|
||||
(setq-default package-quickstart t)
|
||||
(setq native-comp-speed 3)
|
||||
(add-hook 'emacs-startup-hook (lambda () (package-initialize)
|
||||
(setq gc-cons-threshold 100000000 ; ~100mb
|
||||
gc-cons-percentage 0.1)
|
||||
))
|
||||
(unless (daemonp)
|
||||
(setq gc-cons-threshold most-positive-fixnum ; 2^61 bytes
|
||||
gc-cons-percentage 0.6)
|
||||
(setq package-enable-at-startup nil)
|
||||
|
||||
(advice-add #'tty-run-terminal-initialization :override #'ignore)
|
||||
(add-hook 'window-setup-hook
|
||||
(lambda ()
|
||||
(advice-remove #'tty-run-terminal-initialization #'ignore)
|
||||
(tty-run-terminal-initialization (selected-frame) nil t)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
|
||||
(setq custom-file (concat user-emacs-directory "etc/custom.el"))
|
||||
|
||||
(setq auto-save-default nil)
|
||||
(setq backup-directory-alist
|
||||
`((".*" . ,(concat user-emacs-directory "var/backups/"))))
|
||||
(setq auto-save-file-name-transforms
|
||||
`((".*" ,(concat user-emacs-directory "var/recovery/") t)))
|
||||
|
||||
|
||||
; Load packages
|
||||
(require 'telephone-line)
|
||||
(require 'elcord)
|
||||
(require 'dashboard)
|
||||
(require 'minions)
|
||||
(require 'doom-themes)
|
||||
(require 'nerd-icons)
|
||||
(require 'centaur-tabs)
|
||||
(require 'projectile)
|
||||
(require 'treemacs)
|
||||
(require 'treemacs-projectile)
|
||||
(require 'treemacs-nerd-icons)
|
||||
|
||||
;Graphical
|
||||
(setq frame-resize-pixelwise t)
|
||||
(when (display-graphic-p)
|
||||
(set-frame-font "Hack Nerd Font" nil t)
|
||||
)
|
||||
|
||||
|
||||
|
||||
(setq read-process-output-max (* 1024 1024 3))
|
||||
(when (or (not (display-graphic-p)) (daemonp))
|
||||
(xterm-mouse-mode 1)
|
||||
)
|
||||
|
||||
|
||||
(tool-bar-mode -1)
|
||||
(load-theme 'doom-horizon t)
|
||||
|
||||
(setq ring-bell-function 'ignore)
|
||||
(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)
|
||||
(unless (daemonp)
|
||||
(elcord-mode 1))
|
||||
|
||||
;Hide startup screen if started with file
|
||||
(defun startup-screen-advice (orig-fun &rest args)
|
||||
(when (= (seq-count #'buffer-file-name (buffer-list)) 0)
|
||||
(apply orig-fun args)))
|
||||
(advice-add 'display-startup-screen :around #'startup-screen-advice)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
;Enable dashboard
|
||||
(setq dashboard-center-content t)
|
||||
(setq dashboard-display-icons-p t)
|
||||
(setq dashboard-icon-type 'nerd-icons)
|
||||
(dashboard-setup-startup-hook)
|
||||
(when (daemonp)
|
||||
(setq initial-buffer-choice (lambda () (get-buffer "*dashboard*"))) ; Show dashboard when emacs is running as daemon
|
||||
)
|
||||
|
||||
;Enable Centaur tabs
|
||||
(centaur-tabs-mode t)
|
||||
(setq centaur-tabs-set-bar 'over)
|
||||
(setq centaur-tabs-set-modified-marker t)
|
||||
;(setq centaur-tabs-modified-marker "*")
|
||||
|
||||
;Enable treemacs
|
||||
(global-set-key (kbd "C-H-t") 'treemacs)
|
||||
|
||||
;CUA
|
||||
(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)))
|
||||
Reference in New Issue
Block a user