mirror of
https://github.com/Swarsel/.dotfiles.git
synced 2025-12-06 17:17:22 +01:00
Convenience-features for Emacs and shell scripts
NixOS: feat: add cdw, cdr, cdb, bak scripts/aliases feat: spawn firefox on workspace 1 again fix: adjust systemd stop timeout to avoid 1m30s wait on shutdown feat: add fzf-tab Emacs: fix: file-switcher directory up was not working consistently feat: more intuitive minibuffer-local-map (DEL is now 1 char again) chore: C-z now a prefix key, several new keybinds fix: make project switching in dashboard work again fix: add proper projectile backend (was still set to ivy) fix: allow yubikey unlocking from within emacs feat: add dotfile directory to magit repository list
This commit is contained in:
parent
1ddc3eb81d
commit
5e9c3c398f
6 changed files with 435 additions and 269 deletions
118
Emacs.org
118
Emacs.org
|
|
@ -250,6 +250,13 @@ This function will check if a directory for which a file we want to open exists;
|
||||||
(evil-mode 1)
|
(evil-mode 1)
|
||||||
(define-key evil-insert-state-map (kbd "C-g") 'evil-normal-state) ; alternative for exiting insert mode
|
(define-key evil-insert-state-map (kbd "C-g") 'evil-normal-state) ; alternative for exiting insert mode
|
||||||
(define-key evil-insert-state-map (kbd "C-h") 'evil-delete-backward-char-and-join) ; dont show help but instead do normal vim delete backwards
|
(define-key evil-insert-state-map (kbd "C-h") 'evil-delete-backward-char-and-join) ; dont show help but instead do normal vim delete backwards
|
||||||
|
(define-key evil-normal-state-map (kbd "C-z") nil)
|
||||||
|
(define-key evil-insert-state-map (kbd "C-z") nil)
|
||||||
|
(define-key evil-visual-state-map (kbd "C-z") nil)
|
||||||
|
(define-key evil-motion-state-map (kbd "C-z") nil)
|
||||||
|
(define-key evil-operator-state-map (kbd "C-z") nil)
|
||||||
|
(define-key evil-replace-state-map (kbd "C-z") nil)
|
||||||
|
(define-key global-map (kbd "C-z") nil)
|
||||||
|
|
||||||
;; evil undo system
|
;; evil undo system
|
||||||
(evil-set-undo-system 'undo-tree)
|
(evil-set-undo-system 'undo-tree)
|
||||||
|
|
@ -388,6 +395,26 @@ Base emacs undo logic is very useful, but not easy to understand. I prefer undo-
|
||||||
|
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
** Move up one directory for find-file
|
||||||
|
|
||||||
|
I find it very annoying that the standard behavior for M-DEL only deletes one word when using find-file. This function makes it so that we always go up by one directory level instead.
|
||||||
|
|
||||||
|
#+begin_src emacs-lisp
|
||||||
|
|
||||||
|
(defun up-directory (path)
|
||||||
|
"Move up a directory in PATH without affecting the kill buffer."
|
||||||
|
(interactive "p")
|
||||||
|
(if (string-match-p "/." (minibuffer-contents))
|
||||||
|
(let ((end (point)))
|
||||||
|
(re-search-backward "/.")
|
||||||
|
(forward-char)
|
||||||
|
(delete-region (point) end))))
|
||||||
|
|
||||||
|
(define-key minibuffer-local-filename-completion-map
|
||||||
|
[C-backspace] #'up-directory)
|
||||||
|
|
||||||
|
#+end_src
|
||||||
|
|
||||||
* Custom Keybindings
|
* Custom Keybindings
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
|
|
||||||
|
|
@ -405,6 +432,7 @@ Base emacs undo logic is very useful, but not easy to understand. I prefer undo-
|
||||||
(swarsel/leader-keys
|
(swarsel/leader-keys
|
||||||
"t" '(:ignore t :which-key "toggles")
|
"t" '(:ignore t :which-key "toggles")
|
||||||
"ts" '(hydra-text-scale/body :which-key "scale text")
|
"ts" '(hydra-text-scale/body :which-key "scale text")
|
||||||
|
"te" '(swarsel/toggle-evil-state :which-key "emacs/evil")
|
||||||
"tl" '(display-line-numbers-mode :which-key "line numbers")
|
"tl" '(display-line-numbers-mode :which-key "line numbers")
|
||||||
"tp" '(evil-cleverparens-mode :wk "cleverparens")
|
"tp" '(evil-cleverparens-mode :wk "cleverparens")
|
||||||
"to" '(olivetti-mode :wk "olivetti")
|
"to" '(olivetti-mode :wk "olivetti")
|
||||||
|
|
@ -478,6 +506,12 @@ Base emacs undo logic is very useful, but not easy to understand. I prefer undo-
|
||||||
"C-<f9>" 'my-python-shell-run
|
"C-<f9>" 'my-python-shell-run
|
||||||
)
|
)
|
||||||
|
|
||||||
|
(defun swarsel/toggle-evil-state ()
|
||||||
|
(interactive)
|
||||||
|
(if (or (evil-emacs-state-p) (evil-insert-state-p))
|
||||||
|
(evil-normal-state)
|
||||||
|
(evil-emacs-state)))
|
||||||
|
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
* UI
|
* UI
|
||||||
|
|
@ -643,8 +677,8 @@ Soon I want to try out this new hot stuff - just at the moment there is too much
|
||||||
:after vertico
|
:after vertico
|
||||||
:bind (:map vertico-map
|
:bind (:map vertico-map
|
||||||
("RET" . vertico-directory-enter)
|
("RET" . vertico-directory-enter)
|
||||||
("DEL" . vertico-directory-delete-word)
|
("C-DEL" . vertico-directory-delete-word)
|
||||||
("M-DEL" . vertico-directory-delete-char))
|
("DEL" . vertico-directory-delete-char))
|
||||||
;; Tidy shadowed file names
|
;; Tidy shadowed file names
|
||||||
:hook (rfn-eshadow-update-overlay . vertico-directory-tidy))
|
:hook (rfn-eshadow-update-overlay . vertico-directory-tidy))
|
||||||
|
|
||||||
|
|
@ -658,14 +692,17 @@ Soon I want to try out this new hot stuff - just at the moment there is too much
|
||||||
:config
|
:config
|
||||||
(setq consult-fontify-max-size 1024)
|
(setq consult-fontify-max-size 1024)
|
||||||
:bind
|
:bind
|
||||||
("C-x b" . consult-buffer)
|
(("C-x b" . consult-buffer)
|
||||||
("C-c <C-m>" . consult-global-mark)
|
("C-c <C-m>" . consult-global-mark)
|
||||||
("C-c C-a" . consult-org-agenda)
|
("C-c C-a" . consult-org-agenda)
|
||||||
("C-x O" . consult-outline)
|
("C-x O" . consult-org-heading)
|
||||||
("M-g M-g" . consult-goto-line)
|
("M-g M-g" . consult-goto-line)
|
||||||
("M-g i" . consult-imenu)
|
("M-g i" . consult-imenu)
|
||||||
("M-s s" . consult-line)
|
("M-s s" . consult-line)
|
||||||
("M-s M-s" . consult-line-multi))
|
("M-s M-s" . consult-line-multi)
|
||||||
|
:map minibuffer-local-map
|
||||||
|
("C-j" . next-line)
|
||||||
|
("C-k" . previous-line)))
|
||||||
|
|
||||||
(use-package embark
|
(use-package embark
|
||||||
:bind
|
:bind
|
||||||
|
|
@ -776,14 +813,13 @@ Soon I want to try out this new hot stuff - just at the moment there is too much
|
||||||
;; ([remap describe-key] . helpful-key))
|
;; ([remap describe-key] . helpful-key))
|
||||||
|
|
||||||
(use-package helpful
|
(use-package helpful
|
||||||
:custom
|
|
||||||
(help-select-window t)
|
|
||||||
:bind
|
:bind
|
||||||
(("C-h f" . helpful-callable)
|
(("C-h f" . helpful-callable)
|
||||||
("C-h v" . helpful-variable)
|
("C-h v" . helpful-variable)
|
||||||
("C-h k" . helpful-key)
|
("C-h k" . helpful-key)
|
||||||
("C-h C-." . helpful-at-point)))
|
("C-h C-." . helpful-at-point))
|
||||||
|
:config
|
||||||
|
(setq help-window-select nil))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
** Text Scaling
|
** Text Scaling
|
||||||
|
|
@ -1624,7 +1660,7 @@ In order to update the language grammars, run the next command below.
|
||||||
(use-package projectile
|
(use-package projectile
|
||||||
:diminish projectile-mode
|
:diminish projectile-mode
|
||||||
:config (projectile-mode)
|
:config (projectile-mode)
|
||||||
:custom ((projectile-completion-system 'ivy)) ;; integrate ivy into completion system
|
:custom ((projectile-completion-system 'auto)) ;; integrate ivy into completion system
|
||||||
:bind-keymap
|
:bind-keymap
|
||||||
("C-c p" . projectile-command-map) ; all projectile commands under this
|
("C-c p" . projectile-command-map) ; all projectile commands under this
|
||||||
:init
|
:init
|
||||||
|
|
@ -1664,12 +1700,14 @@ In order to update the language grammars, run the next command below.
|
||||||
:config
|
:config
|
||||||
(setq magit-repository-directories `((,swarsel-projects-directory . 1)
|
(setq magit-repository-directories `((,swarsel-projects-directory . 1)
|
||||||
(,swarsel-emacs-directory . 0)
|
(,swarsel-emacs-directory . 0)
|
||||||
(,swarsel-obsidian-directory . 0)))
|
(,swarsel-obsidian-directory . 0)
|
||||||
|
("~/.dotfiles/" . 0)))
|
||||||
:custom
|
:custom
|
||||||
(magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1)) ; stay in the same window
|
(magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1)) ; stay in the same window
|
||||||
|
|
||||||
;; yubikey support for pushing commits
|
;; yubikey support for pushing commits
|
||||||
;; commiting is enabled through nixos gpg-agent config
|
;; commiting is enabled through nixos gpg-agent config
|
||||||
|
(setq epg-pinentry-mode 'loopback)
|
||||||
(setenv "SSH_AUTH_SOCK" (string-chop-newline (shell-command-to-string "gpgconf --list-dirs agent-ssh-socket")))
|
(setenv "SSH_AUTH_SOCK" (string-chop-newline (shell-command-to-string "gpgconf --list-dirs agent-ssh-socket")))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
|
@ -1852,23 +1890,23 @@ Currently unused
|
||||||
;; Bind dedicated completion commands
|
;; Bind dedicated completion commands
|
||||||
;; Alternative prefix keys: C-c p, M-p, M-+, ...
|
;; Alternative prefix keys: C-c p, M-p, M-+, ...
|
||||||
:bind
|
:bind
|
||||||
("C-c p p" . completion-at-point) ;; capf
|
("C-z p" . completion-at-point) ;; capf
|
||||||
("C-c p t" . complete-tag) ;; etags
|
("C-z t" . complete-tag) ;; etags
|
||||||
("C-c p d" . cape-dabbrev) ;; or dabbrev-completion
|
("C-z d" . cape-dabbrev) ;; or dabbrev-completion
|
||||||
("C-c p h" . cape-history)
|
("C-z h" . cape-history)
|
||||||
("C-c p f" . cape-file)
|
("C-z f" . cape-file)
|
||||||
("C-c p k" . cape-keyword)
|
("C-z k" . cape-keyword)
|
||||||
("C-c p s" . cape-elisp-symbol)
|
("C-z s" . cape-elisp-symbol)
|
||||||
("C-c p e" . cape-elisp-block)
|
("C-z e" . cape-elisp-block)
|
||||||
("C-c p a" . cape-abbrev)
|
("C-z a" . cape-abbrev)
|
||||||
("C-c p l" . cape-line)
|
("C-z l" . cape-line)
|
||||||
("C-c p w" . cape-dict)
|
("C-z w" . cape-dict)
|
||||||
("C-c p :" . cape-emoji)
|
("C-z :" . cape-emoji)
|
||||||
("C-c p \\" . cape-tex)
|
("C-z \\" . cape-tex)
|
||||||
("C-c p _" . cape-tex)
|
("C-z _" . cape-tex)
|
||||||
("C-c p ^" . cape-tex)
|
("C-z ^" . cape-tex)
|
||||||
("C-c p &" . cape-sgml)
|
("C-z &" . cape-sgml)
|
||||||
("C-c p r" . cape-rfc1345)
|
("C-z r" . cape-rfc1345)
|
||||||
;; Add to the global default value of `completion-at-point-functions' which is
|
;; Add to the global default value of `completion-at-point-functions' which is
|
||||||
;; used by `completion-at-point'. The order of the functions matters, the
|
;; used by `completion-at-point'. The order of the functions matters, the
|
||||||
;; first function returning a result wins. Note that the list of buffer-local
|
;; first function returning a result wins. Note that the list of buffer-local
|
||||||
|
|
@ -1887,6 +1925,8 @@ Currently unused
|
||||||
;; (add-to-list 'completion-at-point-functions #'cape-line)
|
;; (add-to-list 'completion-at-point-functions #'cape-line)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
*** rust
|
*** rust
|
||||||
|
|
@ -2025,7 +2065,7 @@ Currently unused
|
||||||
((prog-mode
|
((prog-mode
|
||||||
org-mode) . diff-hl-mode)
|
org-mode) . diff-hl-mode)
|
||||||
:init
|
:init
|
||||||
(diff-fl-flydiff-mode)
|
(diff-hl-flydiff-mode)
|
||||||
(diff-hl-margin-mode)
|
(diff-hl-margin-mode)
|
||||||
(diff-hl-show-hunk-mouse-mode))
|
(diff-hl-show-hunk-mouse-mode))
|
||||||
|
|
||||||
|
|
@ -2152,19 +2192,17 @@ The following block is 100% stolen from Dominik :P
|
||||||
("u" . "\\cup")
|
("u" . "\\cup")
|
||||||
("0" . "\\emptyset")))
|
("0" . "\\emptyset")))
|
||||||
|
|
||||||
|
;; (yas-define-snippets
|
||||||
(yas-define-snippets
|
;; 'latex-mode
|
||||||
'latex-mode
|
;; (mapcar
|
||||||
(mapcar
|
;; (lambda (elem)
|
||||||
(lambda (elem)
|
;; (let ((key (car elem))
|
||||||
(let ((key (car elem))
|
;; (value (cdr elem)))
|
||||||
(value (cdr elem)))
|
;; (list (concat wtf/latex-math-prefix key) value (concat "Math symbol " value))))
|
||||||
(list (concat wtf/latex-math-prefix key) value (concat "Math symbol " value))))
|
;; swtf/latex-math-symbols))
|
||||||
swtf/latex-math-symbols))
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -2754,6 +2792,7 @@ Yep, none currently.
|
||||||
dashboard-image-banner-max-height 300
|
dashboard-image-banner-max-height 300
|
||||||
dashboard-startup-banner "~/.dotfiles/wallpaper/swarsel.png"
|
dashboard-startup-banner "~/.dotfiles/wallpaper/swarsel.png"
|
||||||
dashboard-projects-backend 'projectile
|
dashboard-projects-backend 'projectile
|
||||||
|
dashboard-projects-switch-function 'magit-status
|
||||||
dashboard-set-navigator t
|
dashboard-set-navigator t
|
||||||
dashboard-startupify-list '(dashboard-insert-banner
|
dashboard-startupify-list '(dashboard-insert-banner
|
||||||
dashboard-insert-newline
|
dashboard-insert-newline
|
||||||
|
|
@ -2795,7 +2834,6 @@ Yep, none currently.
|
||||||
(lambda (&rest _) (browse-url "swarsel.win")))
|
(lambda (&rest _) (browse-url "swarsel.win")))
|
||||||
)
|
)
|
||||||
)))
|
)))
|
||||||
(setq dashboard-projects-switch-function 'project-switch-project)
|
|
||||||
|
|
||||||
|
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
|
||||||
53
Nix.org
53
Nix.org
|
|
@ -4490,6 +4490,12 @@ Section for all settings that are not really deserving of their own section.
|
||||||
driSupport32Bit = true;
|
driSupport32Bit = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# systemd
|
||||||
|
systemd.extraConfig = ''
|
||||||
|
DefaultTimeoutStartSec=60s
|
||||||
|
DefaultTimeoutStopSec=15s
|
||||||
|
'';
|
||||||
|
|
||||||
# audio
|
# audio
|
||||||
sound.enable = true;
|
sound.enable = true;
|
||||||
# nixpkgs.config.pulseaudio = true;
|
# nixpkgs.config.pulseaudio = true;
|
||||||
|
|
@ -4769,6 +4775,7 @@ Also, I define some useful shell scripts here.
|
||||||
# utilities
|
# utilities
|
||||||
util-linux
|
util-linux
|
||||||
nmap
|
nmap
|
||||||
|
lsof
|
||||||
|
|
||||||
# local file sharing
|
# local file sharing
|
||||||
wormhole-rs
|
wormhole-rs
|
||||||
|
|
@ -5020,6 +5027,40 @@ Also, I define some useful shell scripts here.
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
|
|
||||||
|
(pkgs.writeShellApplication {
|
||||||
|
name = "cdw";
|
||||||
|
runtimeInputs = [ pkgs.fzf ];
|
||||||
|
text = ''
|
||||||
|
cd "$(git worktree list | fzf | awk '{print $1}')"
|
||||||
|
'';
|
||||||
|
})
|
||||||
|
|
||||||
|
(pkgs.writeShellApplication {
|
||||||
|
name = "cdb";
|
||||||
|
runtimeInputs = [ pkgs.fzf ];
|
||||||
|
text = ''
|
||||||
|
git checkout "$(git branch --list | grep -v "^\*" | fzf | awk '{print $1}')"
|
||||||
|
'';
|
||||||
|
})
|
||||||
|
|
||||||
|
# (pkgs.writeShellApplication {
|
||||||
|
# name = "cdr";
|
||||||
|
# runtimeInputs = [ pkgs.fzf ];
|
||||||
|
# text = ''
|
||||||
|
# cdr () {
|
||||||
|
# cd "$( (find /home/swarsel/Documents/GitHub -maxdepth 1 && echo /home/swarsel/.dotfiles) | fzf )"
|
||||||
|
# }
|
||||||
|
# cdr
|
||||||
|
# '';
|
||||||
|
# })
|
||||||
|
|
||||||
|
(pkgs.writeShellApplication {
|
||||||
|
name = "bak";
|
||||||
|
text = ''
|
||||||
|
cp "$1"{,.bak}
|
||||||
|
'';
|
||||||
|
})
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -5557,6 +5598,8 @@ zsh is clearly the most convenient shell for me and it happens to be super neat
|
||||||
passpush = "cd ~/.local/share/password-store; git add .; git commit -m 'pass file changes'; git push; cd -;";
|
passpush = "cd ~/.local/share/password-store; git add .; git commit -m 'pass file changes'; git push; cd -;";
|
||||||
passpull = "cd ~/.local/share/password-store; git pull; cd -;";
|
passpull = "cd ~/.local/share/password-store; git pull; cd -;";
|
||||||
hotspot = "nmcli connection up local; nmcli device wifi hotspot password 12345678;";
|
hotspot = "nmcli connection up local; nmcli device wifi hotspot password 12345678;";
|
||||||
|
cd="z";
|
||||||
|
cdr = "cd \"$( (find /home/swarsel/Documents/GitHub -maxdepth 1 && echo /home/swarsel/.dotfiles) | fzf )\"";
|
||||||
};
|
};
|
||||||
autosuggestion.enable = true;
|
autosuggestion.enable = true;
|
||||||
enableCompletion = true;
|
enableCompletion = true;
|
||||||
|
|
@ -5569,6 +5612,7 @@ zsh is clearly the most convenient shell for me and it happens to be super neat
|
||||||
defaultKeymap = "emacs";
|
defaultKeymap = "emacs";
|
||||||
dirHashes = {
|
dirHashes = {
|
||||||
dl = "$HOME/Downloads";
|
dl = "$HOME/Downloads";
|
||||||
|
gh = "$HOME/Documents/GitHub";
|
||||||
};
|
};
|
||||||
history = {
|
history = {
|
||||||
expireDuplicatesFirst = true;
|
expireDuplicatesFirst = true;
|
||||||
|
|
@ -5577,6 +5621,12 @@ zsh is clearly the most convenient shell for me and it happens to be super neat
|
||||||
size = 10000;
|
size = 10000;
|
||||||
};
|
};
|
||||||
historySubstringSearch.enable = true;
|
historySubstringSearch.enable = true;
|
||||||
|
plugins = [
|
||||||
|
{
|
||||||
|
name = "fzf-tab";
|
||||||
|
src = pkgs.zsh-fzf-tab;
|
||||||
|
}
|
||||||
|
];
|
||||||
initExtra = ''
|
initExtra = ''
|
||||||
bindkey "^[[1;5D" backward-word
|
bindkey "^[[1;5D" backward-word
|
||||||
bindkey "^[[1;5C" forward-word
|
bindkey "^[[1;5C" forward-word
|
||||||
|
|
@ -6537,8 +6587,7 @@ I am currently using SwayFX, which adds some nice effects to sway, like rounded
|
||||||
titlebar = false;
|
titlebar = false;
|
||||||
};
|
};
|
||||||
assigns = {
|
assigns = {
|
||||||
# disabled, this is too annoying to be of use
|
"1:一" = [{ app_id = "firefox"; }];
|
||||||
# "1:一" = [{ app_id = "^firefox$"; }];
|
|
||||||
};
|
};
|
||||||
colors = {
|
colors = {
|
||||||
focused = {
|
focused = {
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@
|
||||||
# utilities
|
# utilities
|
||||||
util-linux
|
util-linux
|
||||||
nmap
|
nmap
|
||||||
|
lsof
|
||||||
|
|
||||||
# local file sharing
|
# local file sharing
|
||||||
wormhole-rs
|
wormhole-rs
|
||||||
|
|
@ -274,7 +275,41 @@
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
|
|
||||||
];
|
(pkgs.writeShellApplication {
|
||||||
|
name = "cdw";
|
||||||
|
runtimeInputs = [ pkgs.fzf ];
|
||||||
|
text = ''
|
||||||
|
cd "$(git worktree list | fzf | awk '{print $1}')"
|
||||||
|
'';
|
||||||
|
})
|
||||||
|
|
||||||
|
(pkgs.writeShellApplication {
|
||||||
|
name = "cdb";
|
||||||
|
runtimeInputs = [ pkgs.fzf ];
|
||||||
|
text = ''
|
||||||
|
git checkout "$(git branch --list | grep -v "^\*" | fzf | awk '{print $1}')"
|
||||||
|
'';
|
||||||
|
})
|
||||||
|
|
||||||
|
# (pkgs.writeShellApplication {
|
||||||
|
# name = "cdr";
|
||||||
|
# runtimeInputs = [ pkgs.fzf ];
|
||||||
|
# text = ''
|
||||||
|
# cdr () {
|
||||||
|
# cd "$( (find /home/swarsel/Documents/GitHub -maxdepth 1 && echo /home/swarsel/.dotfiles) | fzf )"
|
||||||
|
# }
|
||||||
|
# cdr
|
||||||
|
# '';
|
||||||
|
# })
|
||||||
|
|
||||||
|
(pkgs.writeShellApplication {
|
||||||
|
name = "bak";
|
||||||
|
text = ''
|
||||||
|
cp "$1"{,.bak}
|
||||||
|
'';
|
||||||
|
})
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
# MIGHT NEED TO ENABLE THIS ON SURFACE!!
|
# MIGHT NEED TO ENABLE THIS ON SURFACE!!
|
||||||
|
|
@ -724,6 +759,8 @@ programs.zsh = {
|
||||||
passpush = "cd ~/.local/share/password-store; git add .; git commit -m 'pass file changes'; git push; cd -;";
|
passpush = "cd ~/.local/share/password-store; git add .; git commit -m 'pass file changes'; git push; cd -;";
|
||||||
passpull = "cd ~/.local/share/password-store; git pull; cd -;";
|
passpull = "cd ~/.local/share/password-store; git pull; cd -;";
|
||||||
hotspot = "nmcli connection up local; nmcli device wifi hotspot password 12345678;";
|
hotspot = "nmcli connection up local; nmcli device wifi hotspot password 12345678;";
|
||||||
|
cd="z";
|
||||||
|
cdr = "cd \"$( (find /home/swarsel/Documents/GitHub -maxdepth 1 && echo /home/swarsel/.dotfiles) | fzf )\"";
|
||||||
};
|
};
|
||||||
autosuggestion.enable = true;
|
autosuggestion.enable = true;
|
||||||
enableCompletion = true;
|
enableCompletion = true;
|
||||||
|
|
@ -736,6 +773,7 @@ programs.zsh = {
|
||||||
defaultKeymap = "emacs";
|
defaultKeymap = "emacs";
|
||||||
dirHashes = {
|
dirHashes = {
|
||||||
dl = "$HOME/Downloads";
|
dl = "$HOME/Downloads";
|
||||||
|
gh = "$HOME/Documents/GitHub";
|
||||||
};
|
};
|
||||||
history = {
|
history = {
|
||||||
expireDuplicatesFirst = true;
|
expireDuplicatesFirst = true;
|
||||||
|
|
@ -744,6 +782,12 @@ programs.zsh = {
|
||||||
size = 10000;
|
size = 10000;
|
||||||
};
|
};
|
||||||
historySubstringSearch.enable = true;
|
historySubstringSearch.enable = true;
|
||||||
|
plugins = [
|
||||||
|
{
|
||||||
|
name = "fzf-tab";
|
||||||
|
src = pkgs.zsh-fzf-tab;
|
||||||
|
}
|
||||||
|
];
|
||||||
initExtra = ''
|
initExtra = ''
|
||||||
bindkey "^[[1;5D" backward-word
|
bindkey "^[[1;5D" backward-word
|
||||||
bindkey "^[[1;5C" forward-word
|
bindkey "^[[1;5C" forward-word
|
||||||
|
|
@ -1647,8 +1691,7 @@ wayland.windowManager.sway = {
|
||||||
titlebar = false;
|
titlebar = false;
|
||||||
};
|
};
|
||||||
assigns = {
|
assigns = {
|
||||||
# disabled, this is too annoying to be of use
|
"1:一" = [{ app_id = "firefox"; }];
|
||||||
# "1:一" = [{ app_id = "^firefox$"; }];
|
|
||||||
};
|
};
|
||||||
colors = {
|
colors = {
|
||||||
focused = {
|
focused = {
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,12 @@
|
||||||
driSupport32Bit = true;
|
driSupport32Bit = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# systemd
|
||||||
|
systemd.extraConfig = ''
|
||||||
|
DefaultTimeoutStartSec=60s
|
||||||
|
DefaultTimeoutStopSec=15s
|
||||||
|
'';
|
||||||
|
|
||||||
# audio
|
# audio
|
||||||
sound.enable = true;
|
sound.enable = true;
|
||||||
# nixpkgs.config.pulseaudio = true;
|
# nixpkgs.config.pulseaudio = true;
|
||||||
|
|
|
||||||
|
|
@ -163,6 +163,13 @@
|
||||||
(evil-mode 1)
|
(evil-mode 1)
|
||||||
(define-key evil-insert-state-map (kbd "C-g") 'evil-normal-state) ; alternative for exiting insert mode
|
(define-key evil-insert-state-map (kbd "C-g") 'evil-normal-state) ; alternative for exiting insert mode
|
||||||
(define-key evil-insert-state-map (kbd "C-h") 'evil-delete-backward-char-and-join) ; dont show help but instead do normal vim delete backwards
|
(define-key evil-insert-state-map (kbd "C-h") 'evil-delete-backward-char-and-join) ; dont show help but instead do normal vim delete backwards
|
||||||
|
(define-key evil-normal-state-map (kbd "C-z") nil)
|
||||||
|
(define-key evil-insert-state-map (kbd "C-z") nil)
|
||||||
|
(define-key evil-visual-state-map (kbd "C-z") nil)
|
||||||
|
(define-key evil-motion-state-map (kbd "C-z") nil)
|
||||||
|
(define-key evil-operator-state-map (kbd "C-z") nil)
|
||||||
|
(define-key evil-replace-state-map (kbd "C-z") nil)
|
||||||
|
(define-key global-map (kbd "C-z") nil)
|
||||||
|
|
||||||
;; evil undo system
|
;; evil undo system
|
||||||
(evil-set-undo-system 'undo-tree)
|
(evil-set-undo-system 'undo-tree)
|
||||||
|
|
@ -271,11 +278,23 @@
|
||||||
kept-new-versions 5 ; keep some new versions
|
kept-new-versions 5 ; keep some new versions
|
||||||
kept-old-versions 2) ; and some old ones, too
|
kept-old-versions 2) ; and some old ones, too
|
||||||
|
|
||||||
;; Make ESC quit prompts
|
(defun up-directory (path)
|
||||||
(global-set-key (kbd "<escape>") 'keyboard-escape-quit)
|
"Move up a directory in PATH without affecting the kill buffer."
|
||||||
|
(interactive "p")
|
||||||
|
(if (string-match-p "/." (minibuffer-contents))
|
||||||
|
(let ((end (point)))
|
||||||
|
(re-search-backward "/.")
|
||||||
|
(forward-char)
|
||||||
|
(delete-region (point) end))))
|
||||||
|
|
||||||
;; Set up general keybindings
|
(define-key minibuffer-local-filename-completion-map
|
||||||
(use-package general
|
[C-backspace] #'up-directory)
|
||||||
|
|
||||||
|
;; Make ESC quit prompts
|
||||||
|
(global-set-key (kbd "<escape>") 'keyboard-escape-quit)
|
||||||
|
|
||||||
|
;; Set up general keybindings
|
||||||
|
(use-package general
|
||||||
:config
|
:config
|
||||||
(general-create-definer swarsel/leader-keys
|
(general-create-definer swarsel/leader-keys
|
||||||
:keymaps '(normal insert visual emacs)
|
:keymaps '(normal insert visual emacs)
|
||||||
|
|
@ -285,6 +304,7 @@
|
||||||
(swarsel/leader-keys
|
(swarsel/leader-keys
|
||||||
"t" '(:ignore t :which-key "toggles")
|
"t" '(:ignore t :which-key "toggles")
|
||||||
"ts" '(hydra-text-scale/body :which-key "scale text")
|
"ts" '(hydra-text-scale/body :which-key "scale text")
|
||||||
|
"te" '(swarsel/toggle-evil-state :which-key "emacs/evil")
|
||||||
"tl" '(display-line-numbers-mode :which-key "line numbers")
|
"tl" '(display-line-numbers-mode :which-key "line numbers")
|
||||||
"tp" '(evil-cleverparens-mode :wk "cleverparens")
|
"tp" '(evil-cleverparens-mode :wk "cleverparens")
|
||||||
"to" '(olivetti-mode :wk "olivetti")
|
"to" '(olivetti-mode :wk "olivetti")
|
||||||
|
|
@ -345,8 +365,8 @@
|
||||||
"wm" '(delete-other-windows :wk "maximize")
|
"wm" '(delete-other-windows :wk "maximize")
|
||||||
))
|
))
|
||||||
|
|
||||||
;; General often used hotkeys
|
;; General often used hotkeys
|
||||||
(general-define-key
|
(general-define-key
|
||||||
"C-M-a" (lambda () (interactive) (org-capture nil "a")) ; make new anki card
|
"C-M-a" (lambda () (interactive) (org-capture nil "a")) ; make new anki card
|
||||||
;; "C-M-d" 'swarsel-obsidian-daily ; open daily obsidian file and create if not exist
|
;; "C-M-d" 'swarsel-obsidian-daily ; open daily obsidian file and create if not exist
|
||||||
;; "C-M-S" 'swarsel-anki-set-deck-and-notetype ; switch deck and notetype for new anki cards
|
;; "C-M-S" 'swarsel-anki-set-deck-and-notetype ; switch deck and notetype for new anki cards
|
||||||
|
|
@ -358,6 +378,12 @@
|
||||||
"C-<f9>" 'my-python-shell-run
|
"C-<f9>" 'my-python-shell-run
|
||||||
)
|
)
|
||||||
|
|
||||||
|
(defun swarsel/toggle-evil-state ()
|
||||||
|
(interactive)
|
||||||
|
(if (or (evil-emacs-state-p) (evil-insert-state-p))
|
||||||
|
(evil-normal-state)
|
||||||
|
(evil-emacs-state)))
|
||||||
|
|
||||||
(setq inhibit-startup-message t)
|
(setq inhibit-startup-message t)
|
||||||
|
|
||||||
;; (set-fringe-mode nil) ; Give some breathing room
|
;; (set-fringe-mode nil) ; Give some breathing room
|
||||||
|
|
@ -467,8 +493,8 @@
|
||||||
:after vertico
|
:after vertico
|
||||||
:bind (:map vertico-map
|
:bind (:map vertico-map
|
||||||
("RET" . vertico-directory-enter)
|
("RET" . vertico-directory-enter)
|
||||||
("DEL" . vertico-directory-delete-word)
|
("C-DEL" . vertico-directory-delete-word)
|
||||||
("M-DEL" . vertico-directory-delete-char))
|
("DEL" . vertico-directory-delete-char))
|
||||||
;; Tidy shadowed file names
|
;; Tidy shadowed file names
|
||||||
:hook (rfn-eshadow-update-overlay . vertico-directory-tidy))
|
:hook (rfn-eshadow-update-overlay . vertico-directory-tidy))
|
||||||
|
|
||||||
|
|
@ -482,14 +508,17 @@
|
||||||
:config
|
:config
|
||||||
(setq consult-fontify-max-size 1024)
|
(setq consult-fontify-max-size 1024)
|
||||||
:bind
|
:bind
|
||||||
("C-x b" . consult-buffer)
|
(("C-x b" . consult-buffer)
|
||||||
("C-c <C-m>" . consult-global-mark)
|
("C-c <C-m>" . consult-global-mark)
|
||||||
("C-c C-a" . consult-org-agenda)
|
("C-c C-a" . consult-org-agenda)
|
||||||
("C-x O" . consult-outline)
|
("C-x O" . consult-org-heading)
|
||||||
("M-g M-g" . consult-goto-line)
|
("M-g M-g" . consult-goto-line)
|
||||||
("M-g i" . consult-imenu)
|
("M-g i" . consult-imenu)
|
||||||
("M-s s" . consult-line)
|
("M-s s" . consult-line)
|
||||||
("M-s M-s" . consult-line-multi))
|
("M-s M-s" . consult-line-multi)
|
||||||
|
:map minibuffer-local-map
|
||||||
|
("C-j" . next-line)
|
||||||
|
("C-k" . previous-line)))
|
||||||
|
|
||||||
(use-package embark
|
(use-package embark
|
||||||
:bind
|
:bind
|
||||||
|
|
@ -587,13 +616,13 @@
|
||||||
;; ([remap describe-key] . helpful-key))
|
;; ([remap describe-key] . helpful-key))
|
||||||
|
|
||||||
(use-package helpful
|
(use-package helpful
|
||||||
:custom
|
|
||||||
(help-select-window t)
|
|
||||||
:bind
|
:bind
|
||||||
(("C-h f" . helpful-callable)
|
(("C-h f" . helpful-callable)
|
||||||
("C-h v" . helpful-variable)
|
("C-h v" . helpful-variable)
|
||||||
("C-h k" . helpful-key)
|
("C-h k" . helpful-key)
|
||||||
("C-h C-." . helpful-at-point)))
|
("C-h C-." . helpful-at-point))
|
||||||
|
:config
|
||||||
|
(setq help-window-select nil))
|
||||||
|
|
||||||
(use-package hydra)
|
(use-package hydra)
|
||||||
|
|
||||||
|
|
@ -1223,7 +1252,7 @@
|
||||||
(use-package projectile
|
(use-package projectile
|
||||||
:diminish projectile-mode
|
:diminish projectile-mode
|
||||||
:config (projectile-mode)
|
:config (projectile-mode)
|
||||||
:custom ((projectile-completion-system 'ivy)) ;; integrate ivy into completion system
|
:custom ((projectile-completion-system 'auto)) ;; integrate ivy into completion system
|
||||||
:bind-keymap
|
:bind-keymap
|
||||||
("C-c p" . projectile-command-map) ; all projectile commands under this
|
("C-c p" . projectile-command-map) ; all projectile commands under this
|
||||||
:init
|
:init
|
||||||
|
|
@ -1248,13 +1277,15 @@
|
||||||
:config
|
:config
|
||||||
(setq magit-repository-directories `((,swarsel-projects-directory . 1)
|
(setq magit-repository-directories `((,swarsel-projects-directory . 1)
|
||||||
(,swarsel-emacs-directory . 0)
|
(,swarsel-emacs-directory . 0)
|
||||||
(,swarsel-obsidian-directory . 0)))
|
(,swarsel-obsidian-directory . 0)
|
||||||
|
("~/.dotfiles/" . 0)))
|
||||||
:custom
|
:custom
|
||||||
(magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1)) ; stay in the same window
|
(magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1)) ; stay in the same window
|
||||||
|
|
||||||
;; yubikey support for pushing commits
|
;; yubikey support for pushing commits
|
||||||
;; commiting is enabled through nixos gpg-agent config
|
;; commiting is enabled through nixos gpg-agent config
|
||||||
(setenv "SSH_AUTH_SOCK" (string-chop-newline (shell-command-to-string "gpgconf --list-dirs agent-ssh-socket")))
|
(setq epg-pinentry-mode 'loopback)
|
||||||
|
(setenv "SSH_AUTH_SOCK" (string-chop-newline (shell-command-to-string "gpgconf --list-dirs agent-ssh-socket")))
|
||||||
|
|
||||||
(use-package forge
|
(use-package forge
|
||||||
:after magit)
|
:after magit)
|
||||||
|
|
@ -1382,23 +1413,23 @@
|
||||||
;; Bind dedicated completion commands
|
;; Bind dedicated completion commands
|
||||||
;; Alternative prefix keys: C-c p, M-p, M-+, ...
|
;; Alternative prefix keys: C-c p, M-p, M-+, ...
|
||||||
:bind
|
:bind
|
||||||
("C-c p p" . completion-at-point) ;; capf
|
("C-z p" . completion-at-point) ;; capf
|
||||||
("C-c p t" . complete-tag) ;; etags
|
("C-z t" . complete-tag) ;; etags
|
||||||
("C-c p d" . cape-dabbrev) ;; or dabbrev-completion
|
("C-z d" . cape-dabbrev) ;; or dabbrev-completion
|
||||||
("C-c p h" . cape-history)
|
("C-z h" . cape-history)
|
||||||
("C-c p f" . cape-file)
|
("C-z f" . cape-file)
|
||||||
("C-c p k" . cape-keyword)
|
("C-z k" . cape-keyword)
|
||||||
("C-c p s" . cape-elisp-symbol)
|
("C-z s" . cape-elisp-symbol)
|
||||||
("C-c p e" . cape-elisp-block)
|
("C-z e" . cape-elisp-block)
|
||||||
("C-c p a" . cape-abbrev)
|
("C-z a" . cape-abbrev)
|
||||||
("C-c p l" . cape-line)
|
("C-z l" . cape-line)
|
||||||
("C-c p w" . cape-dict)
|
("C-z w" . cape-dict)
|
||||||
("C-c p :" . cape-emoji)
|
("C-z :" . cape-emoji)
|
||||||
("C-c p \\" . cape-tex)
|
("C-z \\" . cape-tex)
|
||||||
("C-c p _" . cape-tex)
|
("C-z _" . cape-tex)
|
||||||
("C-c p ^" . cape-tex)
|
("C-z ^" . cape-tex)
|
||||||
("C-c p &" . cape-sgml)
|
("C-z &" . cape-sgml)
|
||||||
("C-c p r" . cape-rfc1345)
|
("C-z r" . cape-rfc1345)
|
||||||
;; Add to the global default value of `completion-at-point-functions' which is
|
;; Add to the global default value of `completion-at-point-functions' which is
|
||||||
;; used by `completion-at-point'. The order of the functions matters, the
|
;; used by `completion-at-point'. The order of the functions matters, the
|
||||||
;; first function returning a result wins. Note that the list of buffer-local
|
;; first function returning a result wins. Note that the list of buffer-local
|
||||||
|
|
@ -1521,7 +1552,7 @@
|
||||||
((prog-mode
|
((prog-mode
|
||||||
org-mode) . diff-hl-mode)
|
org-mode) . diff-hl-mode)
|
||||||
:init
|
:init
|
||||||
(diff-fl-flydiff-mode)
|
(diff-hl-flydiff-mode)
|
||||||
(diff-hl-margin-mode)
|
(diff-hl-margin-mode)
|
||||||
(diff-hl-show-hunk-mouse-mode))
|
(diff-hl-show-hunk-mouse-mode))
|
||||||
|
|
||||||
|
|
@ -1537,11 +1568,11 @@
|
||||||
;; (use-package yasnippet-snippets)
|
;; (use-package yasnippet-snippets)
|
||||||
|
|
||||||
;; (setq wtf/latex-greek-prefix "'")
|
;; (setq wtf/latex-greek-prefix "'")
|
||||||
;; (setq wtf/latex-math-prefix "`")
|
;; (setq wtf/latex-math-prefix "`")
|
||||||
(setq wtf/latex-mathbb-prefix "''")
|
(setq wtf/latex-mathbb-prefix "''")
|
||||||
(setq swarsel/latex-mathcal-prefix "``")
|
(setq swarsel/latex-mathcal-prefix "``")
|
||||||
|
|
||||||
(use-package yasnippet
|
(use-package yasnippet
|
||||||
:config
|
:config
|
||||||
;; (setq swtf/greek-alphabet
|
;; (setq swtf/greek-alphabet
|
||||||
;; '(("a" . "\\alpha")
|
;; '(("a" . "\\alpha")
|
||||||
|
|
@ -1630,16 +1661,15 @@
|
||||||
("u" . "\\cup")
|
("u" . "\\cup")
|
||||||
("0" . "\\emptyset")))
|
("0" . "\\emptyset")))
|
||||||
|
|
||||||
|
;; (yas-define-snippets
|
||||||
(yas-define-snippets
|
;; 'latex-mode
|
||||||
'latex-mode
|
;; (mapcar
|
||||||
(mapcar
|
;; (lambda (elem)
|
||||||
(lambda (elem)
|
;; (let ((key (car elem))
|
||||||
(let ((key (car elem))
|
;; (value (cdr elem)))
|
||||||
(value (cdr elem)))
|
;; (list (concat wtf/latex-math-prefix key) value (concat "Math symbol " value))))
|
||||||
(list (concat wtf/latex-math-prefix key) value (concat "Math symbol " value))))
|
;; swtf/latex-math-symbols))
|
||||||
swtf/latex-math-symbols))
|
)
|
||||||
)
|
|
||||||
|
|
||||||
(defun duplicate-line (arg)
|
(defun duplicate-line (arg)
|
||||||
"Duplicate current line, leaving point in lower line."
|
"Duplicate current line, leaving point in lower line."
|
||||||
|
|
@ -2106,6 +2136,7 @@
|
||||||
dashboard-image-banner-max-height 300
|
dashboard-image-banner-max-height 300
|
||||||
dashboard-startup-banner "~/.dotfiles/wallpaper/swarsel.png"
|
dashboard-startup-banner "~/.dotfiles/wallpaper/swarsel.png"
|
||||||
dashboard-projects-backend 'projectile
|
dashboard-projects-backend 'projectile
|
||||||
|
dashboard-projects-switch-function 'magit-status
|
||||||
dashboard-set-navigator t
|
dashboard-set-navigator t
|
||||||
dashboard-startupify-list '(dashboard-insert-banner
|
dashboard-startupify-list '(dashboard-insert-banner
|
||||||
dashboard-insert-newline
|
dashboard-insert-newline
|
||||||
|
|
@ -2147,7 +2178,6 @@
|
||||||
(lambda (&rest _) (browse-url "swarsel.win")))
|
(lambda (&rest _) (browse-url "swarsel.win")))
|
||||||
)
|
)
|
||||||
)))
|
)))
|
||||||
(setq dashboard-projects-switch-function 'project-switch-project)
|
|
||||||
|
|
||||||
(setq gc-cons-threshold (* 800 1000 ))
|
(setq gc-cons-threshold (* 800 1000 ))
|
||||||
(fset 'epg-wait-for-status 'ignore)
|
(fset 'epg-wait-for-status 'ignore)
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ if [ "$STR" == "" ]; then
|
||||||
else
|
else
|
||||||
VAR="0"
|
VAR="0"
|
||||||
fi
|
fi
|
||||||
emacsclient -c -a "" "$@"
|
emacsclient -c -a "" "$@" # open emacs in a new frame, start new daemon if it is dead and open arg
|
||||||
if [ "$VAR" == "1" ]
|
if [ "$VAR" == "1" ]
|
||||||
then
|
then
|
||||||
swaymsg '[title="kittyterm"]' scratchpad show
|
swaymsg '[title="kittyterm"]' scratchpad show
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue