Compare commits

..

No commits in common. "4912a5bc9991859dce2741f2fdea7c3d3741021f" and "1154c452911b2910707c516f3a3764544474e260" have entirely different histories.

7 changed files with 21 additions and 118 deletions

View File

@ -26,7 +26,7 @@
raylib raylib
gcc gcc
gdb gdb
nixd nil
nixfmt-classic nixfmt-classic
nixpkgs-fmt nixpkgs-fmt
cmake cmake

View File

@ -5,7 +5,7 @@
]; ];
home.stateVersion = "23.05"; home.stateVersion = "23.05";
home.homeDirectory = "/home/materus"; home.homeDirectory = "/home/materus";
programs.git.signing.signByDefault = true; programs.git.signing.signByDefault = true;
xdg.userDirs.enable = true; xdg.userDirs.enable = true;
@ -17,7 +17,7 @@
enableTerminal = lib.mkDefault true; enableTerminal = lib.mkDefault true;
enableTerminalExtra = lib.mkDefault true; enableTerminalExtra = lib.mkDefault true;
enableNixDevel = lib.mkDefault true; enableNixDevel = lib.mkDefault true;
editor.emacs.enable = false; editor.emacs.enable = true;
editor.code.fhs.enable = true; editor.code.fhs.enable = true;
editor.code.fhs.packages = (ps: with ps; let llvmpkgs = llvmPackages_18; in [ editor.code.fhs.packages = (ps: with ps; let llvmpkgs = llvmPackages_18; in [
llvmpkgs.clang llvmpkgs.clang
@ -33,7 +33,7 @@
raylib raylib
gcc gcc
gdb gdb
nixd nil
nixfmt-classic nixfmt-classic
nixpkgs-fmt nixpkgs-fmt
cmake cmake

View File

@ -24,7 +24,7 @@ with materusArg.pkgs.lib;
nix-tree nix-tree
nix-diff nix-diff
nix-ld nix-ld
nixd nil
nixpkgs-fmt nixpkgs-fmt
nixpkgs-review nixpkgs-review
]); ]);
@ -47,7 +47,6 @@ with materusArg.pkgs.lib;
neofetch neofetch
ripgrep ripgrep
fd fd
micro
]); ]);
} }

View File

@ -21,13 +21,6 @@ let
projectile projectile
company company
clipetty clipetty
which-key
iedit
#Evil-Mode
evil
treemacs-evil
#########
treemacs treemacs
treemacs-nerd-icons treemacs-nerd-icons
@ -54,20 +47,16 @@ let
lsp-treemacs lsp-treemacs
dap-mode dap-mode
d-mode d-mode
lua-mode
multiple-cursors multiple-cursors
org org
org-rainbow-tags org-rainbow-tags
org-roam org-roam
org-roam-ui org-roam-ui
org-review org-review
csharp-mode
markdown-mode markdown-mode
json-mode json-mode
nix-mode nix-mode
no-littering no-littering
right-click-context
moe-theme moe-theme
doom-themes doom-themes
@ -78,34 +67,18 @@ let
${inits.initText} ${inits.initText}
''; '';
emacsEnv = pkgs.buildEnv { emacsPkgs = with pkgs; [ python3 lua multimarkdown git ];
name = "emacs-env";
paths = with pkgs; [
python3
lua
multimarkdown
git
emacs-lsp-booster
llvmPackages.clang-tools
llvmPackages.clang
llvmPackages.lldb
(hiPrio gcc)
gdb
nixd
jdt-language-server
omnisharp-roslyn
];
};
cfg = config.materus.profile.editor.emacs; cfg = config.materus.profile.editor.emacs;
setNixInit = '' setNixInit = ''
(setenv "PATH" (concat (getenv "PATH") ":${emacsEnv}/bin")) (setenv "PATH" (concat (getenv "PATH") ":${lib.makeBinPath emacsPkgs}"))
(setq exec-path (append exec-path '("${emacsEnv}/bin"))) ${builtins.concatStringsSep "\n" (builtins.map
(x: ''(setq exec-path (append exec-path '("'' + x + ''/bin")))'')
emacsPkgs)}
(call-process-shell-command "${pkgs.xorg.xmodmap}/bin/xmodmap -e \"keycode 148 = Hyper_L\" -e \"remove Mod4 = Hyper_L\" -e \"add Mod3 = Hyper_L\" &" nil 0) (call-process-shell-command "${pkgs.xorg.xmodmap}/bin/xmodmap -e \"keycode 148 = Hyper_L\" -e \"remove Mod4 = Hyper_L\" -e \"add Mod3 = Hyper_L\" &" nil 0)
''; '';
in in {
{
options.materus.profile.editor.emacs.enable = options.materus.profile.editor.emacs.enable =
materusArg.pkgs.lib.mkBoolOpt false "Enable emacs with materus cfg"; materusArg.pkgs.lib.mkBoolOpt false "Enable emacs with materus cfg";
@ -123,14 +96,14 @@ in
xdg.configFile."emacs/early-init.el".text = '' xdg.configFile."emacs/early-init.el".text = ''
${inits.earlyInitText} ${inits.earlyInitText}
''; '';
xdg.configFile."emacs/init.el".text = '' xdg.configFile."emacs/init.el".text =''
(require 'recentf) (require 'recentf)
(require 'no-littering) (require 'no-littering)
(add-to-list 'recentf-exclude (add-to-list 'recentf-exclude
(recentf-expand-file-name no-littering-var-directory)) (recentf-expand-file-name no-littering-var-directory))
(add-to-list 'recentf-exclude (add-to-list 'recentf-exclude
(recentf-expand-file-name no-littering-etc-directory)) (recentf-expand-file-name no-littering-etc-directory))
''; '';
programs.emacs = { programs.emacs = {
enable = true; enable = true;

View File

@ -5,10 +5,8 @@
${builtins.readFile (path + "early-init.el")} ${builtins.readFile (path + "early-init.el")}
''; '';
initText = '' initText = ''
(require 'doom-themes nil 'noerror)
${builtins.readFile (path + "init.el")} ${builtins.readFile (path + "init.el")}
${builtins.readFile (path + "lsp.el")}
''; '';
} }

View File

@ -72,15 +72,13 @@
(setq-default cursor-type '(bar . 1)) (setq-default cursor-type '(bar . 1))
(pixel-scroll-precision-mode 1) (pixel-scroll-precision-mode 1)
(context-menu-mode 1)
(setq mouse-wheel-follow-mouse 't) (setq mouse-wheel-follow-mouse 't)
(setq scroll-step 1) (setq scroll-step 1)
(setq mouse-drag-and-drop-region t) (setq mouse-drag-and-drop-region t)
(telephone-line-mode 1) (telephone-line-mode 1)
(setq-default pixel-scroll-precision-large-scroll-height 10.0) (setq-default pixel-scroll-precision-large-scroll-height 10.0)
(minions-mode 1) (minions-mode 1)
(unless (daemonp) (elcord-mode)
(elcord-mode 1))
;Hide startup screen if started with file ;Hide startup screen if started with file
(defun startup-screen-advice (orig-fun &rest args) (defun startup-screen-advice (orig-fun &rest args)
@ -114,15 +112,9 @@
(cua-mode 1) (cua-mode 1)
(global-set-key (kbd "C-y") 'undo-redo) (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 "<XF86Calculator>") 'event-apply-hyper-modifier )
(define-key key-translation-map (kbd "<Calculator>") '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 "C-∇") (kbd "C-H"))
;(global-set-key (kbd "H-∇") (lambda () (interactive) (insert-char #x2207))) ;(global-set-key (kbd "H-∇") (lambda () (interactive) (insert-char #x2207)))

View File

@ -1,59 +0,0 @@
(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)