This commit is contained in:
Mateusz Słodkowicz 2024-11-27 13:46:39 +01:00
parent 434aae4ac5
commit a69bbcbf6a
Signed by: materus
GPG Key ID: 28D140BCA60B4FD1
6 changed files with 238 additions and 80 deletions

View File

@ -1,15 +1,44 @@
{ config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
let let
mainMirror = "https://ftp.icm.edu.pl/pub/Linux/dist/archlinux"; mainMirror = "https://ftp.icm.edu.pl/pub/Linux/dist/archlinux";
extraMirrors = [ ]; extraMirrors = [ ];
getty = [ 6 7 ]; getty = [
ttys = [ 6 7 8 ] ++ getty; 6
7
];
ttys = [
6
7
8
] ++ getty;
startPkgs = lib.strings.concatStringsSep " " [ "base" "base-devel" "dbus" "less" "nano" "bash-completion" ]; startPkgs = lib.strings.concatStringsSep " " [
"base"
"base-devel"
"dbus"
"less"
"nano"
"bash-completion"
];
scripts = { scripts = {
preStart = pkgs.writeShellScript "arch-pre-start" '' preStart = pkgs.writeShellScript "arch-pre-start" ''
if [ ! -d "/var/lib/machines/archlinux" ]; then if [ ! -d "/var/lib/machines/archlinux" ]; then
export PATH=''${PATH:+''${PATH}:}${lib.strings.makeBinPath (with pkgs; [ wget coreutils-full gnutar zstd ]) } export PATH=''${PATH:+''${PATH}:}${
lib.strings.makeBinPath (
with pkgs;
[
wget
coreutils-full
gnutar
zstd
]
)
}
ARCH_IMAGE=$(mktemp) ARCH_IMAGE=$(mktemp)
trap 'rm $ARCH_IMAGE' EXIT trap 'rm $ARCH_IMAGE' EXIT
@ -35,7 +64,11 @@ let
pacman -Syu --noconfirm pacman -Syu --noconfirm
systemctl disable getty@tty1.service systemctl disable getty@tty1.service
${lib.strings.concatStringsSep "\n" (lib.lists.forEach getty (x: "systemctl enable getty@tty${builtins.toString x}.service"))} ${
lib.strings.concatStringsSep "\n" (
lib.lists.forEach getty (x: "systemctl enable getty@tty${builtins.toString x}.service")
)
}
" "
@ -51,13 +84,12 @@ in
SystemCallFilter = [ "@known" ]; SystemCallFilter = [ "@known" ];
Timezone = "bind"; Timezone = "bind";
Capability = "all"; Capability = "all";
PrivateUsers="no"; PrivateUsers = "no";
ResolvConf = "copy-host";
}; };
filesConfig = { filesConfig = {
BindReadOnly = [ BindReadOnly = [
"/etc/resolv.conf:/etc/resolv.conf"
"/nix" "/nix"
"/run/current-system" "/run/current-system"
@ -93,7 +125,11 @@ in
preStart = "${scripts.preStart}"; preStart = "${scripts.preStart}";
overrideStrategy = "asDropin"; overrideStrategy = "asDropin";
serviceConfig = { serviceConfig = {
DeviceAllow = [ "char-tty rwm" "char-input rwm" "char-drm rwm" ]; DeviceAllow = [
"char-tty rwm"
"char-input rwm"
"char-drm rwm"
];
}; };
}; };
} }

View File

@ -41,9 +41,7 @@ let
which-key which-key
iedit iedit
hideshowvis hideshowvis
evil
perspective perspective
treemacs-evil
treemacs treemacs
treemacs-perspective treemacs-perspective
treemacs-nerd-icons treemacs-nerd-icons
@ -81,7 +79,7 @@ let
org-roam-ui org-roam-ui
org-review org-review
org-present org-present
org-superstar org-modern
org-auto-tangle org-auto-tangle
visual-fill-column visual-fill-column
csharp-mode csharp-mode
@ -100,6 +98,7 @@ let
bash-completion bash-completion
eldoc-box eldoc-box
yasnippet yasnippet
yasnippet-capf
async async
request request
markdown-ts-mode markdown-ts-mode
@ -128,14 +127,15 @@ let
scroll-restore scroll-restore
highlight-indent-guides highlight-indent-guides
diff-hl diff-hl
transient
embark
embark-consult
ef-themes
# Completions & Minibuffer # Completions & Minibuffer
corfu corfu
corfu-terminal corfu-terminal
kind-icon kind-icon
cape cape
embark
embark-consult
orderless orderless
vertico vertico
marginalia marginalia
@ -167,7 +167,9 @@ let
jdk jdk
gradle gradle
fpc fpc
nodejs
omnisharp-roslyn omnisharp-roslyn
texlive.combined.scheme-basic
]; ];
}; };
@ -175,6 +177,7 @@ let
setNixInit = '' setNixInit = ''
(defvar lsp-java-configuration-runtimes nil) (defvar lsp-java-configuration-runtimes nil)
(setq dap-lldb-debug-program '("${pkgs.llvmPackages.lldb}/bin/lldb-vscode"))
(setq lsp-java-configuration-runtimes '[(:name "JavaSE-1.8" (setq lsp-java-configuration-runtimes '[(:name "JavaSE-1.8"
:path "${pkgs.jdk8}/lib/openjdk/") :path "${pkgs.jdk8}/lib/openjdk/")
(:name "JavaSE-17" (:name "JavaSE-17"

View File

@ -158,6 +158,9 @@ in
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
bindkey '^[[3~' delete-char
bindkey '^[[3;2~' delete-word
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}
} }

View File

@ -2,14 +2,13 @@
#+AUTHOR: materus #+AUTHOR: materus
#+DESCRIPTION: materus emacs configuration #+DESCRIPTION: materus emacs configuration
#+STARTUP: overview #+STARTUP: overview
#+PROPERTY: EMACS-DIR: "./" #+PROPERTY: EMACS-DIR: ./
#+PROPERTY: header-args :tangle (concat (org-entry-get nil "EMACS-DIR" t) "etc/materus/emacs-config.el") :comments link #+PROPERTY: header-args :tangle (concat (org-entry-get nil "EMACS-DIR" t) "etc/materus/emacs-config.el") :comments link
#+OPTIONS: \n:t #+OPTIONS: \n:t
#+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:
- [[#init-files][Init Files]] - [[#init-files][Init Files]]
- [[#early-init][Early Init]] - [[#early-init][Early Init]]
@ -48,6 +47,7 @@ My emacs config, tangled file is [[file:etc/materus/emacs-config.el][there]]
- [[#perspective][Perspective]] - [[#perspective][Perspective]]
- [[#programming][Programming]] - [[#programming][Programming]]
- [[#lsp][LSP]] - [[#lsp][LSP]]
- [[#dap][DAP]]
- [[#nix][Nix]] - [[#nix][Nix]]
- [[#emacs-lisp][Emacs Lisp]] - [[#emacs-lisp][Emacs Lisp]]
- [[#cc][C/C++]] - [[#cc][C/C++]]
@ -55,6 +55,8 @@ My emacs config, tangled file is [[file:etc/materus/emacs-config.el][there]]
- [[#java][Java]] - [[#java][Java]]
- [[#other][Other]] - [[#other][Other]]
- [[#keybindings][Keybindings]] - [[#keybindings][Keybindings]]
- [[#keys][Keys]]
- [[#cua-overrides][CUA Overrides]]
- [[#snippets][Snippets]] - [[#snippets][Snippets]]
- [[#yasnippet-init][Yasnippet init]] - [[#yasnippet-init][Yasnippet init]]
- [[#other-1][Other]] - [[#other-1][Other]]
@ -171,6 +173,7 @@ Sets up package.el
#+begin_src emacs-lisp :comments no #+begin_src emacs-lisp :comments no
;;; -*- lexical-binding: t; -*- ;;; -*- lexical-binding: t; -*-
#+end_src #+end_src
#+begin_src emacs-lisp #+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))
(require 'cl-lib) (require 'cl-lib)
@ -211,9 +214,11 @@ Some defvar so native-compile wont complain
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 package manager config ** Init package manager config
#+begin_src emacs-lisp #+begin_src emacs-lisp
#+end_src #+end_src
** Packages list & function ** Packages list & function
Packages to install Packages to install
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -338,6 +343,7 @@ Packages to install
(unless materus/use-nix-packages (unless materus/use-nix-packages
(materus/install-packages)) (materus/install-packages))
#+end_src #+end_src
* Configuration * Configuration
General configurations of packages modes etc. General configurations of packages modes etc.
** No Littering ** No Littering
@ -370,7 +376,8 @@ Graphical related settings.
(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)
(set-frame-parameter frame 'fullscreen 'maximized))))) (set-frame-parameter frame 'fullscreen 'maximized))
(select-frame-set-input-focus frame) )))
(when (display-graphic-p) (when (display-graphic-p)
@ -388,7 +395,7 @@ Graphical related settings.
(setq window-divider-default-right-width 1) (setq window-divider-default-right-width 1)
(window-divider-mode 1) (window-divider-mode 1)
(setq-default cursor-type '(bar . 1)) (setq-default cursor-type '(bar . 2))
;; Rainbow mode ;; Rainbow mode
(use-package rainbow-mode (use-package rainbow-mode
:hook :hook
@ -476,7 +483,8 @@ Graphical related settings.
#+end_src #+end_src
** Org-mode ** Org-mode
Org mode settings Org mode settings
#+begin_src emacs-lisp
#+begin_SRC emacs-lisp
(use-package org (use-package org
:mode (("\\.org$" . org-mode)) :mode (("\\.org$" . org-mode))
:hook :hook
@ -494,22 +502,23 @@ Org mode settings
(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-modern
:after (org) :after (org)
:hook :hook
(org-mode . org-superstar-mode)) (org-indent-mode . org-modern-mode)
(org-agenda-finalize . org-modern-agenda)
:config :config
(setq org-superstar-leading-bullet " ") (setq org-modern-block-name '("▼ " . "▲ ")))
(use-package org-auto-tangle (use-package org-auto-tangle
:after (org) :after (org)
:hook (org-mode . org-auto-tangle-mode)) :hook (org-mode . org-auto-tangle-mode)
)
(use-package toc-org (use-package toc-org
:after (org) :after (org)
:hook :hook
((org-mode . toc-org-mode ) ((org-mode . toc-org-mode )
(markdown-mode . toc-org-mode))) (markdown-mode . toc-org-mode)))
#+end_src #+end_SRC
** Completions ** Completions
*** Style *** Style
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -593,11 +602,16 @@ Org mode settings
:config :config
(add-to-list 'corfu-margin-formatters #'kind-icon-margin-formatter)) (add-to-list 'corfu-margin-formatters #'kind-icon-margin-formatter))
(global-completion-preview-mode 1)
#+end_src #+end_src
** Terms ** Terms
*** Eat *** Eat
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package eat) (use-package eat)
(defvar cua--eat-semi-char-keymap (copy-keymap cua--cua-keys-keymap) "EAT semi-char mode CUA keymap")
(defvar cua--eat-char-keymap (copy-keymap cua--cua-keys-keymap) "EAT char mode CUA keymap")
#+end_src #+end_src
** Miscellaneous ** Miscellaneous
Other configs Other configs
@ -680,7 +694,8 @@ Other configs
(use-package lsp-mode (use-package lsp-mode
:custom :custom
(lsp-completion-provider :none) ;; we use Corfu! (lsp-completion-provider :none) ;; we use Corfu!
:config
(require 'lsp-ui)
:init :init
(defun materus/orderless-dispatch-flex-first (_pattern index _total) (defun materus/orderless-dispatch-flex-first (_pattern index _total)
(and (eq index 0) 'orderless-flex)) (and (eq index 0) 'orderless-flex))
@ -697,10 +712,6 @@ Other configs
(lsp-completion-mode . materus/lsp-mode-setup-completion)) (lsp-completion-mode . materus/lsp-mode-setup-completion))
(use-package lsp-ui)
(use-package dap-mode)
(use-package dap-lldb)
(use-package dap-gdb-lldb)
(setq read-process-output-max (* 1024 1024 3)) (setq read-process-output-max (* 1024 1024 3))
@ -736,7 +747,18 @@ Other configs
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)
#+end_src #+end_src
** DAP
#+begin_src emacs-lisp
(use-package dap-mode
:config
(require 'dap-lldb)
(require 'dap-gdb-lldb)
(require 'dap-cpptools)
(setq dap-gdb-lldb-extension-version "0.27.0")
(dap-auto-configure-mode 1)
)
#+end_src
** Nix ** Nix
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package nix-mode) (use-package nix-mode)
@ -828,39 +850,82 @@ Other configs
(add-hook 'prog-mode-hook 'electric-indent-local-mode) (add-hook 'prog-mode-hook 'electric-indent-local-mode)
#+end_src #+end_src
* Keybindings * Keybindings
** Keys
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package cua-base) (use-package cua-base)
;;; Keybinds ;;; Keybinds
;; Eat Term ;; Eat Term
(keymap-set eat-semi-char-mode-map "C-v" #'eat-yank) (define-key cua--eat-semi-char-keymap (kbd "C-v") #'eat-yank)
(keymap-set eat-char-mode-map "C-V" #'eat-yank) (define-key cua--eat-char-keymap (kbd "C-S-v") #'eat-yank)
(define-key eat-mode-map (kbd "C-<right>") #'eat-self-input)
(define-key eat-mode-map (kbd "C-<left>") #'eat-self-input)
;; perspective ;; perspective
(global-set-key (kbd "C-x C-b") 'persp-list-buffers) (define-key global-map (kbd "C-x C-b") 'persp-list-buffers)
(global-set-key (kbd "C-x C-B") 'list-buffers) (define-key global-map (kbd "C-x C-B") 'list-buffers)
(global-set-key (kbd "C-x b") 'persp-switch-to-buffer) (define-key global-map (kbd "C-x b") 'persp-switch-to-buffer)
(global-set-key (kbd "C-x B") 'consult-buffer) (define-key global-map (kbd "C-x B") 'consult-buffer)
;; CUA-like global
(define-key global-map (kbd "C-s") 'save-buffer)
(define-key global-map (kbd "C-r") 'query-replace)
(define-key global-map (kbd "C-S-r") 'replace-string)
(define-key global-map (kbd "M-r") 'query-replace-regexp)
(define-key global-map (kbd "M-S-r") 'replace-regexp)
(define-key global-map (kbd "C-a") 'mark-whole-buffer)
(define-key global-map (kbd "C-f") 'isearch-forward)
(define-key global-map (kbd "C-S-f") 'isearch-backward)
(define-key isearch-mode-map (kbd "C-f") 'isearch-repeat-forward)
(define-key isearch-mode-map (kbd "C-S-f") 'isearch-repeat-backward)
(define-key global-map (kbd "M-f") 'consult-ripgrep)
(define-key global-map (kbd "C-M-f") 'consult-find)
;; CUA ;; CUA
(keymap-set cua--cua-keys-keymap "C-z" 'undo-tree-undo) (define-key cua--cua-keys-keymap (kbd "C-z") 'undo-tree-undo)
(keymap-set cua--cua-keys-keymap "C-y" 'undo-tree-redo) (define-key cua--cua-keys-keymap (kbd "C-y") 'undo-tree-redo)
(define-key cua-global-keymap (kbd "C-SPC") 'completion-at-point)
(define-key cua-global-keymap (kbd "C-M-SPC") 'cua-set-mark)
(cua-mode 1) (cua-mode 1)
;; TAB ;; TAB
(keymap-set global-map "C-<iso-lefttab>" #'indent-rigidly-left-to-tab-stop) (define-key global-map (kbd "C-<iso-lefttab>") #'indent-rigidly-left)
(keymap-set global-map "C-<tab>" #'indent-rigidly-right-to-tab-stop) (define-key global-map (kbd "C-<tab>") #'indent-rigidly-right)
;; Dashboard
(define-key dashboard-mode-map (kbd "C-r") #'dashboard-refresh-buffer)
;; Hyper ;; 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 )
;; Treemacs
(define-key global-map (kbd "C-H-t") 'treemacs)
(global-set-key (kbd "C-H-t") 'treemacs) ;; Unbind
(define-key isearch-mode-map (kbd "C-s") nil)
(define-key isearch-mode-map (kbd "C-r") nil)
#+end_src #+end_src
** CUA Overrides
#+begin_src emacs-lisp
(defun cua--eat-semi-char-override-keymap ()
(setq-local cua--keymap-alist (copy-tree cua--keymap-alist))
(setf (alist-get 'cua--ena-cua-keys-keymap cua--keymap-alist) cua--eat-semi-char-keymap))
(defun cua--eat-char-override-keymap ()
(setq-local cua--keymap-alist (copy-tree cua--keymap-alist))
(setf (alist-get 'cua--ena-cua-keys-keymap cua--keymap-alist) cua--eat-char-keymap))
(advice-add 'eat-semi-char-mode :after #'cua--eat-semi-char-override-keymap)
(advice-add 'eat-char-mode :after #'cua--eat-char-override-keymap)
;(add-hook 'eat-char-mode-hook #'cua--eat-char-override-keymap)
#+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
#+begin_src emacs-lisp #+begin_src emacs-lisp

View File

@ -165,7 +165,8 @@
(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)
(set-frame-parameter frame 'fullscreen 'maximized))))) (set-frame-parameter frame 'fullscreen 'maximized))
(select-frame-set-input-focus frame) )))
(when (display-graphic-p) (when (display-graphic-p)
@ -183,7 +184,7 @@
(setq window-divider-default-right-width 1) (setq window-divider-default-right-width 1)
(window-divider-mode 1) (window-divider-mode 1)
(setq-default cursor-type '(bar . 1)) (setq-default cursor-type '(bar . 2))
;; Rainbow mode ;; Rainbow mode
(use-package rainbow-mode (use-package rainbow-mode
:hook :hook
@ -287,15 +288,17 @@
(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-modern
:after (org) :after (org)
:hook :hook
(org-mode . org-superstar-mode)) (org-indent-mode . org-modern-mode)
:config (org-agenda-finalize . org-modern-agenda)
(setq org-superstar-leading-bullet " ") :config
(setq org-modern-block-name '("" . "")))
(use-package org-auto-tangle (use-package org-auto-tangle
:after (org) :after (org)
:hook (org-mode . org-auto-tangle-mode)) :hook (org-mode . org-auto-tangle-mode)
)
(use-package toc-org (use-package toc-org
:after (org) :after (org)
:hook :hook
@ -382,10 +385,14 @@
(use-package kind-icon (use-package kind-icon
:config :config
(add-to-list 'corfu-margin-formatters #'kind-icon-margin-formatter)) (add-to-list 'corfu-margin-formatters #'kind-icon-margin-formatter))
(global-completion-preview-mode 1)
;; Code completion:1 ends here ;; Code completion:1 ends here
;; [[file:../../emacs-materus-config.org::*Eat][Eat:1]] ;; [[file:../../emacs-materus-config.org::*Eat][Eat:1]]
(use-package eat) (use-package eat)
(defvar cua--eat-semi-char-keymap (copy-keymap cua--cua-keys-keymap) "EAT semi-char mode CUA keymap")
(defvar cua--eat-char-keymap (copy-keymap cua--cua-keys-keymap) "EAT char mode CUA keymap")
;; Eat:1 ends here ;; Eat:1 ends here
;; [[file:../../emacs-materus-config.org::*Defaults][Defaults:1]] ;; [[file:../../emacs-materus-config.org::*Defaults][Defaults:1]]
@ -464,7 +471,8 @@
(use-package lsp-mode (use-package lsp-mode
:custom :custom
(lsp-completion-provider :none) ;; we use Corfu! (lsp-completion-provider :none) ;; we use Corfu!
:config
(require 'lsp-ui)
:init :init
(defun materus/orderless-dispatch-flex-first (_pattern index _total) (defun materus/orderless-dispatch-flex-first (_pattern index _total)
(and (eq index 0) 'orderless-flex)) (and (eq index 0) 'orderless-flex))
@ -481,10 +489,6 @@
(lsp-completion-mode . materus/lsp-mode-setup-completion)) (lsp-completion-mode . materus/lsp-mode-setup-completion))
(use-package lsp-ui)
(use-package dap-mode)
(use-package dap-lldb)
(use-package dap-gdb-lldb)
(setq read-process-output-max (* 1024 1024 3)) (setq read-process-output-max (* 1024 1024 3))
@ -521,6 +525,17 @@
(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 ;; LSP:1 ends here
;; [[file:../../emacs-materus-config.org::*DAP][DAP:1]]
(use-package dap-mode
:config
(require 'dap-lldb)
(require 'dap-gdb-lldb)
(require 'dap-cpptools)
(setq dap-gdb-lldb-extension-version "0.27.0")
(dap-auto-configure-mode 1)
)
;; DAP:1 ends here
;; [[file:../../emacs-materus-config.org::*Nix][Nix:1]] ;; [[file:../../emacs-materus-config.org::*Nix][Nix:1]]
(use-package nix-mode) (use-package nix-mode)
(use-package nix-ts-mode) (use-package nix-ts-mode)
@ -610,33 +625,69 @@
(add-hook 'prog-mode-hook 'electric-indent-local-mode) (add-hook 'prog-mode-hook 'electric-indent-local-mode)
;; Other:1 ends here ;; Other:1 ends here
;; [[file:../../emacs-materus-config.org::*Keybindings][Keybindings:1]] ;; [[file:../../emacs-materus-config.org::*Keys][Keys:1]]
(use-package cua-base) (use-package cua-base)
;;; Keybinds ;;; Keybinds
;; Eat Term ;; Eat Term
(keymap-set eat-semi-char-mode-map "C-v" #'eat-yank) (define-key cua--eat-semi-char-keymap (kbd "C-v") #'eat-yank)
(keymap-set eat-char-mode-map "C-V" #'eat-yank) (define-key cua--eat-char-keymap (kbd "C-S-v") #'eat-yank)
(define-key eat-mode-map (kbd "C-<right>") #'eat-self-input)
(define-key eat-mode-map (kbd "C-<left>") #'eat-self-input)
;; perspective ;; perspective
(global-set-key (kbd "C-x C-b") 'persp-list-buffers) (define-key global-map (kbd "C-x C-b") 'persp-list-buffers)
(global-set-key (kbd "C-x C-B") 'list-buffers) (define-key global-map (kbd "C-x C-B") 'list-buffers)
(global-set-key (kbd "C-x b") 'persp-switch-to-buffer) (define-key global-map (kbd "C-x b") 'persp-switch-to-buffer)
(global-set-key (kbd "C-x B") 'consult-buffer) (define-key global-map (kbd "C-x B") 'consult-buffer)
;; CUA-like global
(define-key global-map (kbd "C-s") 'save-buffer)
(define-key global-map (kbd "C-r") 'query-replace)
(define-key global-map (kbd "C-S-r") 'replace-string)
(define-key global-map (kbd "M-r") 'query-replace-regexp)
(define-key global-map (kbd "M-S-r") 'replace-regexp)
(define-key global-map (kbd "C-a") 'mark-whole-buffer)
(define-key global-map (kbd "C-f") 'isearch-forward)
(define-key global-map (kbd "C-S-f") 'isearch-backward)
(define-key isearch-mode-map (kbd "C-f") 'isearch-repeat-forward)
(define-key isearch-mode-map (kbd "C-S-f") 'isearch-repeat-backward)
(define-key global-map (kbd "M-f") 'consult-ripgrep)
(define-key global-map (kbd "C-M-f") 'consult-find)
;; CUA ;; CUA
(keymap-set cua--cua-keys-keymap "C-z" 'undo-tree-undo) (define-key cua--cua-keys-keymap (kbd "C-z") 'undo-tree-undo)
(keymap-set cua--cua-keys-keymap "C-y" 'undo-tree-redo) (define-key cua--cua-keys-keymap (kbd "C-y") 'undo-tree-redo)
(define-key cua-global-keymap (kbd "C-SPC") 'completion-at-point)
(define-key cua-global-keymap (kbd "C-M-SPC") 'cua-set-mark)
(cua-mode 1) (cua-mode 1)
;; TAB ;; TAB
(keymap-set global-map "C-<iso-lefttab>" #'indent-rigidly-left-to-tab-stop) (define-key global-map (kbd "C-<iso-lefttab>") #'indent-rigidly-left)
(keymap-set global-map "C-<tab>" #'indent-rigidly-right-to-tab-stop) (define-key global-map (kbd "C-<tab>") #'indent-rigidly-right)
;; Dashboard
(define-key dashboard-mode-map (kbd "C-r") #'dashboard-refresh-buffer)
;; Hyper ;; 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 )
;; Treemacs
(define-key global-map (kbd "C-H-t") 'treemacs)
(global-set-key (kbd "C-H-t") 'treemacs) ;; Unbind
;; Keybindings:1 ends here (define-key isearch-mode-map (kbd "C-s") nil)
(define-key isearch-mode-map (kbd "C-r") nil)
;; Keys:1 ends here
;; [[file:../../emacs-materus-config.org::*CUA Overrides][CUA Overrides:1]]
(defun cua--eat-semi-char-override-keymap ()
(setq-local cua--keymap-alist (copy-tree cua--keymap-alist))
(setf (alist-get 'cua--ena-cua-keys-keymap cua--keymap-alist) cua--eat-semi-char-keymap))
(defun cua--eat-char-override-keymap ()
(setq-local cua--keymap-alist (copy-tree cua--keymap-alist))
(setf (alist-get 'cua--ena-cua-keys-keymap cua--keymap-alist) cua--eat-char-keymap))
(advice-add 'eat-semi-char-mode :after #'cua--eat-semi-char-override-keymap)
(advice-add 'eat-char-mode :after #'cua--eat-char-override-keymap)
;(add-hook 'eat-char-mode-hook #'cua--eat-char-override-keymap)
;; CUA Overrides:1 ends here
;; [[file:../../emacs-materus-config.org::*Yasnippet init][Yasnippet init:1]] ;; [[file:../../emacs-materus-config.org::*Yasnippet init][Yasnippet init:1]]
(use-package yasnippet (use-package yasnippet