This commit is contained in:
Mateusz Słodkowicz 2024-11-18 00:28:37 +01:00
parent 9e97dc6f65
commit fec28354bd
Signed by: materus
GPG Key ID: 28D140BCA60B4FD1
13 changed files with 634 additions and 291 deletions

View File

@ -30,7 +30,7 @@
"nix.enableLanguageServer" = true; "nix.enableLanguageServer" = true;
"nix.serverPath" = "${pkgs.nixd}/bin/nixd"; "nix.serverPath" = "${pkgs.nixd}/bin/nixd";
"nix.formatterPath" = "${pkgs.nixfmt-classic}/bin/nixfmt"; "nix.formatterPath" = "${pkgs.nixfmt-rfc-style}/bin/nixfmt";
"C_Cpp.clang_format_path" = "${pkgs.clang-tools}/bin/clang-format"; "C_Cpp.clang_format_path" = "${pkgs.clang-tools}/bin/clang-format";
"C_Cpp.clang_format_fallbackStyle" = "Microsoft"; "C_Cpp.clang_format_fallbackStyle" = "Microsoft";

View File

@ -26,8 +26,8 @@
raylib raylib
gcc gcc
gdb gdb
nixd materusArg.unstable.nixd
nixfmt-classic nixfmt-rfc-style
nixpkgs-fmt nixpkgs-fmt
cmake cmake
gnumake gnumake

View File

@ -34,8 +34,8 @@
raylib raylib
gcc gcc
gdb gdb
nixd materusArg.unstable.nixd
nixfmt-classic nixfmt-rfc-style
nixpkgs-fmt nixpkgs-fmt
cmake cmake
gnumake gnumake

View File

@ -19,12 +19,11 @@ with materusArg.pkgs.lib;
nix-prefetch-scripts nix-prefetch-scripts
nix-prefetch-github nix-prefetch-github
nix-prefetch-docker nix-prefetch-docker
nixfmt-classic nixfmt-rfc-style
nix-top nix-top
nix-tree nix-tree
nix-diff nix-diff
nix-ld nix-ld
nixd
nixpkgs-fmt nixpkgs-fmt
nixpkgs-review nixpkgs-review
]); ]);

View File

@ -58,7 +58,7 @@ let
open-vsx.ms-azuretools.vscode-docker open-vsx.ms-azuretools.vscode-docker
open-vsx.webfreak.debug open-vsx.webfreak.debug
open-vsx.mkhl.direnv open-vsx.mkhl.direnv
vscode-marketplace.ms-vscode-remote.remote-ssh vscode-marketplace.ms-vscode-remote.remote-wsl
vscode-marketplace.ms-vscode-remote.remote-containers vscode-marketplace.ms-vscode-remote.remote-containers
open-vsx.esbenp.prettier-vscode open-vsx.esbenp.prettier-vscode
open-vsx.formulahendry.code-runner open-vsx.formulahendry.code-runner
@ -95,7 +95,7 @@ let
"nix.enableLanguageServer" = lib.mkDefault true; "nix.enableLanguageServer" = lib.mkDefault true;
"nix.serverPath" = lib.mkDefault "${pkgs.nixd}/bin/nixd"; "nix.serverPath" = lib.mkDefault "${pkgs.nixd}/bin/nixd";
"nix.formatterPath" = lib.mkDefault "${pkgs.nixfmt-classic}/bin/nixfmt"; "nix.formatterPath" = lib.mkDefault "${pkgs.nixfmt-rfc-style}/bin/nixfmt";
"nix.serverSettings" = { "nix.serverSettings" = {
"nixd" = { "formatting" = { "command" = lib.mkDefault [ "nixfmt" ]; }; }; "nixd" = { "formatting" = { "command" = lib.mkDefault [ "nixfmt" ]; }; };
}; };

View File

@ -1,30 +1,35 @@
{ config, lib, pkgs, materusArg, materusCfg, ... }: {
config,
lib,
pkgs,
materusArg,
materusCfg,
...
}:
let let
emacs-git = emacs-pkg = materusCfg.configInputs.emacs-overlay.packages.x86_64-linux.emacs-unstable;
materusCfg.configInputs.emacs-overlay.packages.x86_64-linux.emacs-git;
materus-config = e: materus-config =
e:
e.trivialBuild { e.trivialBuild {
pname = "materus-config"; pname = "materus-config";
src = pkgs.writeText "materus-config.el" '' src = pkgs.writeText "materus-config.el" ''
(when (file-exists-p "${config.programs.emacs.package}/opt/emacs/buildtime") (when (file-exists-p "${config.programs.emacs.package}/opt/emacs/buildtime")
(setq emacs-build-time (decode-time (seconds-to-time (string-to-number (with-temp-buffer (setq emacs-build-time (decode-time (seconds-to-time (string-to-number (with-temp-buffer
(insert-file-contents "${config.programs.emacs.package}/opt/emacs/buildtime") (insert-file-contents "${config.programs.emacs.package}/opt/emacs/buildtime")
(buffer-string))))))) (buffer-string)))))))
(provide 'materus-config) (provide 'materus-config)
''; '';
version = "1.0.0"; version = "1.0.0";
}; };
configPath = "${materusArg.cfg.path}" + "/extraFiles/config/emacs/"; configPath = "${materusArg.cfg.path}" + "/extraFiles/config/emacs/";
packages = epkgs: packages =
with epkgs; [ epkgs: with epkgs; [
(materus-config epkgs) (materus-config epkgs)
treesit-grammars.with-all-grammars treesit-grammars.with-all-grammars
use-package use-package
elcord elcord
persp-mode
dashboard dashboard
magit magit
git-timemachine git-timemachine
@ -37,17 +42,17 @@ let
iedit iedit
hideshowvis hideshowvis
evil evil
perspective
treemacs-evil treemacs-evil
treemacs treemacs
treemacs-nerd-icons
treemacs-perspective treemacs-perspective
treemacs-nerd-icons
treemacs-icons-dired treemacs-icons-dired
treemacs-magit treemacs-magit
treemacs-projectile treemacs-projectile
tree-edit tree-edit
nerd-icons nerd-icons
nerd-icons-completion nerd-icons-completion
perspective
minions minions
rainbow-delimiters rainbow-delimiters
rainbow-mode rainbow-mode
@ -56,6 +61,8 @@ let
lsp-java lsp-java
lsp-jedi lsp-jedi
lsp-haskell lsp-haskell
lsp-pascal
lsp-pyright
lsp-ui lsp-ui
lsp-treemacs lsp-treemacs
dap-mode dap-mode
@ -81,6 +88,8 @@ let
markdown-mode markdown-mode
json-mode json-mode
nix-mode nix-mode
nixfmt
nix-ts-mode
no-littering no-littering
right-click-context right-click-context
dracula-theme dracula-theme
@ -93,7 +102,6 @@ let
yasnippet yasnippet
async async
request request
nix-ts-mode
markdown-ts-mode markdown-ts-mode
llvm-ts-mode llvm-ts-mode
treesit-fold treesit-fold
@ -113,6 +121,7 @@ let
drag-stuff drag-stuff
dirvish dirvish
rg rg
shfmt
# Completions & Minibuffer # Completions & Minibuffer
corfu corfu
company company
@ -128,11 +137,13 @@ let
emacsEnv = pkgs.buildEnv { emacsEnv = pkgs.buildEnv {
name = "emacs-env"; name = "emacs-env";
paths = with pkgs; [ paths = with pkgs; [
pyright
shfmt
ripgrep ripgrep
cmake cmake
gnumake gnumake
nixfmt-classic nixfmt-rfc-style
python3 python3Full
lua lua
multimarkdown multimarkdown
git git
@ -142,10 +153,11 @@ let
llvmPackages.lldb llvmPackages.lldb
(hiPrio gcc) (hiPrio gcc)
gdb gdb
nixd materusArg.unstable.nixd
jdt-language-server jdt-language-server
jdk jdk
gradle gradle
fpc
omnisharp-roslyn omnisharp-roslyn
]; ];
}; };
@ -153,15 +165,23 @@ let
cfg = config.materus.profile.editor.emacs; cfg = config.materus.profile.editor.emacs;
setNixInit = '' setNixInit = ''
(defvar lsp-java-configuration-runtimes nil)
(setq lsp-java-configuration-runtimes '[(:name "JavaSE-1.8"
:path "${pkgs.jdk8}/lib/openjdk/")
(:name "JavaSE-17"
:path "${pkgs.jdk17}/lib/openjdk/")
(:name "JavaSE-21"
:path "${pkgs.jdk21}/lib/openjdk/"
:default t)])
(setq lsp-nix-nixd-nixos-options-expr (concat "(builtins.getFlake \"/etc/nixos\").nixosConfigurations." (system-name) ".options"))
(setenv "PATH" (concat (getenv "PATH") ":${emacsEnv}/bin")) (setenv "PATH" (concat (getenv "PATH") ":${emacsEnv}/bin"))
(setenv "LD_LIBRARY_PATH" (concat (getenv "LD_LIBRARY_PATH") ":${emacsEnv}/lib"))
(setq exec-path (append exec-path '("${emacsEnv}/bin"))) (setq exec-path (append exec-path '("${emacsEnv}/bin")))
(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)
(call-process-shell-command "${pkgs.xorg.xmodmap}/bin/xmodmap -e \"keycode 66 = 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 66 = Hyper_L\" -e \"remove Mod4 = Hyper_L\" -e \"add Mod3 = Hyper_L\" &" nil 0)
''; '';
in { in
options.materus.profile.editor.emacs.enable = {
materusArg.pkgs.lib.mkBoolOpt false "Enable emacs with materus cfg"; options.materus.profile.editor.emacs.enable = materusArg.pkgs.lib.mkBoolOpt false "Enable emacs with materus cfg";
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
home.activation.emacsSetup = lib.hm.dag.entryAfter [ "linkGeneration" ] '' home.activation.emacsSetup = lib.hm.dag.entryAfter [ "linkGeneration" ] ''
@ -172,29 +192,34 @@ in {
run ${config.programs.emacs.finalPackage}/bin/emacs -Q --batch \ run ${config.programs.emacs.finalPackage}/bin/emacs -Q --batch \
--eval '(setq warning-minimum-log-level :error)' \ --eval '(setq warning-minimum-log-level :error)' \
--eval '(setq package-user-dir (concat user-emacs-directory "var/elpa/" emacs-version "/" ))' \ --eval '(setq package-user-dir (concat user-emacs-directory "var/elpa/" emacs-version "/" ))' \
--eval '(setq package-gnupghome-dir (concat user-emacs-directory "var/elpa/gnupg/" ))' \ --eval '(setq package-gnupghome-dir (concat user-emacs-directory "var/elpa/gnupg/" ))' \
--eval '(package-initialize)' \ --eval '(package-initialize)' \
--eval '(byte-recompile-directory (concat user-emacs-directory "etc/materus/extra") 0 t)' \ --eval '(byte-recompile-directory (concat user-emacs-directory "etc/materus/extra") 0 t)' \
--eval '(byte-compile-file "${config.xdg.configHome}/emacs/early-init.el")' \ --eval '(byte-compile-file "${config.xdg.configHome}/emacs/early-init.el")' \
--eval '(byte-compile-file "${config.xdg.configHome}/emacs/init.el")' \ --eval '(byte-compile-file "${config.xdg.configHome}/emacs/init.el")' \
--eval '(byte-compile-file "${config.xdg.configHome}/emacs/nix-init.el")' \ --eval '(byte-compile-file "${config.xdg.configHome}/emacs/etc/materus/nix-init.el")' \
--eval '(byte-compile-file "${config.xdg.configHome}/emacs/etc/materus/emacs-config.el")' --eval '(byte-compile-file "${config.xdg.configHome}/emacs/etc/materus/emacs-config.el")'
''; '';
xdg.configFile = { "emacs/nix-init.el".text = setNixInit; }; xdg.configFile = {
"emacs/etc/materus/nix-init.el".text = setNixInit;
};
#Emacsclient with COLORTERM env variable, without it display in "-nw" client is broken #Emacsclient with COLORTERM env variable, without it display in "-nw" client is broken
xdg.desktopEntries.emacs = { xdg.desktopEntries.emacs = {
name = "Emacs"; name = "Emacs";
genericName = "Edytor tekstu"; genericName = "Edytor tekstu";
comment = "Edytuj tekst"; comment = "Edytuj tekst";
exec = ''env COLORTERM=truecolor emacsclient -a "" -r -n %F''; exec = ''env COLORTERM=truecolor emacsclient -a "" -r %F'';
icon = "emacs"; icon = "emacs";
terminal = false; terminal = false;
type = "Application"; type = "Application";
categories = [ "Development" "TextEditor" ]; categories = [
"Development"
"TextEditor"
];
mimeType = [ mimeType = [
"text/english" "text/english"
"text/plain" "text/plain"
@ -214,7 +239,7 @@ in {
"x-scheme-handler/org-protocol" "x-scheme-handler/org-protocol"
]; ];
actions.new-window = { actions.new-window = {
exec = ''env COLORTERM=truecolor emacsclient -a "" -c -n %F''; exec = ''env COLORTERM=truecolor emacsclient -a "" -c %F'';
name = "Nowe okno"; name = "Nowe okno";
}; };
actions.no-daemon = { actions.no-daemon = {
@ -225,35 +250,118 @@ in {
programs.emacs = { programs.emacs = {
enable = true; enable = true;
package = lib.mkDefault ((emacs-git.override { package = lib.mkDefault (
withSQLite3 = true; (emacs-pkg.override {
withWebP = true; withSQLite3 = true;
withX = true; withWebP = true;
#withXwidgets = true; withX = true;
withGTK3 = true; #withXwidgets = true;
withAlsaLib = true; withGTK3 = true;
withGconf = true; withAlsaLib = true;
withImageMagick = true; withGconf = true;
}).overrideAttrs (f: p: { withImageMagick = true;
#Remove .desktop files, will use my own. Add file with buildtime in case of using elpaca }).overrideAttrs
postInstall = p.postInstall + '' (
rm -fr $out/share/applications/* f: p: {
mkdir -p $out/opt/emacs #Remove .desktop files, will use my own. Add file with buildtime in case of using elpaca
date +%s | tr -d '\n' > $out/opt/emacs/buildtime postInstall =
''; p.postInstall
})); + ''
extraPackages = epkgs: rm -fr $out/share/applications/*
(packages (epkgs.overrideScope (ff: pp: { mkdir -p $out/opt/emacs
#Build lsp-mode with plist support, need to set this in emacs too date +%s | tr -d '\n' > $out/opt/emacs/buildtime
'';
}
)
);
extraPackages =
epkgs:
(packages (
epkgs.overrideScope (
ff: pp: {
#Build lsp-mode with plist support, need to set this in emacs too
lsp-mode = (pp.lsp-mode.overrideAttrs (f: p: { buildPhase = "export LSP_USE_PLISTS=true\n" + p.buildPhase;})); lsp-mode = (
lsp-java = (pp.lsp-java.overrideAttrs (f: p: { buildPhase = "export LSP_USE_PLISTS=true\n" + p.buildPhase;})); pp.lsp-mode.overrideAttrs (
lsp-jedi= (pp.lsp-jedi.overrideAttrs (f: p: { buildPhase = "export LSP_USE_PLISTS=true\n" + p.buildPhase;})); f: p: {
lsp-haskell = (pp.lsp-haskell.overrideAttrs (f: p: { buildPhase = "export LSP_USE_PLISTS=true\n" + p.buildPhase;})); patches = [ ./lsp-mode.patch ];
lsp-ui = (pp.lsp-ui.overrideAttrs (f: p: { buildPhase = "export LSP_USE_PLISTS=true\n" + p.buildPhase;})); buildPhase =
lsp-treemacs = (pp.lsp-treemacs.overrideAttrs (f: p: { buildPhase = "export LSP_USE_PLISTS=true\n" + p.buildPhase;})); ''
dap-mode = (pp.dap-mode.overrideAttrs (f: p: { buildPhase = "export LSP_USE_PLISTS=true\n" + p.buildPhase;})); export LSP_USE_PLISTS=true
}))); ''
+ p.buildPhase;
}
)
);
lsp-java = (
pp.lsp-java.overrideAttrs (
f: p: {
buildPhase =
''
export LSP_USE_PLISTS=true
''
+ p.buildPhase;
}
)
);
lsp-jedi = (
pp.lsp-jedi.overrideAttrs (
f: p: {
buildPhase =
''
export LSP_USE_PLISTS=true
''
+ p.buildPhase;
}
)
);
lsp-haskell = (
pp.lsp-haskell.overrideAttrs (
f: p: {
buildPhase =
''
export LSP_USE_PLISTS=true
''
+ p.buildPhase;
}
)
);
lsp-ui = (
pp.lsp-ui.overrideAttrs (
f: p: {
buildPhase =
''
export LSP_USE_PLISTS=true
''
+ p.buildPhase;
}
)
);
lsp-treemacs = (
pp.lsp-treemacs.overrideAttrs (
f: p: {
buildPhase =
''
export LSP_USE_PLISTS=true
''
+ p.buildPhase;
}
)
);
dap-mode = (
pp.dap-mode.overrideAttrs (
f: p: {
buildPhase =
''
export LSP_USE_PLISTS=true
''
+ p.buildPhase;
}
)
);
}
)
));
}; };
}; };

View File

@ -0,0 +1,22 @@
From 75e41ae5bd1c0879b323ed0ddc4bac29badb29ff Mon Sep 17 00:00:00 2001
From: fanshi1028 <jackychany321@gmail.com>
Date: Fri, 1 Nov 2024 14:41:26 +0000
Subject: [PATCH] fix lsp-org breaks with org 9.7 (#4300)
---
lsp-mode.el | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lsp-mode.el b/lsp-mode.el
index f5c700dbf3..a149d6d2c7 100644
--- a/lsp-mode.el
+++ b/lsp-mode.el
@@ -9668,7 +9668,7 @@ defaults to `progress-bar."
(save-excursion
(funcall goto-buffer)
(funcall f))))))
- ((&plist :begin :end :post-blank :language) (cl-second (org-element-context)))
+ ((begin end post-blank language) (--map (org-element-property it (org-element-context) nil t) '(:begin :end :post-blank :language)))
((&alist :tangle file-name) (cl-third (org-babel-get-src-block-info 'light)))
(file-name (if file-name

View File

@ -1,12 +1,20 @@
{ config, pkgs, lib, materusArg, ... }: {
config,
pkgs,
lib,
materusArg,
...
}:
let let
relToDotDir = file: (lib.optionalString (config.programs.zsh.dotDir != null) (config.programs.zsh.dotDir + "/")) + file; relToDotDir =
file:
(lib.optionalString (config.programs.zsh.dotDir != null) (config.programs.zsh.dotDir + "/")) + file;
pluginsDir = pluginsDir =
if config.programs.zsh.dotDir != null then if config.programs.zsh.dotDir != null then
relToDotDir "plugins" else "${config.home.homeDirectory}/.zsh/plugins"; relToDotDir "plugins"
else
"${config.home.homeDirectory}/.zsh/plugins";
p10kcfg = "${zshcfg}/p10kcfg"; p10kcfg = "${zshcfg}/p10kcfg";
zshcfg = "${materusArg.cfg.path}" + "/extraFiles/config/zsh"; zshcfg = "${materusArg.cfg.path}" + "/extraFiles/config/zsh";
@ -19,11 +27,6 @@ let
fi fi
''; '';
makePlugin = nameArg: fileArg: srcArg: rec { makePlugin = nameArg: fileArg: srcArg: rec {
name = nameArg; name = nameArg;
src = srcArg; src = srcArg;
@ -33,15 +36,18 @@ let
}; };
extraPlugins = { extraPlugins = {
powerlevel10k = makePlugin "powerlevel10k" "powerlevel10k.zsh-theme" (pkgs.fetchFromGitHub { powerlevel10k = makePlugin "powerlevel10k" "powerlevel10k.zsh-theme" (
owner = "romkatv"; pkgs.fetchFromGitHub {
repo = "powerlevel10k"; owner = "romkatv";
rev = "v1.20.0"; repo = "powerlevel10k";
sha256 = "sha256-ES5vJXHjAKw/VHjWs8Au/3R+/aotSbY7PWnWAMzCR8E="; rev = "v1.20.0";
}); sha256 = "sha256-ES5vJXHjAKw/VHjWs8Au/3R+/aotSbY7PWnWAMzCR8E=";
}
);
sudo = makePlugin "sudo" "sudo.plugin.zsh" "${pkgs.oh-my-zsh}/share/oh-my-zsh/plugins/sudo"; sudo = makePlugin "sudo" "sudo.plugin.zsh" "${pkgs.oh-my-zsh}/share/oh-my-zsh/plugins/sudo";
extract = makePlugin "extract" "extract.plugin.zsh" "${pkgs.oh-my-zsh}/share/oh-my-zsh/plugins/extract"; extract =
makePlugin "extract" "extract.plugin.zsh"
"${pkgs.oh-my-zsh}/share/oh-my-zsh/plugins/extract";
}; };
in in
@ -58,14 +64,13 @@ in
type = lib.types.lines; type = lib.types.lines;
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
home.packages = [ home.packages = [ pkgs.ripgrep ];
pkgs.ripgrep
];
home.file = lib.mkMerge [ home.file = lib.mkMerge [
(builtins.foldl' (a: b: a // b) { } (builtins.map (plugin: { ${plugin.path}.source = plugin.src; }) (builtins.attrValues extraPlugins))) (builtins.foldl' (a: b: a // b) { } (
builtins.map (plugin: { ${plugin.path}.source = plugin.src; }) (builtins.attrValues extraPlugins)
))
{ "${relToDotDir ".zshrc"}".text = lib.mkAfter cfg.endConfig; } { "${relToDotDir ".zshrc"}".text = lib.mkAfter cfg.endConfig; }
]; ];
@ -78,27 +83,25 @@ in
historySubstringSearch.searchUpKey = "$key[Up]"; historySubstringSearch.searchUpKey = "$key[Up]";
historySubstringSearch.searchDownKey = "$key[Down]"; historySubstringSearch.searchDownKey = "$key[Down]";
envExtra = '' envExtra = ''
${makeEnv "__MATERUS_HM_ZSH" "1"} ${makeEnv "__MATERUS_HM_ZSH" "1"}
${makeEnv "__MATERUS_HM_ZSH_PROMPT" cfg.prompt} ${makeEnv "__MATERUS_HM_ZSH_PROMPT" cfg.prompt}
${makeEnv "__MATERUS_HM_ZSH_PRIVATE" "0"} ${makeEnv "__MATERUS_HM_ZSH_PRIVATE" "0"}
''; '';
initExtraFirst = '' initExtraFirst = ''
bindkey -e
if [ -n "$EAT_SHELL_INTEGRATION_DIR" ]; then if [ -n "$EAT_SHELL_INTEGRATION_DIR" ]; then
source "$EAT_SHELL_INTEGRATION_DIR/zsh"; source "$EAT_SHELL_INTEGRATION_DIR/zsh";
fi fi
${makeIfVar "__MATERUS_HM_ZSH_PROMPT" "p10k" '' ${makeIfVar "__MATERUS_HM_ZSH_PROMPT" "p10k" ''
if [[ -r "''${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-''${(%):-%n}.zsh" ]]; then if [[ -r "''${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-''${(%):-%n}.zsh" ]]; then
source "''${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-''${(%):-%n}.zsh" source "''${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-''${(%):-%n}.zsh"
fi fi
if [[ -f "${extraPlugins.powerlevel10k.fullPath}" ]]; then if [[ -f "${extraPlugins.powerlevel10k.fullPath}" ]]; then
source "${extraPlugins.powerlevel10k.fullPath}" source "${extraPlugins.powerlevel10k.fullPath}"
fi fi
'' ''}
}
if zmodload zsh/terminfo && (( "$terminfo[colors]" >= "256" )); then if zmodload zsh/terminfo && (( "$terminfo[colors]" >= "256" )); then
__MATERUS_HM_ZSH_256COLORS="''${__MATERUS_HM_ZSH_256COLORS:-1}"; else __MATERUS_HM_ZSH_256COLORS="''${__MATERUS_HM_ZSH_256COLORS:-1}"; else
__MATERUS_HM_ZSH_256COLORS="''${__MATERUS_HM_ZSH_256COLORS:-0}"; __MATERUS_HM_ZSH_256COLORS="''${__MATERUS_HM_ZSH_256COLORS:-0}";
@ -112,12 +115,9 @@ in
path+="${extraPlugins.extract.path}" path+="${extraPlugins.extract.path}"
fpath+="${extraPlugins.extract.path}" fpath+="${extraPlugins.extract.path}"
fi fi
''; '';
plugins = [ ];
plugins = [
];
history = { history = {
extended = true; extended = true;
@ -130,62 +130,64 @@ in
}; };
completionInit = '' completionInit = ''
ZSH_COMPDUMP="''${ZSH_COMPDUMP:-''${XDG_CACHE_HOME:-${config.home.homeDirectory}/.cache}/.zcompdump-''${HOST}-''${ZSH_VERSION}}" ZSH_COMPDUMP="''${ZSH_COMPDUMP:-''${XDG_CACHE_HOME:-${config.home.homeDirectory}/.cache}/.zcompdump-''${HOST}-''${ZSH_VERSION}}"
autoload -U compinit && compinit -d $ZSH_COMPDUMP autoload -U compinit && compinit -d $ZSH_COMPDUMP
''; '';
initExtra = '' initExtra =
if [[ "$__ETC_ZSHRC_SOURCED" != "1" ]]; then ''
. ${zshcfg}/zinputrc if [[ "$__ETC_ZSHRC_SOURCED" != "1" ]]; then
fi . ${zshcfg}/zinputrc
source ${zshcfg}/zshcompletion.zsh fi
source ${zshcfg}/zshcompletion.zsh
history-substring-search-up-prefixed(){ history-substring-search-up-prefixed(){
HISTORY_SUBSTRING_SEARCH_PREFIXED=1 history-substring-search-up HISTORY_SUBSTRING_SEARCH_PREFIXED=1 history-substring-search-up
} }
history-substring-search-down-prefixed(){ history-substring-search-down-prefixed(){
HISTORY_SUBSTRING_SEARCH_PREFIXED=1 history-substring-search-down HISTORY_SUBSTRING_SEARCH_PREFIXED=1 history-substring-search-down
} }
zle -N history-substring-search-up-prefixed zle -N history-substring-search-up-prefixed
zle -N history-substring-search-down-prefixed zle -N history-substring-search-down-prefixed
bindkey -r "^[" bindkey -r "^["
bindkey "^[[1;5C" forward-word bindkey "^[[1;5C" forward-word
bindkey "^[[1;5D" backward-word bindkey "^[[1;5D" backward-word
bindkey "^[[1;5A" history-substring-search-up-prefixed bindkey "^[[1;5A" history-substring-search-up-prefixed
bindkey "^[[1;5B" history-substring-search-down-prefixed bindkey "^[[1;5B" history-substring-search-down-prefixed
zsh-private() { zsh-private() {
__MATERUS_HM_ZSH_PRIVATE=1 ${lib.getExe config.programs.zsh.package} __MATERUS_HM_ZSH_PRIVATE=1 ${lib.getExe config.programs.zsh.package}
} }
myip() { myip() {
${lib.getExe pkgs.wget} -qO- https://wtfismyip.com/text ${lib.getExe pkgs.wget} -qO- https://wtfismyip.com/text
} }
speedtest() { speedtest() {
${lib.getExe pkgs.curl} -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | ${lib.getExe pkgs.python3} ${lib.getExe pkgs.curl} -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | ${lib.getExe pkgs.python3}
} }
${lib.optionalString config.materus.profile.editor.emacs.enable ''alias "e"="emacsclient -nw -c --alternate-editor= "''} ${lib.optionalString config.materus.profile.editor.emacs.enable ''alias "e"="emacsclient -nw -c --alternate-editor= "''}
${lib.optionalString config.materus.profile.editor.emacs.enable ''alias "ee"="emacsclient -n -r --alternate-editor= "''} ${lib.optionalString config.materus.profile.editor.emacs.enable ''alias "ee"="emacsclient -n -r --alternate-editor= "''}
'' + ''
makeIfVar "__MATERUS_HM_ZSH_PROMPT" "p10k" '' + makeIfVar "__MATERUS_HM_ZSH_PROMPT" "p10k" ''
if [[ "$__MATERUS_HM_ZSH_256COLORS" = "1" ]] ; then if [[ "$__MATERUS_HM_ZSH_256COLORS" = "1" ]] ; then
[[ ! -f ${p10kcfg}/fullcolor.zsh ]] || source ${p10kcfg}/fullcolor.zsh [[ ! -f ${p10kcfg}/fullcolor.zsh ]] || source ${p10kcfg}/fullcolor.zsh
else else
[[ ! -f ${p10kcfg}/compatibility.zsh ]] || source ${p10kcfg}/compatibility.zsh [[ ! -f ${p10kcfg}/compatibility.zsh ]] || source ${p10kcfg}/compatibility.zsh
fi fi
'' + makeIfVar "__MATERUS_HM_ZSH_PRIVATE" "1" '' ''
unset HISTFILE + makeIfVar "__MATERUS_HM_ZSH_PRIVATE" "1" ''
${lib.optionalString config.programs.zsh.history.share "unsetopt SHARE_HISTORY"} unset HISTFILE
alias -- 'zsh'="__MATERUS_HM_ZSH_PRIVATE=0 zsh " ${lib.optionalString config.programs.zsh.history.share "unsetopt SHARE_HISTORY"}
'' alias -- 'zsh'="__MATERUS_HM_ZSH_PRIVATE=0 zsh "
''
; ;
@ -194,5 +196,4 @@ in
programs.starship.enableZshIntegration = lib.mkDefault false; programs.starship.enableZshIntegration = lib.mkDefault false;
}; };
} }

View File

@ -1,7 +1,12 @@
;;; -*- lexical-binding: t; -*- ;;; -*- lexical-binding: t; -*-
(defvar materus/init-early t) ; Var to ensure early-init loaded (defvar materus/init-early t) ; Var to ensure early-init loaded
(setq materus/init-early t) ; Probably useless (setq materus/init-early t) ; Probably useless
(setenv "LSP_USE_PLISTS" "true") (setenv "LSP_USE_PLISTS" "true")
(setq c-default-style nil)
(set-language-environment "UTF-8")
(setq default-input-method nil)
(setq initial-major-mode 'fundamental-mode) (setq initial-major-mode 'fundamental-mode)
(setq native-comp-async-report-warnings-errors nil) (setq native-comp-async-report-warnings-errors nil)

View File

@ -2,7 +2,7 @@
#+AUTHOR: materus #+AUTHOR: materus
#+DESCRIPTION: materus emacs configuration #+DESCRIPTION: materus emacs configuration
#+STARTUP: overview #+STARTUP: overview
#+PROPERTY: header-args :tangle etc/materus/emacs-config.el #+PROPERTY: header-args :tangle etc/materus/emacs-config.el :comments link
#+auto_tangle: t #+auto_tangle: t
My emacs config, tangled file is [[file:etc/materus/emacs-config.el][there]] My emacs config, tangled file is [[file:etc/materus/emacs-config.el][there]]
* Table of Contents :noexport:TOC_3: * Table of Contents :noexport:TOC_3:
@ -11,8 +11,8 @@ My emacs config, tangled file is [[file:etc/materus/emacs-config.el][there]]
- [[#init][Init]] - [[#init][Init]]
- [[#compile-time][Compile Time]] - [[#compile-time][Compile Time]]
- [[#packages][Packages]] - [[#packages][Packages]]
- [[#init-1][Init]] - [[#init-package-manager-config][Init package manager config]]
- [[#packages-1][Packages]] - [[#packages-list--function][Packages list & function]]
- [[#configuration][Configuration]] - [[#configuration][Configuration]]
- [[#no-littering][No Littering]] - [[#no-littering][No Littering]]
- [[#graphical][Graphical]] - [[#graphical][Graphical]]
@ -24,6 +24,8 @@ My emacs config, tangled file is [[file:etc/materus/emacs-config.el][there]]
- [[#completions][Completions]] - [[#completions][Completions]]
- [[#minibuffer][Minibuffer]] - [[#minibuffer][Minibuffer]]
- [[#code-completion][Code completion]] - [[#code-completion][Code completion]]
- [[#terms][Terms]]
- [[#eat][Eat]]
- [[#miscellaneous][Miscellaneous]] - [[#miscellaneous][Miscellaneous]]
- [[#defaults][Defaults]] - [[#defaults][Defaults]]
- [[#elcord][Elcord]] - [[#elcord][Elcord]]
@ -32,16 +34,19 @@ My emacs config, tangled file is [[file:etc/materus/emacs-config.el][there]]
- [[#treemacs][Treemacs]] - [[#treemacs][Treemacs]]
- [[#magit][Magit]] - [[#magit][Magit]]
- [[#dirvish][Dirvish]] - [[#dirvish][Dirvish]]
- [[#perspective][Perspective]]
- [[#programming][Programming]] - [[#programming][Programming]]
- [[#lsp][LSP]] - [[#lsp][LSP]]
- [[#nix][Nix]] - [[#nix][Nix]]
- [[#emacs-lisp][Emacs Lisp]] - [[#emacs-lisp][Emacs Lisp]]
- [[#cc][C/C++]] - [[#cc][C/C++]]
- [[#python][Python]]
- [[#java][Java]] - [[#java][Java]]
- [[#other][Other]]
- [[#keybindings][Keybindings]] - [[#keybindings][Keybindings]]
- [[#snippets][Snippets]] - [[#snippets][Snippets]]
- [[#yasnippet-init][Yasnippet init]] - [[#yasnippet-init][Yasnippet init]]
- [[#other][Other]] - [[#other-1][Other]]
- [[#update-config-script][Update config script]] - [[#update-config-script][Update config script]]
- [[#byte-compile][Byte compile]] - [[#byte-compile][Byte compile]]
- [[#test][Test]] - [[#test][Test]]
@ -52,11 +57,18 @@ My emacs config, tangled file is [[file:etc/materus/emacs-config.el][there]]
:header-args: :tangle early-init.el :header-args: :tangle early-init.el
:END: :END:
Early init file, setting for GC and some paths. Early init file, setting for GC and some paths.
#+begin_src emacs-lisp #+begin_src emacs-lisp :comments no
;;; -*- lexical-binding: t; -*- ;;; -*- lexical-binding: t; -*-
#+end_src
#+begin_src emacs-lisp
(defvar materus/init-early t) ; Var to ensure early-init loaded (defvar materus/init-early t) ; Var to ensure early-init loaded
(setq materus/init-early t) ; Probably useless (setq materus/init-early t) ; Probably useless
(setenv "LSP_USE_PLISTS" "true") (setenv "LSP_USE_PLISTS" "true")
(setq c-default-style nil)
(set-language-environment "UTF-8")
(setq default-input-method nil)
(setq initial-major-mode 'fundamental-mode) (setq initial-major-mode 'fundamental-mode)
(setq native-comp-async-report-warnings-errors nil) (setq native-comp-async-report-warnings-errors nil)
@ -109,18 +121,22 @@ Early init file, setting for GC and some paths.
:END: :END:
Init File Init File
Checking if using emacs from my nix config (not used anymore, might use in future), loads config and custom.el Checking if using emacs from my nix config (not used anymore, might use in future), loads config and custom.el
#+begin_src emacs-lisp #+begin_src emacs-lisp :comments no
;;; -*- lexical-binding: t; -*- ;;; -*- lexical-binding: t; -*-
#+end_src
#+begin_src emacs-lisp
(setq-default materus/use-nix-packages (require 'materus-config nil 'noerror)) (setq-default materus/use-nix-packages (require 'materus-config nil 'noerror))
(unless (file-directory-p (concat user-emacs-directory "var/quickstart")) (unless (file-directory-p (concat user-emacs-directory "var/quickstart"))
(make-directory (concat user-emacs-directory "var/quickstart") t)) (make-directory (concat user-emacs-directory "var/quickstart") t))
(load (concat user-emacs-directory "nix-init") t) (load (concat user-emacs-directory "etc/materus/nix-init") t)
(load (concat user-emacs-directory "etc/materus/emacs-config")) (load (concat user-emacs-directory "etc/materus/emacs-config"))
(load custom-file t) (load custom-file t)
#+end_src #+end_src
** Compile Time ** Compile Time
#+begin_src emacs-lisp #+begin_src emacs-lisp :comments no
;;; -*- lexical-binding: t; -*- ;;; -*- lexical-binding: t; -*-
#+end_src
#+begin_src emacs-lisp
(eval-when-compile (eval-when-compile
(defvar doom-modeline-support-imenu nil) (defvar doom-modeline-support-imenu nil)
(defvar display-time-24hr-format nil) (defvar display-time-24hr-format nil)
@ -134,30 +150,24 @@ Checking if using emacs from my nix config (not used anymore, might use in futur
* Packages * Packages
Package manager config if not using nix. Package manager config if not using nix.
After some testing default package manager works best for me. After some testing default package manager works best for me.
** Init ** Init package manager config
#+begin_src emacs-lisp #+begin_src emacs-lisp
(require 'cl-lib) (require 'cl-lib)
(require 'package) (require 'package)
(setq package-user-dir (concat user-emacs-directory "var/elpa/" emacs-version "/" )) (setq package-user-dir (concat user-emacs-directory "var/elpa/" emacs-version "/" ))
(setq package-gnupghome-dir (concat user-emacs-directory "var/elpa/gnupg/" )) (setq package-gnupghome-dir (concat user-emacs-directory "var/elpa/gnupg/" ))
(setq package-quickstart t)
(setq package-quickstart-file
(concat user-emacs-directory "var/quickstart/package-quickstart-" emacs-version ".el" ))
(add-to-list 'load-path (concat user-emacs-directory "etc/materus/extra")) (add-to-list 'load-path (concat user-emacs-directory "etc/materus/extra"))
(add-to-list 'package-archives '("nongnu-devel" . "https://elpa.nongnu.org/nongnu-devel/")) (add-to-list 'package-archives '("nongnu-devel" . "https://elpa.nongnu.org/nongnu-devel/"))
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
#+end_src #+end_src
** Packages ** Packages list & function
Packages to install Packages to install
#+begin_src emacs-lisp #+begin_src emacs-lisp
(defvar materus/packages (defvar materus/packages
'( '(
use-package use-package
elcord elcord
persp-mode
dashboard dashboard
magit magit
git-timemachine git-timemachine
@ -170,6 +180,7 @@ Packages to install
iedit iedit
hideshowvis hideshowvis
evil evil
perspective
treemacs-evil treemacs-evil
treemacs treemacs
treemacs-nerd-icons treemacs-nerd-icons
@ -180,7 +191,6 @@ Packages to install
tree-edit tree-edit
nerd-icons nerd-icons
nerd-icons-completion nerd-icons-completion
perspective
minions minions
rainbow-delimiters rainbow-delimiters
rainbow-mode rainbow-mode
@ -214,6 +224,7 @@ Packages to install
markdown-mode markdown-mode
json-mode json-mode
nix-mode nix-mode
nixfmt
no-littering no-littering
right-click-context right-click-context
dracula-theme dracula-theme
@ -246,6 +257,7 @@ Packages to install
drag-stuff drag-stuff
dirvish dirvish
rg rg
shfmt
;; Completions & Minibuffer ;; Completions & Minibuffer
corfu corfu
company company
@ -271,11 +283,9 @@ Packages to install
(when (not (package-installed-p p)) (when (not (package-installed-p p))
(package-install p))) (package-install p)))
(package-quickstart-refresh))) (package-quickstart-refresh)))
(package-initialize)
(unless materus/use-nix-packages (unless materus/use-nix-packages
(package-initialize) (materus/install-packages))
(materus/install-packages)
(unless (file-exists-p package-quickstart-file) (package-quickstart-refresh) ))
#+end_src #+end_src
* Configuration * Configuration
General configurations of packages modes etc. General configurations of packages modes etc.
@ -283,14 +293,16 @@ General configurations of packages modes etc.
Set up no littering Set up no littering
#+begin_src emacs-lisp #+begin_src emacs-lisp
(require 'recentf) (require 'recentf)
(use-package no-littering (use-package no-littering
:config :config
(setq package-quickstart-file (setq package-quickstart-file
(concat user-emacs-directory "var/quickstart/package-quickstart-" emacs-version ".el" )) (concat user-emacs-directory "var/quickstart/package-quickstart-" emacs-version ".el" ))
(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)))
(setq custom-theme-directory (concat user-emacs-directory "etc/themes"))
(add-to-list 'custom-theme-load-path custom-theme-directory)
#+end_src #+end_src
** Graphical ** Graphical
Graphical related settings. Graphical related settings.
@ -306,7 +318,6 @@ Graphical related settings.
#+end_src #+end_src
*** Misc *** Misc
#+begin_src emacs-lisp #+begin_src emacs-lisp
(when (daemonp) (when (daemonp)
(add-hook 'after-make-frame-functions (add-hook 'after-make-frame-functions
(lambda (frame) (when (= (length (frame-list)) 2) (lambda (frame) (when (= (length (frame-list)) 2)
@ -323,7 +334,7 @@ Graphical related settings.
(global-tab-line-mode 1) (global-tab-line-mode 1)
(setq-default tab-width 4)
(tool-bar-mode -1) (tool-bar-mode -1)
(setq read-process-output-max (* 1024 1024 3)) (setq read-process-output-max (* 1024 1024 3))
@ -417,12 +428,13 @@ Org mode settings
:config :config
(require 'org-mouse) (require 'org-mouse)
(require 'org-tempo) (require 'org-tempo)
(setq org-src-window-setup 'current-window)
(add-hook 'org-mode-hook (lambda () (add-hook 'org-mode-hook (lambda ()
(setq-local (setq-local
electric-pair-inhibit-predicate electric-pair-inhibit-predicate
`(lambda (c) `(lambda (c)
(if (if
(char-equal c ?<) t (,electric-pair-inhibit-predicate c))))))) (char-equal c ?<) t (,electric-pair-inhibit-predicate c)))))))
(use-package org-superstar (use-package org-superstar
:after (org) :after (org)
@ -465,8 +477,6 @@ Org mode settings
(use-package vertico-mouse (use-package vertico-mouse
:config :config
(vertico-mouse-mode 1)) (vertico-mouse-mode 1))
#+end_src #+end_src
*** Code completion *** Code completion
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -474,16 +484,16 @@ Org mode settings
:config :config
(setq global-corfu-minibuffer nil) (setq global-corfu-minibuffer nil)
(global-company-mode 1)) (global-company-mode 1))
#+end_src #+end_src
** Terms
*** Eat
#+begin_src emacs-lisp
(use-package eat)
#+end_src
** Miscellaneous ** Miscellaneous
Other configs Other configs
*** Defaults *** Defaults
#+begin_src emacs-lisp #+begin_src emacs-lisp
(electric-pair-mode 1)
(electric-indent-mode -1)
(setq-default indent-tabs-mode nil)
(setq-default buffer-file-coding-system 'utf-8-unix) (setq-default buffer-file-coding-system 'utf-8-unix)
#+end_src #+end_src
*** Elcord *** Elcord
@ -502,17 +512,16 @@ Other configs
#+end_src #+end_src
*** Undo-Tree *** Undo-Tree
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package undo-tree
(use-package undo-tree :config
:config (global-undo-tree-mode 1)
(global-undo-tree-mode 1) (defvar materus/undo-tree-dir (concat user-emacs-directory "var/undo-tree/"))
(defvar materus/undo-tree-dir (concat user-emacs-directory "var/undo-tree/")) (unless (file-exists-p materus/undo-tree-dir)
(unless (file-exists-p materus/undo-tree-dir) (make-directory materus/undo-tree-dir t))
(make-directory materus/undo-tree-dir t)) (setq undo-tree-visualizer-diff t)
(setq undo-tree-visualizer-diff t) (setq undo-tree-history-directory-alist `(("." . ,materus/undo-tree-dir )))
(setq undo-tree-history-directory-alist `(("." . ,materus/undo-tree-dir ))) (setq undo-tree-visualizer-timestamps t)
(setq undo-tree-visualizer-timestamps t) )
)
#+end_src #+end_src
*** Projectile *** Projectile
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -523,13 +532,17 @@ Other configs
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package treemacs) (use-package treemacs)
(use-package treemacs-projectile (use-package treemacs-projectile
:after (projectile treemacs)) :after (projectile treemacs))
(use-package treemacs-nerd-icons (use-package treemacs-nerd-icons
:after (nerd-icons treemacs)) :after (nerd-icons treemacs))
(use-package treemacs-perspective
:after (treemacs))
(use-package treemacs-mouse-interface
:after (treemacs))
#+end_src #+end_src
*** Magit *** Magit
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package magit) (use-package magit)
#+end_src #+end_src
*** Dirvish *** Dirvish
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -543,12 +556,17 @@ Other configs
git-msg git-msg
file-time file-time
file-size))) file-size)))
#+end_src #+end_src
*** Perspective
#+begin_src emacs-lisp
(require 'perspective)
(customize-set-variable 'persp-mode-prefix-key (kbd "C-c M-p"))
(persp-mode 1)
#+end_src
* Programming * Programming
** LSP ** LSP
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package lsp-mode) (use-package lsp-mode)
@ -558,6 +576,8 @@ Other configs
(use-package dap-gdb-lldb) (use-package dap-gdb-lldb)
(defun lsp-booster--advice-json-parse (old-fn &rest args) (defun lsp-booster--advice-json-parse (old-fn &rest args)
"Try to parse bytecode instead of json." "Try to parse bytecode instead of json."
(or (or
@ -588,24 +608,28 @@ Other configs
(cons "emacs-lsp-booster" orig-result)) (cons "emacs-lsp-booster" orig-result))
orig-result))) orig-result)))
(advice-add 'lsp-resolve-final-command :around #'lsp-booster--advice-final-command) (advice-add 'lsp-resolve-final-command :around #'lsp-booster--advice-final-command)
(add-hook 'prog-mode-hook 'display-line-numbers-mode)
#+end_src #+end_src
** Nix ** Nix
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package nix-mode)
(use-package nix-ts-mode)
(use-package nixfmt)
(use-package lsp-nix)
(with-eval-after-load 'lsp-mode (with-eval-after-load 'lsp-mode
(lsp-register-client (add-to-list 'lsp-disabled-clients '(nix-mode . nix-nil))
(make-lsp-client :new-connection (lsp-stdio-connection "nixd") (setq lsp-nix-nixd-server-path "nixd"
:major-modes '(nix-mode) lsp-nix-nixd-formatting-command [ "nixfmt" ]
:priority 0 lsp-nix-nixd-nixpkgs-expr "import <nixpkgs> { }"))
:server-id 'nixd)))
(setq lsp-nix-nixd-formatting-command "nixfmt") (setq lsp-nix-nixd-formatting-command "nixfmt")
(add-hook 'nix-mode-hook 'lsp-deferred) (add-hook 'nix-mode-hook 'lsp-deferred)
(add-hook 'nix-mode-hook 'display-line-numbers-mode) (add-hook 'nix-mode-hook 'display-line-numbers-mode)
;;(add-hook 'nix-ts-mode-hook 'lsp-deferred)
;;(add-hook 'nix-ts-mode-hook 'display-line-numbers-mode)
;;(when (treesit-language-available-p 'nix) (push '(nix-mode . nix-ts-mode) major-mode-remap-alist))
#+end_src #+end_src
** Emacs Lisp ** Emacs Lisp
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -613,46 +637,102 @@ Other configs
#+end_src #+end_src
** C/C++ ** C/C++
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package lsp-clangd)
(setq lsp-clients-clangd-args '("--fallback-style=microsoft"))
(add-hook 'c-mode-hook 'lsp-deferred) (add-hook 'c-mode-hook 'lsp-deferred)
(add-hook 'c-mode-hook 'display-line-numbers-mode) (add-hook 'c-mode-hook 'display-line-numbers-mode)
;(add-hook 'c-ts-mode-hook 'lsp-deferred)
;(add-hook 'c-ts-mode-hook 'display-line-numbers-mode)
(add-hook 'c++-mode-hook 'lsp-deferred) (add-hook 'c++-mode-hook 'lsp-deferred)
(add-hook 'c++-mode-hook 'display-line-numbers-mode) (add-hook 'c++-mode-hook 'display-line-numbers-mode)
;(add-hook 'c++-ts-mode-hook 'lsp-deferred)
;(add-hook 'c++-ts-mode-hook 'display-line-numbers-mode)
;(when (treesit-language-available-p 'c) (push '(c-mode . c-ts-mode) major-mode-remap-alist))
;(when (treesit-language-available-p 'cpp) (push '(c++-mode . c++-ts-mode) major-mode-remap-alist))
(add-to-list 'c-default-style '(c-mode . "bsd"))
(add-to-list 'c-default-style '(c++-mode . "bsd"))
;(add-to-list 'c-default-style '(c-ts-mode . "bsd"))
;(add-to-list 'c-default-style '(c++-ts-mode . "bsd"))
#+end_src
** Python
#+begin_src emacs-lisp
(use-package lsp-pyright)
(setq lsp-pyright-langserver-command "pyright")
(add-hook 'python-mode-hook 'lsp-deferred)
#+end_src #+end_src
** Java ** Java
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package lsp-java (use-package lsp-java)
:config (setq lsp-java-vmargs '("-XX:+UseParallelGC" "-XX:GCTimeRatio=4" "-XX:AdaptiveSizePolicyWeight=90" "-Dsun.zip.disableMemoryMapping=true" "-Xmx2G" "-Xms100m"))
(add-hook 'java-mode-hook (lambda () (when (getenv "JDTLS_PATH") (setq lsp-java-server-install-dir (getenv "JDTLS_PATH"))))) (add-hook 'java-mode-hook (lambda () (when (getenv "JDTLS_PATH") (setq lsp-java-server-install-dir (getenv "JDTLS_PATH")))))
(add-hook 'java-mode-hook 'lsp-deferred) (add-hook 'java-mode-hook 'lsp-deferred)
(add-hook 'java-mode-hook 'display-line-numbers-mode)) (add-hook 'java-mode-hook 'display-line-numbers-mode)
;(add-hook 'java-ts-mode-hook (lambda () (when (getenv "JDTLS_PATH") (setq lsp-java-server-install-dir (getenv "JDTLS_PATH")))))
;(add-hook 'java-ts-mode-hook 'lsp-deferred)
;(add-hook 'java-ts-mode-hook 'display-line-numbers-mode)
;(when (treesit-language-available-p 'java) (push '(java-mode . java-ts-mode) major-mode-remap-alist))
(add-to-list 'c-default-style '(java-mode . "java"))
(add-to-list 'c-default-style '(java-ts-mode . "java"))
#+end_src #+end_src
** Other
#+begin_src emacs-lisp
(add-to-list 'c-default-style '(awk-mode . "awk"))
(add-to-list 'c-default-style '(other . "bsd"))
(setq-default c-basic-offset 4)
(setq-default c-indent-level 4)
(setq-default c-hungry-delete-key t)
(electric-pair-mode 1)
(electric-indent-mode -1)
(setq-default tab-width 4)
(setq-default indent-tabs-mode nil)
(add-hook 'prog-mode-hook 'display-line-numbers-mode)
(add-hook 'prog-mode-hook 'electric-indent-local-mode)
#+end_src
* Keybindings * Keybindings
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package cua-base) (use-package cua-base)
;; Keybinds ;;; Keybinds
;; Eat Term
(keymap-set eat-semi-char-mode-map "C-v" #'eat-yank)
(keymap-set eat-char-mode-map "C-V" #'eat-yank)
;; perspective
(global-set-key (kbd "C-x C-b") 'persp-list-buffers)
(global-set-key (kbd "C-x C-B") 'list-buffers)
(global-set-key (kbd "C-x B") 'persp-switch-to-buffer)
;; CUA
(keymap-set cua--cua-keys-keymap "C-z" 'undo-tree-undo) (keymap-set cua--cua-keys-keymap "C-z" 'undo-tree-undo)
(keymap-set cua--cua-keys-keymap "C-y" 'undo-tree-redo) (keymap-set cua--cua-keys-keymap "C-y" 'undo-tree-redo)
(cua-mode 1)
;; TAB
(keymap-set global-map "C-<iso-lefttab>" #'indent-rigidly-left-to-tab-stop) (keymap-set global-map "C-<iso-lefttab>" #'indent-rigidly-left-to-tab-stop)
(keymap-set global-map "C-<tab>" #'indent-rigidly-right-to-tab-stop) (keymap-set global-map "C-<tab>" #'indent-rigidly-right-to-tab-stop)
;; Hyper
(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 ) (define-key key-translation-map (kbd "∇") 'event-apply-hyper-modifier )
(global-set-key (kbd "C-H-t") 'treemacs) (global-set-key (kbd "C-H-t") 'treemacs)
(cua-mode 1)
#+end_src #+end_src
* Snippets * Snippets
** Yasnippet init ** Yasnippet init
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package yasnippet (use-package yasnippet
:config (yas-global-mode 1)) :config (yas-global-mode 1))
#+end_src #+end_src
* Other * Other
** Update config script ** Update config script
@ -693,7 +773,6 @@ Byte compile files.
* Test * Test
Just for testing some code Just for testing some code
#+begin_src emacs-lisp #+begin_src emacs-lisp
;;; (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)))
@ -702,9 +781,4 @@ Just for testing some code
;;; (setq completion-styles '(orderless basic) ;;; (setq completion-styles '(orderless basic)
;;; completion-category-defaults nil ;;; completion-category-defaults nil
;;; completion-category-overrides '((file (styles partial-completion)))) ;;; completion-category-overrides '((file (styles partial-completion))))
#+end_src #+end_src

View File

@ -1,4 +1,6 @@
;;; -*- lexical-binding: t; -*- ;;; -*- lexical-binding: t; -*-
;; [[file:../../emacs-materus-config.org::*Compile Time][Compile Time:2]]
(eval-when-compile (eval-when-compile
(defvar doom-modeline-support-imenu nil) (defvar doom-modeline-support-imenu nil)
(defvar display-time-24hr-format nil) (defvar display-time-24hr-format nil)
@ -8,24 +10,24 @@
(declare-function make-lsp-client "lsp-mode") (declare-function make-lsp-client "lsp-mode")
(declare-function lsp-register-client "lsp-mode" ( CLIENT )) (declare-function lsp-register-client "lsp-mode" ( CLIENT ))
) )
;; Compile Time:2 ends here
;; [[file:../../emacs-materus-config.org::*Init package manager config][Init package manager config:1]]
(require 'cl-lib) (require 'cl-lib)
(require 'package) (require 'package)
(setq package-user-dir (concat user-emacs-directory "var/elpa/" emacs-version "/" )) (setq package-user-dir (concat user-emacs-directory "var/elpa/" emacs-version "/" ))
(setq package-gnupghome-dir (concat user-emacs-directory "var/elpa/gnupg/" )) (setq package-gnupghome-dir (concat user-emacs-directory "var/elpa/gnupg/" ))
(setq package-quickstart t)
(setq package-quickstart-file
(concat user-emacs-directory "var/quickstart/package-quickstart-" emacs-version ".el" ))
(add-to-list 'load-path (concat user-emacs-directory "etc/materus/extra")) (add-to-list 'load-path (concat user-emacs-directory "etc/materus/extra"))
(add-to-list 'package-archives '("nongnu-devel" . "https://elpa.nongnu.org/nongnu-devel/")) (add-to-list 'package-archives '("nongnu-devel" . "https://elpa.nongnu.org/nongnu-devel/"))
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
;; Init package manager config:1 ends here
;; [[file:../../emacs-materus-config.org::*Packages list & function][Packages list & function:1]]
(defvar materus/packages (defvar materus/packages
'( '(
use-package use-package
elcord elcord
persp-mode
dashboard dashboard
magit magit
git-timemachine git-timemachine
@ -38,6 +40,7 @@
iedit iedit
hideshowvis hideshowvis
evil evil
perspective
treemacs-evil treemacs-evil
treemacs treemacs
treemacs-nerd-icons treemacs-nerd-icons
@ -48,7 +51,6 @@
tree-edit tree-edit
nerd-icons nerd-icons
nerd-icons-completion nerd-icons-completion
perspective
minions minions
rainbow-delimiters rainbow-delimiters
rainbow-mode rainbow-mode
@ -82,6 +84,7 @@
markdown-mode markdown-mode
json-mode json-mode
nix-mode nix-mode
nixfmt
no-littering no-littering
right-click-context right-click-context
dracula-theme dracula-theme
@ -114,6 +117,7 @@
drag-stuff drag-stuff
dirvish dirvish
rg rg
shfmt
;; Completions & Minibuffer ;; Completions & Minibuffer
corfu corfu
company company
@ -139,21 +143,26 @@
(when (not (package-installed-p p)) (when (not (package-installed-p p))
(package-install p))) (package-install p)))
(package-quickstart-refresh))) (package-quickstart-refresh)))
(package-initialize)
(unless materus/use-nix-packages (unless materus/use-nix-packages
(package-initialize) (materus/install-packages))
(materus/install-packages) ;; Packages list & function:1 ends here
(unless (file-exists-p package-quickstart-file) (package-quickstart-refresh) ))
;; [[file:../../emacs-materus-config.org::*No Littering][No Littering:1]]
(require 'recentf) (require 'recentf)
(use-package no-littering (use-package no-littering
:config :config
(setq package-quickstart-file (setq package-quickstart-file
(concat user-emacs-directory "var/quickstart/package-quickstart-" emacs-version ".el" )) (concat user-emacs-directory "var/quickstart/package-quickstart-" emacs-version ".el" ))
(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)))
(setq custom-theme-directory (concat user-emacs-directory "etc/themes"))
(add-to-list 'custom-theme-load-path custom-theme-directory)
;; No Littering:1 ends here
;; [[file:../../emacs-materus-config.org::*Mouse][Mouse:1]]
(context-menu-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)
@ -161,7 +170,9 @@
(xterm-mouse-mode 1) (xterm-mouse-mode 1)
(pixel-scroll-precision-mode 1) (pixel-scroll-precision-mode 1)
(setq-default pixel-scroll-precision-large-scroll-height 10.0) (setq-default pixel-scroll-precision-large-scroll-height 10.0)
;; Mouse:1 ends here
;; [[file:../../emacs-materus-config.org::*Misc][Misc:1]]
(when (daemonp) (when (daemonp)
(add-hook 'after-make-frame-functions (add-hook 'after-make-frame-functions
(lambda (frame) (when (= (length (frame-list)) 2) (lambda (frame) (when (= (length (frame-list)) 2)
@ -178,7 +189,7 @@
(global-tab-line-mode 1) (global-tab-line-mode 1)
(setq-default tab-width 4)
(tool-bar-mode -1) (tool-bar-mode -1)
(setq read-process-output-max (* 1024 1024 3)) (setq read-process-output-max (* 1024 1024 3))
@ -220,7 +231,9 @@
(when (= (seq-count #'buffer-file-name (buffer-list)) 0) (when (= (seq-count #'buffer-file-name (buffer-list)) 0)
(apply orig-fun args))) (apply orig-fun args)))
(advice-add 'display-startup-screen :around #'startup-screen-advice) ; Hide startup screen if started with file (advice-add 'display-startup-screen :around #'startup-screen-advice) ; Hide startup screen if started with file
;; Misc:1 ends here
;; [[file:../../emacs-materus-config.org::*Dashboard][Dashboard:1]]
(use-package dashboard (use-package dashboard
:after (nerd-icons projectile) :after (nerd-icons projectile)
:config :config
@ -238,7 +251,9 @@
(setq initial-buffer-choice (lambda () (get-buffer "*dashboard*"))) ; Show dashboard when emacs is running as daemon (setq initial-buffer-choice (lambda () (get-buffer "*dashboard*"))) ; Show dashboard when emacs is running as daemon
) )
) )
;; Dashboard:1 ends here
;; [[file:../../emacs-materus-config.org::*Modeline][Modeline:1]]
(use-package doom-modeline (use-package doom-modeline
:init (setq doom-modeline-support-imenu t) :init (setq doom-modeline-support-imenu t)
:hook (after-init . doom-modeline-mode) :hook (after-init . doom-modeline-mode)
@ -255,7 +270,9 @@
(use-package minions (use-package minions
:hook (after-init . minions-mode)) :hook (after-init . minions-mode))
;; Modeline:1 ends here
;; [[file:../../emacs-materus-config.org::*Org-mode][Org-mode:1]]
(use-package org (use-package org
:mode (("\\.org$" . org-mode)) :mode (("\\.org$" . org-mode))
:hook :hook
@ -265,12 +282,13 @@
:config :config
(require 'org-mouse) (require 'org-mouse)
(require 'org-tempo) (require 'org-tempo)
(setq org-src-window-setup 'current-window)
(add-hook 'org-mode-hook (lambda () (add-hook 'org-mode-hook (lambda ()
(setq-local (setq-local
electric-pair-inhibit-predicate electric-pair-inhibit-predicate
`(lambda (c) `(lambda (c)
(if (if
(char-equal c ?<) t (,electric-pair-inhibit-predicate c))))))) (char-equal c ?<) t (,electric-pair-inhibit-predicate c)))))))
(use-package org-superstar (use-package org-superstar
:after (org) :after (org)
@ -286,7 +304,9 @@
:hook :hook
((org-mode . toc-org-mode ) ((org-mode . toc-org-mode )
(markdown-mode . toc-org-mode))) (markdown-mode . toc-org-mode)))
;; Org-mode:1 ends here
;; [[file:../../emacs-materus-config.org::*Minibuffer][Minibuffer:1]]
(use-package consult) (use-package consult)
(use-package marginalia) (use-package marginalia)
(use-package orderless) (use-package orderless)
@ -309,17 +329,24 @@
(use-package vertico-mouse (use-package vertico-mouse
:config :config
(vertico-mouse-mode 1)) (vertico-mouse-mode 1))
;; Minibuffer:1 ends here
;; [[file:../../emacs-materus-config.org::*Code completion][Code completion:1]]
(use-package company (use-package company
:config :config
(setq global-corfu-minibuffer nil) (setq global-corfu-minibuffer nil)
(global-company-mode 1)) (global-company-mode 1))
;; Code completion:1 ends here
(electric-pair-mode 1) ;; [[file:../../emacs-materus-config.org::*Eat][Eat:1]]
(electric-indent-mode -1) (use-package eat)
(setq-default indent-tabs-mode nil) ;; Eat:1 ends here
;; [[file:../../emacs-materus-config.org::*Defaults][Defaults:1]]
(setq-default buffer-file-coding-system 'utf-8-unix) (setq-default buffer-file-coding-system 'utf-8-unix)
;; Defaults:1 ends here
;; [[file:../../emacs-materus-config.org::*Elcord][Elcord:1]]
(defun materus/elcord-toggle (&optional _frame) (defun materus/elcord-toggle (&optional _frame)
"Toggle elcord based on visible frames" "Toggle elcord based on visible frames"
(if (> (length (frame-list)) 1) (if (> (length (frame-list)) 1)
@ -331,7 +358,9 @@
(unless (daemonp) (elcord-mode 1)) (unless (daemonp) (elcord-mode 1))
(add-hook 'after-delete-frame-functions 'materus/elcord-toggle) (add-hook 'after-delete-frame-functions 'materus/elcord-toggle)
(add-hook 'server-after-make-frame-hook 'materus/elcord-toggle)) (add-hook 'server-after-make-frame-hook 'materus/elcord-toggle))
;; Elcord:1 ends here
;; [[file:../../emacs-materus-config.org::*Undo-Tree][Undo-Tree:1]]
(use-package undo-tree (use-package undo-tree
:config :config
(global-undo-tree-mode 1) (global-undo-tree-mode 1)
@ -342,18 +371,30 @@
(setq undo-tree-history-directory-alist `(("." . ,materus/undo-tree-dir ))) (setq undo-tree-history-directory-alist `(("." . ,materus/undo-tree-dir )))
(setq undo-tree-visualizer-timestamps t) (setq undo-tree-visualizer-timestamps t)
) )
;; Undo-Tree:1 ends here
;; [[file:../../emacs-materus-config.org::*Projectile][Projectile:1]]
(use-package projectile (use-package projectile
:config (projectile-mode 1)) :config (projectile-mode 1))
;; Projectile:1 ends here
;; [[file:../../emacs-materus-config.org::*Treemacs][Treemacs:1]]
(use-package treemacs) (use-package treemacs)
(use-package treemacs-projectile (use-package treemacs-projectile
:after (projectile treemacs)) :after (projectile treemacs))
(use-package treemacs-nerd-icons (use-package treemacs-nerd-icons
:after (nerd-icons treemacs)) :after (nerd-icons treemacs))
(use-package treemacs-perspective
:after (treemacs))
(use-package treemacs-mouse-interface
:after (treemacs))
;; Treemacs:1 ends here
;; [[file:../../emacs-materus-config.org::*Magit][Magit:1]]
(use-package magit) (use-package magit)
;; Magit:1 ends here
;; [[file:../../emacs-materus-config.org::*Dirvish][Dirvish:1]]
(use-package dirvish (use-package dirvish
:config (dirvish-override-dired-mode 1) :config (dirvish-override-dired-mode 1)
(setq dirvish-attributes (setq dirvish-attributes
@ -364,7 +405,15 @@
git-msg git-msg
file-time file-time
file-size))) file-size)))
;; Dirvish:1 ends here
;; [[file:../../emacs-materus-config.org::*Perspective][Perspective:1]]
(require 'perspective)
(customize-set-variable 'persp-mode-prefix-key (kbd "C-c M-p"))
(persp-mode 1)
;; Perspective:1 ends here
;; [[file:../../emacs-materus-config.org::*LSP][LSP:1]]
(use-package lsp-mode) (use-package lsp-mode)
@ -374,6 +423,8 @@
(use-package dap-gdb-lldb) (use-package dap-gdb-lldb)
(defun lsp-booster--advice-json-parse (old-fn &rest args) (defun lsp-booster--advice-json-parse (old-fn &rest args)
"Try to parse bytecode instead of json." "Try to parse bytecode instead of json."
(or (or
@ -404,53 +455,130 @@
(cons "emacs-lsp-booster" orig-result)) (cons "emacs-lsp-booster" orig-result))
orig-result))) orig-result)))
(advice-add 'lsp-resolve-final-command :around #'lsp-booster--advice-final-command) (advice-add 'lsp-resolve-final-command :around #'lsp-booster--advice-final-command)
;; LSP:1 ends here
;; [[file:../../emacs-materus-config.org::*Nix][Nix:1]]
(add-hook 'prog-mode-hook 'display-line-numbers-mode) (use-package nix-mode)
(use-package nix-ts-mode)
(use-package nixfmt)
(use-package lsp-nix)
(with-eval-after-load 'lsp-mode (with-eval-after-load 'lsp-mode
(lsp-register-client (add-to-list 'lsp-disabled-clients '(nix-mode . nix-nil))
(make-lsp-client :new-connection (lsp-stdio-connection "nixd") (setq lsp-nix-nixd-server-path "nixd"
:major-modes '(nix-mode) lsp-nix-nixd-formatting-command [ "nixfmt" ]
:priority 0 lsp-nix-nixd-nixpkgs-expr "import <nixpkgs> { }"))
:server-id 'nixd)))
(setq lsp-nix-nixd-formatting-command "nixfmt") (setq lsp-nix-nixd-formatting-command "nixfmt")
(add-hook 'nix-mode-hook 'lsp-deferred) (add-hook 'nix-mode-hook 'lsp-deferred)
(add-hook 'nix-mode-hook 'display-line-numbers-mode) (add-hook 'nix-mode-hook 'display-line-numbers-mode)
;;(add-hook 'nix-ts-mode-hook 'lsp-deferred)
;;(add-hook 'nix-ts-mode-hook 'display-line-numbers-mode)
;;(when (treesit-language-available-p 'nix) (push '(nix-mode . nix-ts-mode) major-mode-remap-alist))
;; Nix:1 ends here
;; [[file:../../emacs-materus-config.org::*Emacs Lisp][Emacs Lisp:1]]
(add-hook 'emacs-lisp-mode-hook 'display-line-numbers-mode) (add-hook 'emacs-lisp-mode-hook 'display-line-numbers-mode)
;; Emacs Lisp:1 ends here
;; [[file:../../emacs-materus-config.org::*C/C++][C/C++:1]]
(use-package lsp-clangd)
(setq lsp-clients-clangd-args '("--fallback-style=microsoft"))
(add-hook 'c-mode-hook 'lsp-deferred) (add-hook 'c-mode-hook 'lsp-deferred)
(add-hook 'c-mode-hook 'display-line-numbers-mode) (add-hook 'c-mode-hook 'display-line-numbers-mode)
;(add-hook 'c-ts-mode-hook 'lsp-deferred)
;(add-hook 'c-ts-mode-hook 'display-line-numbers-mode)
(add-hook 'c++-mode-hook 'lsp-deferred) (add-hook 'c++-mode-hook 'lsp-deferred)
(add-hook 'c++-mode-hook 'display-line-numbers-mode) (add-hook 'c++-mode-hook 'display-line-numbers-mode)
;(add-hook 'c++-ts-mode-hook 'lsp-deferred)
;(add-hook 'c++-ts-mode-hook 'display-line-numbers-mode)
;(when (treesit-language-available-p 'c) (push '(c-mode . c-ts-mode) major-mode-remap-alist))
;(when (treesit-language-available-p 'cpp) (push '(c++-mode . c++-ts-mode) major-mode-remap-alist))
(use-package lsp-java (add-to-list 'c-default-style '(c-mode . "bsd"))
:config (add-to-list 'c-default-style '(c++-mode . "bsd"))
(add-hook 'java-mode-hook (lambda () (when (getenv "JDTLS_PATH") (setq lsp-java-server-install-dir (getenv "JDTLS_PATH"))))) ;(add-to-list 'c-default-style '(c-ts-mode . "bsd"))
(add-hook 'java-mode-hook 'lsp-deferred) ;(add-to-list 'c-default-style '(c++-ts-mode . "bsd"))
(add-hook 'java-mode-hook 'display-line-numbers-mode)) ;; C/C++:1 ends here
;; [[file:../../emacs-materus-config.org::*Python][Python:1]]
(use-package lsp-pyright)
(setq lsp-pyright-langserver-command "pyright")
(add-hook 'python-mode-hook 'lsp-deferred)
;; Python:1 ends here
;; [[file:../../emacs-materus-config.org::*Java][Java:1]]
(use-package lsp-java)
(setq lsp-java-vmargs '("-XX:+UseParallelGC" "-XX:GCTimeRatio=4" "-XX:AdaptiveSizePolicyWeight=90" "-Dsun.zip.disableMemoryMapping=true" "-Xmx2G" "-Xms100m"))
(add-hook 'java-mode-hook (lambda () (when (getenv "JDTLS_PATH") (setq lsp-java-server-install-dir (getenv "JDTLS_PATH")))))
(add-hook 'java-mode-hook 'lsp-deferred)
(add-hook 'java-mode-hook 'display-line-numbers-mode)
;(add-hook 'java-ts-mode-hook (lambda () (when (getenv "JDTLS_PATH") (setq lsp-java-server-install-dir (getenv "JDTLS_PATH")))))
;(add-hook 'java-ts-mode-hook 'lsp-deferred)
;(add-hook 'java-ts-mode-hook 'display-line-numbers-mode)
;(when (treesit-language-available-p 'java) (push '(java-mode . java-ts-mode) major-mode-remap-alist))
(add-to-list 'c-default-style '(java-mode . "java"))
(add-to-list 'c-default-style '(java-ts-mode . "java"))
;; Java:1 ends here
;; [[file:../../emacs-materus-config.org::*Other][Other:1]]
(add-to-list 'c-default-style '(awk-mode . "awk"))
(add-to-list 'c-default-style '(other . "bsd"))
(setq-default c-basic-offset 4)
(setq-default c-indent-level 4)
(setq-default c-hungry-delete-key t)
(electric-pair-mode 1)
(electric-indent-mode -1)
(setq-default tab-width 4)
(setq-default indent-tabs-mode nil)
(add-hook 'prog-mode-hook 'display-line-numbers-mode)
(add-hook 'prog-mode-hook 'electric-indent-local-mode)
;; Other:1 ends here
;; [[file:../../emacs-materus-config.org::*Keybindings][Keybindings:1]]
(use-package cua-base) (use-package cua-base)
;; Keybinds ;;; Keybinds
;; Eat Term
(keymap-set eat-semi-char-mode-map "C-v" #'eat-yank)
(keymap-set eat-char-mode-map "C-V" #'eat-yank)
;; perspective
(global-set-key (kbd "C-x C-b") 'persp-list-buffers)
(global-set-key (kbd "C-x C-B") 'list-buffers)
(global-set-key (kbd "C-x B") 'persp-switch-to-buffer)
;; CUA
(keymap-set cua--cua-keys-keymap "C-z" 'undo-tree-undo) (keymap-set cua--cua-keys-keymap "C-z" 'undo-tree-undo)
(keymap-set cua--cua-keys-keymap "C-y" 'undo-tree-redo) (keymap-set cua--cua-keys-keymap "C-y" 'undo-tree-redo)
(cua-mode 1)
;; TAB
(keymap-set global-map "C-<iso-lefttab>" #'indent-rigidly-left-to-tab-stop) (keymap-set global-map "C-<iso-lefttab>" #'indent-rigidly-left-to-tab-stop)
(keymap-set global-map "C-<tab>" #'indent-rigidly-right-to-tab-stop) (keymap-set global-map "C-<tab>" #'indent-rigidly-right-to-tab-stop)
;; Hyper
(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 ) (define-key key-translation-map (kbd "") 'event-apply-hyper-modifier )
(global-set-key (kbd "C-H-t") 'treemacs) (global-set-key (kbd "C-H-t") 'treemacs)
(cua-mode 1) ;; Keybindings:1 ends here
;; [[file:../../emacs-materus-config.org::*Yasnippet init][Yasnippet init:1]]
(use-package yasnippet (use-package yasnippet
:config (yas-global-mode 1)) :config (yas-global-mode 1))
;; Yasnippet init:1 ends here
;; [[file:../../emacs-materus-config.org::*Update config script][Update config script:1]]
(defun materus/sync-config () (defun materus/sync-config ()
"Function to sync config from MATERUS_CONFIG_DIR to emacs folder" "Function to sync config from MATERUS_CONFIG_DIR to emacs folder"
(if (getenv "MATERUS_CONFIG_DIR") (if (getenv "MATERUS_CONFIG_DIR")
@ -477,9 +605,13 @@
"Will sync and compile config" "Will sync and compile config"
(interactive) (interactive)
(when (materus/sync-config) (materus/compile-config-if-needed) (byte-recompile-directory (concat user-emacs-directory "etc/materus/extra") 0 t))) (when (materus/sync-config) (materus/compile-config-if-needed) (byte-recompile-directory (concat user-emacs-directory "etc/materus/extra") 0 t)))
;; Update config script:1 ends here
;; [[file:../../emacs-materus-config.org::*Byte compile][Byte compile:1]]
(materus/compile-config-if-needed) (materus/compile-config-if-needed)
;; Byte compile:1 ends here
;; [[file:../../emacs-materus-config.org::*Test][Test:1]]
;;; (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)))
@ -488,3 +620,4 @@
;;; (setq completion-styles '(orderless basic) ;;; (setq completion-styles '(orderless basic)
;;; completion-category-defaults nil ;;; completion-category-defaults nil
;;; completion-category-overrides '((file (styles partial-completion)))) ;;; completion-category-overrides '((file (styles partial-completion))))
;; Test:1 ends here

View File

@ -1,7 +1,8 @@
;;; -*- lexical-binding: t; -*- ;;; -*- lexical-binding: t; -*-
(setq-default materus/use-nix-packages (require 'materus-config nil 'noerror)) (setq-default materus/use-nix-packages (require 'materus-config nil 'noerror))
(unless (file-directory-p (concat user-emacs-directory "var/quickstart")) (unless (file-directory-p (concat user-emacs-directory "var/quickstart"))
(make-directory (concat user-emacs-directory "var/quickstart") t)) (make-directory (concat user-emacs-directory "var/quickstart") t))
(load (concat user-emacs-directory "nix-init") t) (load (concat user-emacs-directory "etc/materus/nix-init") t)
(load (concat user-emacs-directory "etc/materus/emacs-config")) (load (concat user-emacs-directory "etc/materus/emacs-config"))
(load custom-file t) (load custom-file t)

View File

@ -647,11 +647,11 @@
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1731139594, "lastModified": 1731676054,
"narHash": "sha256-IigrKK3vYRpUu+HEjPL/phrfh7Ox881er1UEsZvw9Q4=", "narHash": "sha256-OZiZ3m8SCMfh3B6bfGC/Bm4x3qc1m2SVEAlkV6iY7Yg=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "76612b17c0ce71689921ca12d9ffdc9c23ce40b2", "rev": "5e4fbfb6b3de1aa2872b76d49fafc942626e2add",
"type": "github" "type": "github"
}, },
"original": { "original": {