org fragtog + fzf

This commit is contained in:
willemml 2023-02-13 14:51:56 -08:00
parent c83a6109d1
commit 91637f5dea
Signed by: willemml
GPG key ID: C3DE5DF6198DACBD
5 changed files with 90 additions and 82 deletions

View file

@ -39,6 +39,7 @@ in
programs.zsh.shellAliases = mkIf stdenv.isDarwin ({ programs.zsh.shellAliases = mkIf stdenv.isDarwin ({
drs = "darwin-rebuild switch --flake ${config.home.homeDirectory}/.config/dotfiles.nix#"; drs = "darwin-rebuild switch --flake ${config.home.homeDirectory}/.config/dotfiles.nix#";
f = "open \"$(${config.programs.fzf.package}/bin/fzf)\"";
o = "open"; o = "open";
oa = "open -a"; oa = "open -a";
pinentry = "pinentry-mac"; pinentry = "pinentry-mac";

View file

@ -36,84 +36,84 @@ in {
''; '';
prelude = '' prelude = ''
; -*-emacs-lisp-*- ; -*-emacs-lisp-*-
;; Disable startup message. ;; Disable startup message.
(setq inhibit-startup-screen t (setq inhibit-startup-screen t
inhibit-startup-echo-area-message (user-login-name)) inhibit-startup-echo-area-message (user-login-name))
(setq package-archives '(("melpa" . "https://melpa.org/packages/") (setq package-archives '(("melpa" . "https://melpa.org/packages/")
("melpa-stable" . "https://stable.melpa.org/packages/") ("melpa-stable" . "https://stable.melpa.org/packages/")
("gnu" . "https://elpa.gnu.org/packages/") ("gnu" . "https://elpa.gnu.org/packages/")
("nongnu" . "https://elpa.nongnu.org/nongnu/"))) ("nongnu" . "https://elpa.nongnu.org/nongnu/")))
;; Empty initial scratch buffer. ;; Empty initial scratch buffer.
(setq initial-major-mode 'fundamental-mode (setq initial-major-mode 'fundamental-mode
initial-scratch-message nil) initial-scratch-message nil)
(setenv "PATH" (concat "${config.home.profileDirectory}/bin:" (getenv "PATH"))) (setenv "PATH" (concat "${config.home.profileDirectory}/bin:" (getenv "PATH")))
;; Accept 'y' and 'n' rather than 'yes' and 'no'. ;; Accept 'y' and 'n' rather than 'yes' and 'no'.
(defalias 'yes-or-no-p 'y-or-n-p) (defalias 'yes-or-no-p 'y-or-n-p)
;; Typically, I only want spaces when pressing the TAB key. I also ;; Typically, I only want spaces when pressing the TAB key. I also
;; want 4 of them. ;; want 4 of them.
(setq-default indent-tabs-mode nil (setq-default indent-tabs-mode nil
tab-width 4 tab-width 4
c-basic-offset 4) c-basic-offset 4)
;; Increase emacs data read limit (default too low for LSP) ;; Increase emacs data read limit (default too low for LSP)
(setq read-process-output-max (* 1024 1024)) (setq read-process-output-max (* 1024 1024))
;; Reduce wrist pain ;; Reduce wrist pain
(global-set-key (kbd "M-n") "~") (global-set-key (kbd "M-n") "~")
(global-set-key (kbd "M-N") "`") (global-set-key (kbd "M-N") "`")
;; Stop creating backup and autosave files. ;; Stop creating backup and autosave files.
(setq make-backup-files nil (setq make-backup-files nil
auto-save-default nil) auto-save-default nil)
;; Always show line and column number in the mode line. ;; Always show line and column number in the mode line.
(line-number-mode) (line-number-mode)
(column-number-mode) (column-number-mode)
;; Soft wrap lines ;; Soft wrap lines
(visual-line-mode) (visual-line-mode)
;; Use one space to end sentences. ;; Use one space to end sentences.
(setq sentence-end-double-space nil) (setq sentence-end-double-space nil)
;; I typically want to use UTF-8. ;; I typically want to use UTF-8.
(prefer-coding-system 'utf-8) (prefer-coding-system 'utf-8)
;; Enable highlighting of current line. ;; Enable highlighting of current line.
(global-hl-line-mode 1) (global-hl-line-mode 1)
;; When finding file in non-existing directory, offer to create the ;; When finding file in non-existing directory, offer to create the
;; parent directory. ;; parent directory.
(defun with-buffer-name-prompt-and-make-subdirs () (defun with-buffer-name-prompt-and-make-subdirs ()
(let ((parent-directory (file-name-directory buffer-file-name))) (let ((parent-directory (file-name-directory buffer-file-name)))
(when (and (not (file-exists-p parent-directory)) (when (and (not (file-exists-p parent-directory))
(y-or-n-p (format "Directory `%s' does not exist! Create it? " parent-directory))) (y-or-n-p (format "Directory `%s' does not exist! Create it? " parent-directory)))
(make-directory parent-directory t)))) (make-directory parent-directory t))))
(add-to-list 'find-file-not-found-functions #'with-buffer-name-prompt-and-make-subdirs) (add-to-list 'find-file-not-found-functions #'with-buffer-name-prompt-and-make-subdirs)
;; Bind Emacs built in completion using completion-at-point to "C-M-i" ;; Bind Emacs built in completion using completion-at-point to "C-M-i"
(global-set-key (kbd "C-M-i") 'completion-at-point) (global-set-key (kbd "C-M-i") 'completion-at-point)
;; Keybind to format/prettify document, uses either format-all or ;; Keybind to format/prettify document, uses either format-all or
;; lsp-mode depending on availability ;; lsp-mode depending on availability
(global-set-key (kbd "C-c C-y") 'my/format-document) (global-set-key (kbd "C-c C-y") 'my/format-document)
;; Don't warn when cannot guess python indent level ;; Don't warn when cannot guess python indent level
(setq-default python-indent-guess-indent-offset-verbose nil) (setq-default python-indent-guess-indent-offset-verbose nil)
(defun my/define-multiple-keys (map keys) (defun my/define-multiple-keys (map keys)
"Define multiple KEYS in a keymap. "Define multiple KEYS in a keymap.
Argument MAP keymap in which to bind the keys." Argument MAP keymap in which to bind the keys."
(dolist (key keys nil) (dolist (key keys nil)
(define-key map (kbd (car key)) (nth 1 key)))) (define-key map (kbd (car key)) (nth 1 key))))
(defun my/customize-set-variables (variables) (defun my/customize-set-variables (variables)
"Set multiple Customize VARIABLES at once." "Set multiple Customize VARIABLES at once."
(dolist (variable variables nil) (dolist (variable variables nil)
(customize-set-variable (car variable) (nth 1 variable)))) (customize-set-variable (car variable) (nth 1 variable))))
(defun my/find-file-in-folder-shortcut (folder) (defun my/find-file-in-folder-shortcut (folder)
"Interactively call `find-file' after using 'cd' into 'FOLDER'." "Interactively call `find-file' after using 'cd' into 'FOLDER'."
(cd (expand-file-name folder)) (cd (expand-file-name folder))
(call-interactively #'find-file)) (call-interactively #'find-file))
(defun my/electric-mode () (defun my/electric-mode ()
"Enable some basic features for coding." "Enable some basic features for coding."
(interactive) (interactive)
(electric-pair-local-mode) (electric-pair-local-mode)
(electric-indent-local-mode)) (electric-indent-local-mode))
(defun dev () (defun dev ()
"Shortcut to '~/dev' folder." "Shortcut to '~/dev' folder."
(interactive) (interactive)
(my/find-file-in-folder-shortcut "~/dev")) (my/find-file-in-folder-shortcut "~/dev"))
;; Disable scroll + C to zoom ;; Disable scroll + C to zoom
(global-unset-key (kbd "C-<wheel-down>")) (global-unset-key (kbd "C-<wheel-down>"))
(global-unset-key (kbd "C-<wheel-up>")) (global-unset-key (kbd "C-<wheel-up>"))
''; '';
usePackage = { usePackage = {
@ -616,6 +616,11 @@ in {
hook = [ "(dired-mode-hook . org-download-enable)" ]; hook = [ "(dired-mode-hook . org-download-enable)" ];
}; };
org-fragtog ={
enable = true;
hook = [ "(org-mode-hook . org-fragtog-mode)" ];
};
org-ref = { org-ref = {
enable = true; enable = true;
init = '' init = ''

View file

@ -29,7 +29,6 @@ in
docker-compose docker-compose
fd fd
findutils findutils
fzf
gawk gawk
gnuplot gnuplot
graphviz graphviz

View file

@ -49,6 +49,12 @@
]; ];
}; };
fzf = {
enable = true;
defaultCommand = "${pkgs.fd}/bin/fd . ${config.home.homeDirectory}";
enableZshIntegration = true;
};
git = { git = {
enable = true; enable = true;
delta = { enable = true; }; delta = { enable = true; };

View file

@ -41,9 +41,6 @@
programs.man.enable = true; programs.man.enable = true;
programs.zsh.enableFzfCompletion = true;
programs.zsh.enableFzfGit = true;
programs.zsh.enableFzfHistory = true;
programs.zsh.loginShellInit = '' programs.zsh.loginShellInit = ''
reexec() { reexec() {
unset __NIX_DARWIN_SET_ENVIRONMENT_DONE unset __NIX_DARWIN_SET_ENVIRONMENT_DONE