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.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_fallbackStyle" = "Microsoft";

View File

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

View File

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

View File

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

View File

@ -58,7 +58,7 @@ let
open-vsx.ms-azuretools.vscode-docker
open-vsx.webfreak.debug
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
open-vsx.esbenp.prettier-vscode
open-vsx.formulahendry.code-runner
@ -95,7 +95,7 @@ let
"nix.enableLanguageServer" = lib.mkDefault true;
"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" = {
"nixd" = { "formatting" = { "command" = lib.mkDefault [ "nixfmt" ]; }; };
};

View File

@ -1,30 +1,35 @@
{ config, lib, pkgs, materusArg, materusCfg, ... }:
{
config,
lib,
pkgs,
materusArg,
materusCfg,
...
}:
let
emacs-git =
materusCfg.configInputs.emacs-overlay.packages.x86_64-linux.emacs-git;
emacs-pkg = materusCfg.configInputs.emacs-overlay.packages.x86_64-linux.emacs-unstable;
materus-config = e:
materus-config =
e:
e.trivialBuild {
pname = "materus-config";
src = pkgs.writeText "materus-config.el" ''
(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
(insert-file-contents "${config.programs.emacs.package}/opt/emacs/buildtime")
(buffer-string)))))))
(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")
(buffer-string)))))))
(provide 'materus-config)
'';
version = "1.0.0";
};
configPath = "${materusArg.cfg.path}" + "/extraFiles/config/emacs/";
packages = epkgs:
with epkgs; [
packages =
epkgs: with epkgs; [
(materus-config epkgs)
treesit-grammars.with-all-grammars
use-package
elcord
persp-mode
dashboard
magit
git-timemachine
@ -37,17 +42,17 @@ let
iedit
hideshowvis
evil
perspective
treemacs-evil
treemacs
treemacs-nerd-icons
treemacs-perspective
treemacs-nerd-icons
treemacs-icons-dired
treemacs-magit
treemacs-projectile
tree-edit
nerd-icons
nerd-icons-completion
perspective
minions
rainbow-delimiters
rainbow-mode
@ -56,6 +61,8 @@ let
lsp-java
lsp-jedi
lsp-haskell
lsp-pascal
lsp-pyright
lsp-ui
lsp-treemacs
dap-mode
@ -81,6 +88,8 @@ let
markdown-mode
json-mode
nix-mode
nixfmt
nix-ts-mode
no-littering
right-click-context
dracula-theme
@ -93,7 +102,6 @@ let
yasnippet
async
request
nix-ts-mode
markdown-ts-mode
llvm-ts-mode
treesit-fold
@ -113,6 +121,7 @@ let
drag-stuff
dirvish
rg
shfmt
# Completions & Minibuffer
corfu
company
@ -128,11 +137,13 @@ let
emacsEnv = pkgs.buildEnv {
name = "emacs-env";
paths = with pkgs; [
pyright
shfmt
ripgrep
cmake
gnumake
nixfmt-classic
python3
nixfmt-rfc-style
python3Full
lua
multimarkdown
git
@ -142,10 +153,11 @@ let
llvmPackages.lldb
(hiPrio gcc)
gdb
nixd
materusArg.unstable.nixd
jdt-language-server
jdk
gradle
fpc
omnisharp-roslyn
];
};
@ -153,15 +165,23 @@ let
cfg = config.materus.profile.editor.emacs;
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 "LD_LIBRARY_PATH" (concat (getenv "LD_LIBRARY_PATH") ":${emacsEnv}/lib"))
(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 66 = Hyper_L\" -e \"remove Mod4 = Hyper_L\" -e \"add Mod3 = Hyper_L\" &" nil 0)
'';
in {
options.materus.profile.editor.emacs.enable =
materusArg.pkgs.lib.mkBoolOpt false "Enable emacs with materus cfg";
in
{
options.materus.profile.editor.emacs.enable = materusArg.pkgs.lib.mkBoolOpt false "Enable emacs with materus cfg";
config = lib.mkIf cfg.enable {
home.activation.emacsSetup = lib.hm.dag.entryAfter [ "linkGeneration" ] ''
@ -172,29 +192,34 @@ in {
run ${config.programs.emacs.finalPackage}/bin/emacs -Q --batch \
--eval '(setq warning-minimum-log-level :error)' \
--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 '(package-initialize)' \
--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/init.el")' \
--eval '(byte-compile-file "${config.xdg.configHome}/emacs/nix-init.el")' \
--eval '(byte-compile-file "${config.xdg.configHome}/emacs/etc/materus/emacs-config.el")'
--eval '(setq warning-minimum-log-level :error)' \
--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 '(package-initialize)' \
--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/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")'
'';
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
xdg.desktopEntries.emacs = {
name = "Emacs";
genericName = "Edytor tekstu";
comment = "Edytuj tekst";
exec = ''env COLORTERM=truecolor emacsclient -a "" -r -n %F'';
exec = ''env COLORTERM=truecolor emacsclient -a "" -r %F'';
icon = "emacs";
terminal = false;
type = "Application";
categories = [ "Development" "TextEditor" ];
categories = [
"Development"
"TextEditor"
];
mimeType = [
"text/english"
"text/plain"
@ -214,7 +239,7 @@ in {
"x-scheme-handler/org-protocol"
];
actions.new-window = {
exec = ''env COLORTERM=truecolor emacsclient -a "" -c -n %F'';
exec = ''env COLORTERM=truecolor emacsclient -a "" -c %F'';
name = "Nowe okno";
};
actions.no-daemon = {
@ -225,35 +250,118 @@ in {
programs.emacs = {
enable = true;
package = lib.mkDefault ((emacs-git.override {
withSQLite3 = true;
withWebP = true;
withX = true;
#withXwidgets = true;
withGTK3 = true;
withAlsaLib = true;
withGconf = true;
withImageMagick = true;
}).overrideAttrs (f: p: {
#Remove .desktop files, will use my own. Add file with buildtime in case of using elpaca
postInstall = p.postInstall + ''
rm -fr $out/share/applications/*
mkdir -p $out/opt/emacs
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
package = lib.mkDefault (
(emacs-pkg.override {
withSQLite3 = true;
withWebP = true;
withX = true;
#withXwidgets = true;
withGTK3 = true;
withAlsaLib = true;
withGconf = true;
withImageMagick = true;
}).overrideAttrs
(
f: p: {
#Remove .desktop files, will use my own. Add file with buildtime in case of using elpaca
postInstall =
p.postInstall
+ ''
rm -fr $out/share/applications/*
mkdir -p $out/opt/emacs
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-java = (pp.lsp-java.overrideAttrs (f: p: { buildPhase = "export LSP_USE_PLISTS=true\n" + p.buildPhase;}));
lsp-jedi= (pp.lsp-jedi.overrideAttrs (f: p: { buildPhase = "export LSP_USE_PLISTS=true\n" + p.buildPhase;}));
lsp-haskell = (pp.lsp-haskell.overrideAttrs (f: p: { buildPhase = "export LSP_USE_PLISTS=true\n" + p.buildPhase;}));
lsp-ui = (pp.lsp-ui.overrideAttrs (f: p: { buildPhase = "export LSP_USE_PLISTS=true\n" + p.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;}));
})));
lsp-mode = (
pp.lsp-mode.overrideAttrs (
f: p: {
patches = [ ./lsp-mode.patch ];
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
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 =
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";
zshcfg = "${materusArg.cfg.path}" + "/extraFiles/config/zsh";
@ -19,11 +27,6 @@ let
fi
'';
makePlugin = nameArg: fileArg: srcArg: rec {
name = nameArg;
src = srcArg;
@ -33,15 +36,18 @@ let
};
extraPlugins = {
powerlevel10k = makePlugin "powerlevel10k" "powerlevel10k.zsh-theme" (pkgs.fetchFromGitHub {
owner = "romkatv";
repo = "powerlevel10k";
rev = "v1.20.0";
sha256 = "sha256-ES5vJXHjAKw/VHjWs8Au/3R+/aotSbY7PWnWAMzCR8E=";
});
powerlevel10k = makePlugin "powerlevel10k" "powerlevel10k.zsh-theme" (
pkgs.fetchFromGitHub {
owner = "romkatv";
repo = "powerlevel10k";
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";
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
@ -58,14 +64,13 @@ in
type = lib.types.lines;
};
config = lib.mkIf cfg.enable {
home.packages = [
pkgs.ripgrep
];
home.packages = [ pkgs.ripgrep ];
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; }
];
@ -78,27 +83,25 @@ in
historySubstringSearch.searchUpKey = "$key[Up]";
historySubstringSearch.searchDownKey = "$key[Down]";
envExtra = ''
${makeEnv "__MATERUS_HM_ZSH" "1"}
${makeEnv "__MATERUS_HM_ZSH_PROMPT" cfg.prompt}
${makeEnv "__MATERUS_HM_ZSH_PRIVATE" "0"}
'';
initExtraFirst = ''
bindkey -e
if [ -n "$EAT_SHELL_INTEGRATION_DIR" ]; then
source "$EAT_SHELL_INTEGRATION_DIR/zsh";
fi
${makeIfVar "__MATERUS_HM_ZSH_PROMPT" "p10k" ''
if [[ -r "''${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-''${(%):-%n}.zsh" ]]; then
source "''${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-''${(%):-%n}.zsh"
fi
if [[ -f "${extraPlugins.powerlevel10k.fullPath}" ]]; then
source "${extraPlugins.powerlevel10k.fullPath}"
fi
''
}
if [[ -r "''${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-''${(%):-%n}.zsh" ]]; then
source "''${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-''${(%):-%n}.zsh"
fi
if [[ -f "${extraPlugins.powerlevel10k.fullPath}" ]]; then
source "${extraPlugins.powerlevel10k.fullPath}"
fi
''}
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:-0}";
@ -112,12 +115,9 @@ in
path+="${extraPlugins.extract.path}"
fpath+="${extraPlugins.extract.path}"
fi
'';
'';
plugins = [
];
plugins = [ ];
history = {
extended = true;
@ -130,62 +130,64 @@ in
};
completionInit = ''
ZSH_COMPDUMP="''${ZSH_COMPDUMP:-''${XDG_CACHE_HOME:-${config.home.homeDirectory}/.cache}/.zcompdump-''${HOST}-''${ZSH_VERSION}}"
autoload -U compinit && compinit -d $ZSH_COMPDUMP
ZSH_COMPDUMP="''${ZSH_COMPDUMP:-''${XDG_CACHE_HOME:-${config.home.homeDirectory}/.cache}/.zcompdump-''${HOST}-''${ZSH_VERSION}}"
autoload -U compinit && compinit -d $ZSH_COMPDUMP
'';
initExtra = ''
if [[ "$__ETC_ZSHRC_SOURCED" != "1" ]]; then
. ${zshcfg}/zinputrc
fi
source ${zshcfg}/zshcompletion.zsh
initExtra =
''
if [[ "$__ETC_ZSHRC_SOURCED" != "1" ]]; then
. ${zshcfg}/zinputrc
fi
source ${zshcfg}/zshcompletion.zsh
history-substring-search-up-prefixed(){
HISTORY_SUBSTRING_SEARCH_PREFIXED=1 history-substring-search-up
}
history-substring-search-down-prefixed(){
HISTORY_SUBSTRING_SEARCH_PREFIXED=1 history-substring-search-down
}
history-substring-search-up-prefixed(){
HISTORY_SUBSTRING_SEARCH_PREFIXED=1 history-substring-search-up
}
history-substring-search-down-prefixed(){
HISTORY_SUBSTRING_SEARCH_PREFIXED=1 history-substring-search-down
}
zle -N history-substring-search-up-prefixed
zle -N history-substring-search-down-prefixed
zle -N history-substring-search-up-prefixed
zle -N history-substring-search-down-prefixed
bindkey -r "^["
bindkey "^[[1;5C" forward-word
bindkey "^[[1;5D" backward-word
bindkey "^[[1;5A" history-substring-search-up-prefixed
bindkey "^[[1;5B" history-substring-search-down-prefixed
bindkey -r "^["
bindkey "^[[1;5C" forward-word
bindkey "^[[1;5D" backward-word
bindkey "^[[1;5A" history-substring-search-up-prefixed
bindkey "^[[1;5B" history-substring-search-down-prefixed
zsh-private() {
__MATERUS_HM_ZSH_PRIVATE=1 ${lib.getExe config.programs.zsh.package}
}
zsh-private() {
__MATERUS_HM_ZSH_PRIVATE=1 ${lib.getExe config.programs.zsh.package}
}
myip() {
${lib.getExe pkgs.wget} -qO- https://wtfismyip.com/text
}
myip() {
${lib.getExe pkgs.wget} -qO- https://wtfismyip.com/text
}
speedtest() {
${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 "ee"="emacsclient -n -r --alternate-editor= "''}
speedtest() {
${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 "ee"="emacsclient -n -r --alternate-editor= "''}
'' +
makeIfVar "__MATERUS_HM_ZSH_PROMPT" "p10k" ''
if [[ "$__MATERUS_HM_ZSH_256COLORS" = "1" ]] ; then
[[ ! -f ${p10kcfg}/fullcolor.zsh ]] || source ${p10kcfg}/fullcolor.zsh
else
[[ ! -f ${p10kcfg}/compatibility.zsh ]] || source ${p10kcfg}/compatibility.zsh
fi
'' + makeIfVar "__MATERUS_HM_ZSH_PRIVATE" "1" ''
unset HISTFILE
${lib.optionalString config.programs.zsh.history.share "unsetopt SHARE_HISTORY"}
alias -- 'zsh'="__MATERUS_HM_ZSH_PRIVATE=0 zsh "
''
''
+ makeIfVar "__MATERUS_HM_ZSH_PROMPT" "p10k" ''
if [[ "$__MATERUS_HM_ZSH_256COLORS" = "1" ]] ; then
[[ ! -f ${p10kcfg}/fullcolor.zsh ]] || source ${p10kcfg}/fullcolor.zsh
else
[[ ! -f ${p10kcfg}/compatibility.zsh ]] || source ${p10kcfg}/compatibility.zsh
fi
''
+ makeIfVar "__MATERUS_HM_ZSH_PRIVATE" "1" ''
unset HISTFILE
${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;
};
}

View File

@ -1,7 +1,12 @@
;;; -*- lexical-binding: t; -*-
(defvar materus/init-early t) ; Var to ensure early-init loaded
(setq materus/init-early t) ; Probably useless
(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 native-comp-async-report-warnings-errors nil)

View File

@ -2,7 +2,7 @@
#+AUTHOR: materus
#+DESCRIPTION: materus emacs configuration
#+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
My emacs config, tangled file is [[file:etc/materus/emacs-config.el][there]]
* 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]]
- [[#compile-time][Compile Time]]
- [[#packages][Packages]]
- [[#init-1][Init]]
- [[#packages-1][Packages]]
- [[#init-package-manager-config][Init package manager config]]
- [[#packages-list--function][Packages list & function]]
- [[#configuration][Configuration]]
- [[#no-littering][No Littering]]
- [[#graphical][Graphical]]
@ -24,6 +24,8 @@ My emacs config, tangled file is [[file:etc/materus/emacs-config.el][there]]
- [[#completions][Completions]]
- [[#minibuffer][Minibuffer]]
- [[#code-completion][Code completion]]
- [[#terms][Terms]]
- [[#eat][Eat]]
- [[#miscellaneous][Miscellaneous]]
- [[#defaults][Defaults]]
- [[#elcord][Elcord]]
@ -32,16 +34,19 @@ My emacs config, tangled file is [[file:etc/materus/emacs-config.el][there]]
- [[#treemacs][Treemacs]]
- [[#magit][Magit]]
- [[#dirvish][Dirvish]]
- [[#perspective][Perspective]]
- [[#programming][Programming]]
- [[#lsp][LSP]]
- [[#nix][Nix]]
- [[#emacs-lisp][Emacs Lisp]]
- [[#cc][C/C++]]
- [[#python][Python]]
- [[#java][Java]]
- [[#other][Other]]
- [[#keybindings][Keybindings]]
- [[#snippets][Snippets]]
- [[#yasnippet-init][Yasnippet init]]
- [[#other][Other]]
- [[#other-1][Other]]
- [[#update-config-script][Update config script]]
- [[#byte-compile][Byte compile]]
- [[#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
:END:
Early init file, setting for GC and some paths.
#+begin_src emacs-lisp
#+begin_src emacs-lisp :comments no
;;; -*- lexical-binding: t; -*-
#+end_src
#+begin_src emacs-lisp
(defvar materus/init-early t) ; Var to ensure early-init loaded
(setq materus/init-early t) ; Probably useless
(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 native-comp-async-report-warnings-errors nil)
@ -109,18 +121,22 @@ Early init file, setting for GC and some paths.
:END:
Init File
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; -*-
#+end_src
#+begin_src emacs-lisp
(setq-default materus/use-nix-packages (require 'materus-config nil 'noerror))
(unless (file-directory-p (concat user-emacs-directory "var/quickstart"))
(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 custom-file t)
#+end_src
** Compile Time
#+begin_src emacs-lisp
#+begin_src emacs-lisp :comments no
;;; -*- lexical-binding: t; -*-
#+end_src
#+begin_src emacs-lisp
(eval-when-compile
(defvar doom-modeline-support-imenu 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
Package manager config if not using nix.
After some testing default package manager works best for me.
** Init
** Init package manager config
#+begin_src emacs-lisp
(require 'cl-lib)
(require 'package)
(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-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 'package-archives '("nongnu-devel" . "https://elpa.nongnu.org/nongnu-devel/"))
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
#+end_src
** Packages
** Packages list & function
Packages to install
#+begin_src emacs-lisp
(defvar materus/packages
'(
use-package
elcord
persp-mode
dashboard
magit
git-timemachine
@ -170,6 +180,7 @@ Packages to install
iedit
hideshowvis
evil
perspective
treemacs-evil
treemacs
treemacs-nerd-icons
@ -180,7 +191,6 @@ Packages to install
tree-edit
nerd-icons
nerd-icons-completion
perspective
minions
rainbow-delimiters
rainbow-mode
@ -214,6 +224,7 @@ Packages to install
markdown-mode
json-mode
nix-mode
nixfmt
no-littering
right-click-context
dracula-theme
@ -246,6 +257,7 @@ Packages to install
drag-stuff
dirvish
rg
shfmt
;; Completions & Minibuffer
corfu
company
@ -271,11 +283,9 @@ Packages to install
(when (not (package-installed-p p))
(package-install p)))
(package-quickstart-refresh)))
(package-initialize)
(unless materus/use-nix-packages
(package-initialize)
(materus/install-packages)
(unless (file-exists-p package-quickstart-file) (package-quickstart-refresh) ))
(materus/install-packages))
#+end_src
* Configuration
General configurations of packages modes etc.
@ -283,14 +293,16 @@ General configurations of packages modes etc.
Set up no littering
#+begin_src emacs-lisp
(require 'recentf)
(use-package no-littering
:config
(setq package-quickstart-file
(concat user-emacs-directory "var/quickstart/package-quickstart-" emacs-version ".el" ))
(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)))
(use-package no-littering
:config
(setq package-quickstart-file
(concat user-emacs-directory "var/quickstart/package-quickstart-" emacs-version ".el" ))
(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 custom-theme-directory (concat user-emacs-directory "etc/themes"))
(add-to-list 'custom-theme-load-path custom-theme-directory)
#+end_src
** Graphical
Graphical related settings.
@ -306,7 +318,6 @@ Graphical related settings.
#+end_src
*** Misc
#+begin_src emacs-lisp
(when (daemonp)
(add-hook 'after-make-frame-functions
(lambda (frame) (when (= (length (frame-list)) 2)
@ -323,7 +334,7 @@ Graphical related settings.
(global-tab-line-mode 1)
(setq-default tab-width 4)
(tool-bar-mode -1)
(setq read-process-output-max (* 1024 1024 3))
@ -417,12 +428,13 @@ Org mode settings
:config
(require 'org-mouse)
(require 'org-tempo)
(setq org-src-window-setup 'current-window)
(add-hook 'org-mode-hook (lambda ()
(setq-local
electric-pair-inhibit-predicate
`(lambda (c)
(if
(char-equal c ?<) t (,electric-pair-inhibit-predicate c)))))))
(setq-local
electric-pair-inhibit-predicate
`(lambda (c)
(if
(char-equal c ?<) t (,electric-pair-inhibit-predicate c)))))))
(use-package org-superstar
:after (org)
@ -465,8 +477,6 @@ Org mode settings
(use-package vertico-mouse
:config
(vertico-mouse-mode 1))
#+end_src
*** Code completion
#+begin_src emacs-lisp
@ -474,16 +484,16 @@ Org mode settings
:config
(setq global-corfu-minibuffer nil)
(global-company-mode 1))
#+end_src
** Terms
*** Eat
#+begin_src emacs-lisp
(use-package eat)
#+end_src
** Miscellaneous
Other configs
*** Defaults
#+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)
#+end_src
*** Elcord
@ -502,17 +512,16 @@ Other configs
#+end_src
*** Undo-Tree
#+begin_src emacs-lisp
(use-package undo-tree
:config
(global-undo-tree-mode 1)
(defvar materus/undo-tree-dir (concat user-emacs-directory "var/undo-tree/"))
(unless (file-exists-p materus/undo-tree-dir)
(make-directory materus/undo-tree-dir t))
(setq undo-tree-visualizer-diff t)
(setq undo-tree-history-directory-alist `(("." . ,materus/undo-tree-dir )))
(setq undo-tree-visualizer-timestamps t)
)
(use-package undo-tree
:config
(global-undo-tree-mode 1)
(defvar materus/undo-tree-dir (concat user-emacs-directory "var/undo-tree/"))
(unless (file-exists-p materus/undo-tree-dir)
(make-directory materus/undo-tree-dir t))
(setq undo-tree-visualizer-diff t)
(setq undo-tree-history-directory-alist `(("." . ,materus/undo-tree-dir )))
(setq undo-tree-visualizer-timestamps t)
)
#+end_src
*** Projectile
#+begin_src emacs-lisp
@ -523,13 +532,17 @@ Other configs
#+begin_src emacs-lisp
(use-package treemacs)
(use-package treemacs-projectile
:after (projectile treemacs))
:after (projectile treemacs))
(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
*** Magit
#+begin_src emacs-lisp
(use-package magit)
(use-package magit)
#+end_src
*** Dirvish
#+begin_src emacs-lisp
@ -543,12 +556,17 @@ Other configs
git-msg
file-time
file-size)))
#+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
** LSP
#+begin_src emacs-lisp
(use-package lsp-mode)
@ -558,6 +576,8 @@ Other configs
(use-package dap-gdb-lldb)
(defun lsp-booster--advice-json-parse (old-fn &rest args)
"Try to parse bytecode instead of json."
(or
@ -588,24 +608,28 @@ Other configs
(cons "emacs-lsp-booster" orig-result))
orig-result)))
(advice-add 'lsp-resolve-final-command :around #'lsp-booster--advice-final-command)
(add-hook 'prog-mode-hook 'display-line-numbers-mode)
#+end_src
** Nix
#+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
(lsp-register-client
(make-lsp-client :new-connection (lsp-stdio-connection "nixd")
:major-modes '(nix-mode)
:priority 0
:server-id 'nixd)))
(add-to-list 'lsp-disabled-clients '(nix-mode . nix-nil))
(setq lsp-nix-nixd-server-path "nixd"
lsp-nix-nixd-formatting-command [ "nixfmt" ]
lsp-nix-nixd-nixpkgs-expr "import <nixpkgs> { }"))
(setq lsp-nix-nixd-formatting-command "nixfmt")
(add-hook 'nix-mode-hook 'lsp-deferred)
(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
** Emacs Lisp
#+begin_src emacs-lisp
@ -613,46 +637,102 @@ Other configs
#+end_src
** C/C++
#+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 '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 '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
** Java
#+begin_src emacs-lisp
(use-package lsp-java
:config
(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))
(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"))
#+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
#+begin_src emacs-lisp
(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-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-<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 "<Calculator>") 'event-apply-hyper-modifier )
(define-key key-translation-map (kbd "∇") 'event-apply-hyper-modifier )
(global-set-key (kbd "C-H-t") 'treemacs)
(cua-mode 1)
#+end_src
* Snippets
** Yasnippet init
#+begin_src emacs-lisp
(use-package yasnippet
:config (yas-global-mode 1))
(use-package yasnippet
:config (yas-global-mode 1))
#+end_src
* Other
** Update config script
@ -693,7 +773,6 @@ Byte compile files.
* Test
Just for testing some code
#+begin_src emacs-lisp
;;; (global-set-key (kbd "C-∇") (kbd "C-H"))
;;; (global-set-key (kbd "H-∇") (lambda () (interactive) (insert-char #x2207)))
@ -702,9 +781,4 @@ Just for testing some code
;;; (setq completion-styles '(orderless basic)
;;; completion-category-defaults nil
;;; completion-category-overrides '((file (styles partial-completion))))
#+end_src

View File

@ -1,4 +1,6 @@
;;; -*- lexical-binding: t; -*-
;; [[file:../../emacs-materus-config.org::*Compile Time][Compile Time:2]]
(eval-when-compile
(defvar doom-modeline-support-imenu nil)
(defvar display-time-24hr-format nil)
@ -8,24 +10,24 @@
(declare-function make-lsp-client "lsp-mode")
(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 'package)
(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-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 'package-archives '("nongnu-devel" . "https://elpa.nongnu.org/nongnu-devel/"))
(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
'(
use-package
elcord
persp-mode
dashboard
magit
git-timemachine
@ -38,6 +40,7 @@
iedit
hideshowvis
evil
perspective
treemacs-evil
treemacs
treemacs-nerd-icons
@ -48,7 +51,6 @@
tree-edit
nerd-icons
nerd-icons-completion
perspective
minions
rainbow-delimiters
rainbow-mode
@ -82,6 +84,7 @@
markdown-mode
json-mode
nix-mode
nixfmt
no-littering
right-click-context
dracula-theme
@ -114,6 +117,7 @@
drag-stuff
dirvish
rg
shfmt
;; Completions & Minibuffer
corfu
company
@ -139,21 +143,26 @@
(when (not (package-installed-p p))
(package-install p)))
(package-quickstart-refresh)))
(package-initialize)
(unless materus/use-nix-packages
(package-initialize)
(materus/install-packages)
(unless (file-exists-p package-quickstart-file) (package-quickstart-refresh) ))
(materus/install-packages))
;; Packages list & function:1 ends here
;; [[file:../../emacs-materus-config.org::*No Littering][No Littering:1]]
(require 'recentf)
(use-package no-littering
:config
(setq package-quickstart-file
(concat user-emacs-directory "var/quickstart/package-quickstart-" emacs-version ".el" ))
(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)))
(use-package no-littering
:config
(setq package-quickstart-file
(concat user-emacs-directory "var/quickstart/package-quickstart-" emacs-version ".el" ))
(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 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)
(setq mouse-wheel-follow-mouse 't)
(setq scroll-step 1)
@ -161,7 +170,9 @@
(xterm-mouse-mode 1)
(pixel-scroll-precision-mode 1)
(setq-default pixel-scroll-precision-large-scroll-height 10.0)
;; Mouse:1 ends here
;; [[file:../../emacs-materus-config.org::*Misc][Misc:1]]
(when (daemonp)
(add-hook 'after-make-frame-functions
(lambda (frame) (when (= (length (frame-list)) 2)
@ -178,7 +189,7 @@
(global-tab-line-mode 1)
(setq-default tab-width 4)
(tool-bar-mode -1)
(setq read-process-output-max (* 1024 1024 3))
@ -220,7 +231,9 @@
(when (= (seq-count #'buffer-file-name (buffer-list)) 0)
(apply orig-fun args)))
(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
:after (nerd-icons projectile)
:config
@ -238,7 +251,9 @@
(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
:init (setq doom-modeline-support-imenu t)
:hook (after-init . doom-modeline-mode)
@ -255,7 +270,9 @@
(use-package minions
:hook (after-init . minions-mode))
;; Modeline:1 ends here
;; [[file:../../emacs-materus-config.org::*Org-mode][Org-mode:1]]
(use-package org
:mode (("\\.org$" . org-mode))
:hook
@ -265,12 +282,13 @@
:config
(require 'org-mouse)
(require 'org-tempo)
(setq org-src-window-setup 'current-window)
(add-hook 'org-mode-hook (lambda ()
(setq-local
electric-pair-inhibit-predicate
`(lambda (c)
(if
(char-equal c ?<) t (,electric-pair-inhibit-predicate c)))))))
(setq-local
electric-pair-inhibit-predicate
`(lambda (c)
(if
(char-equal c ?<) t (,electric-pair-inhibit-predicate c)))))))
(use-package org-superstar
:after (org)
@ -286,7 +304,9 @@
:hook
((org-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 marginalia)
(use-package orderless)
@ -309,17 +329,24 @@
(use-package vertico-mouse
:config
(vertico-mouse-mode 1))
;; Minibuffer:1 ends here
;; [[file:../../emacs-materus-config.org::*Code completion][Code completion:1]]
(use-package company
:config
(setq global-corfu-minibuffer nil)
(global-company-mode 1))
;; Code completion:1 ends here
(electric-pair-mode 1)
(electric-indent-mode -1)
(setq-default indent-tabs-mode nil)
;; [[file:../../emacs-materus-config.org::*Eat][Eat:1]]
(use-package eat)
;; Eat:1 ends here
;; [[file:../../emacs-materus-config.org::*Defaults][Defaults:1]]
(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)
"Toggle elcord based on visible frames"
(if (> (length (frame-list)) 1)
@ -331,7 +358,9 @@
(unless (daemonp) (elcord-mode 1))
(add-hook 'after-delete-frame-functions '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
:config
(global-undo-tree-mode 1)
@ -342,18 +371,30 @@
(setq undo-tree-history-directory-alist `(("." . ,materus/undo-tree-dir )))
(setq undo-tree-visualizer-timestamps t)
)
;; Undo-Tree:1 ends here
;; [[file:../../emacs-materus-config.org::*Projectile][Projectile:1]]
(use-package projectile
:config (projectile-mode 1))
;; Projectile:1 ends here
;; [[file:../../emacs-materus-config.org::*Treemacs][Treemacs:1]]
(use-package treemacs)
(use-package treemacs-projectile
:after (projectile treemacs))
:after (projectile treemacs))
(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)
;; Magit:1 ends here
;; [[file:../../emacs-materus-config.org::*Dirvish][Dirvish:1]]
(use-package dirvish
:config (dirvish-override-dired-mode 1)
(setq dirvish-attributes
@ -364,7 +405,15 @@
git-msg
file-time
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)
@ -374,6 +423,8 @@
(use-package dap-gdb-lldb)
(defun lsp-booster--advice-json-parse (old-fn &rest args)
"Try to parse bytecode instead of json."
(or
@ -404,53 +455,130 @@
(cons "emacs-lsp-booster" orig-result))
orig-result)))
(advice-add 'lsp-resolve-final-command :around #'lsp-booster--advice-final-command)
;; LSP:1 ends here
(add-hook 'prog-mode-hook 'display-line-numbers-mode)
;; [[file:../../emacs-materus-config.org::*Nix][Nix:1]]
(use-package nix-mode)
(use-package nix-ts-mode)
(use-package nixfmt)
(use-package lsp-nix)
(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)))
(add-to-list 'lsp-disabled-clients '(nix-mode . nix-nil))
(setq lsp-nix-nixd-server-path "nixd"
lsp-nix-nixd-formatting-command [ "nixfmt" ]
lsp-nix-nixd-nixpkgs-expr "import <nixpkgs> { }"))
(setq lsp-nix-nixd-formatting-command "nixfmt")
(add-hook 'nix-mode-hook 'lsp-deferred)
(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)
;; 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 '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 '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
:config
(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-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"))
;; 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)
;; 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-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-<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 "<Calculator>") 'event-apply-hyper-modifier )
(define-key key-translation-map (kbd "") 'event-apply-hyper-modifier )
(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
: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 ()
"Function to sync config from MATERUS_CONFIG_DIR to emacs folder"
(if (getenv "MATERUS_CONFIG_DIR")
@ -477,9 +605,13 @@
"Will sync and compile config"
(interactive)
(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)
;; 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 "H-∇") (lambda () (interactive) (insert-char #x2207)))
@ -488,3 +620,4 @@
;;; (setq completion-styles '(orderless basic)
;;; completion-category-defaults nil
;;; completion-category-overrides '((file (styles partial-completion))))
;; Test:1 ends here

View File

@ -1,7 +1,8 @@
;;; -*- lexical-binding: t; -*-
(setq-default materus/use-nix-packages (require 'materus-config nil 'noerror))
(unless (file-directory-p (concat user-emacs-directory "var/quickstart"))
(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 custom-file t)

View File

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