diff --git a/home/darwin.nix b/home/darwin.nix index 46e6279..17efefa 100644 --- a/home/darwin.nix +++ b/home/darwin.nix @@ -39,6 +39,7 @@ in programs.zsh.shellAliases = mkIf stdenv.isDarwin ({ drs = "darwin-rebuild switch --flake ${config.home.homeDirectory}/.config/dotfiles.nix#"; + f = "open \"$(${config.programs.fzf.package}/bin/fzf)\""; o = "open"; oa = "open -a"; pinentry = "pinentry-mac"; diff --git a/home/emacs.nix b/home/emacs.nix index b2f3a87..7113e13 100644 --- a/home/emacs.nix +++ b/home/emacs.nix @@ -36,84 +36,84 @@ in { ''; prelude = '' - ; -*-emacs-lisp-*- - ;; Disable startup message. - (setq inhibit-startup-screen t - inhibit-startup-echo-area-message (user-login-name)) - (setq package-archives '(("melpa" . "https://melpa.org/packages/") - ("melpa-stable" . "https://stable.melpa.org/packages/") - ("gnu" . "https://elpa.gnu.org/packages/") - ("nongnu" . "https://elpa.nongnu.org/nongnu/"))) - ;; Empty initial scratch buffer. - (setq initial-major-mode 'fundamental-mode - initial-scratch-message nil) - (setenv "PATH" (concat "${config.home.profileDirectory}/bin:" (getenv "PATH"))) - ;; Accept 'y' and 'n' rather than 'yes' and 'no'. - (defalias 'yes-or-no-p 'y-or-n-p) - ;; Typically, I only want spaces when pressing the TAB key. I also - ;; want 4 of them. - (setq-default indent-tabs-mode nil - tab-width 4 - c-basic-offset 4) - ;; Increase emacs data read limit (default too low for LSP) - (setq read-process-output-max (* 1024 1024)) - ;; Reduce wrist pain - (global-set-key (kbd "M-n") "~") - (global-set-key (kbd "M-N") "`") - ;; Stop creating backup and autosave files. - (setq make-backup-files nil - auto-save-default nil) - ;; Always show line and column number in the mode line. - (line-number-mode) - (column-number-mode) - ;; Soft wrap lines - (visual-line-mode) - ;; Use one space to end sentences. - (setq sentence-end-double-space nil) - ;; I typically want to use UTF-8. - (prefer-coding-system 'utf-8) - ;; Enable highlighting of current line. - (global-hl-line-mode 1) - ;; When finding file in non-existing directory, offer to create the - ;; parent directory. - (defun with-buffer-name-prompt-and-make-subdirs () - (let ((parent-directory (file-name-directory buffer-file-name))) - (when (and (not (file-exists-p parent-directory)) - (y-or-n-p (format "Directory `%s' does not exist! Create it? " parent-directory))) - (make-directory parent-directory t)))) - (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" - (global-set-key (kbd "C-M-i") 'completion-at-point) - ;; Keybind to format/prettify document, uses either format-all or - ;; lsp-mode depending on availability - (global-set-key (kbd "C-c C-y") 'my/format-document) - ;; Don't warn when cannot guess python indent level - (setq-default python-indent-guess-indent-offset-verbose nil) - (defun my/define-multiple-keys (map keys) - "Define multiple KEYS in a keymap. - Argument MAP keymap in which to bind the keys." - (dolist (key keys nil) - (define-key map (kbd (car key)) (nth 1 key)))) - (defun my/customize-set-variables (variables) - "Set multiple Customize VARIABLES at once." - (dolist (variable variables nil) - (customize-set-variable (car variable) (nth 1 variable)))) - (defun my/find-file-in-folder-shortcut (folder) - "Interactively call `find-file' after using 'cd' into 'FOLDER'." - (cd (expand-file-name folder)) - (call-interactively #'find-file)) - (defun my/electric-mode () - "Enable some basic features for coding." - (interactive) - (electric-pair-local-mode) - (electric-indent-local-mode)) - (defun dev () - "Shortcut to '~/dev' folder." - (interactive) - (my/find-file-in-folder-shortcut "~/dev")) - ;; Disable scroll + C to zoom - (global-unset-key (kbd "C-")) - (global-unset-key (kbd "C-")) + ; -*-emacs-lisp-*- +;; Disable startup message. +(setq inhibit-startup-screen t + inhibit-startup-echo-area-message (user-login-name)) +(setq package-archives '(("melpa" . "https://melpa.org/packages/") + ("melpa-stable" . "https://stable.melpa.org/packages/") + ("gnu" . "https://elpa.gnu.org/packages/") + ("nongnu" . "https://elpa.nongnu.org/nongnu/"))) +;; Empty initial scratch buffer. +(setq initial-major-mode 'fundamental-mode + initial-scratch-message nil) +(setenv "PATH" (concat "${config.home.profileDirectory}/bin:" (getenv "PATH"))) +;; Accept 'y' and 'n' rather than 'yes' and 'no'. +(defalias 'yes-or-no-p 'y-or-n-p) +;; Typically, I only want spaces when pressing the TAB key. I also +;; want 4 of them. +(setq-default indent-tabs-mode nil + tab-width 4 + c-basic-offset 4) +;; Increase emacs data read limit (default too low for LSP) +(setq read-process-output-max (* 1024 1024)) +;; Reduce wrist pain +(global-set-key (kbd "M-n") "~") +(global-set-key (kbd "M-N") "`") +;; Stop creating backup and autosave files. +(setq make-backup-files nil + auto-save-default nil) +;; Always show line and column number in the mode line. +(line-number-mode) +(column-number-mode) +;; Soft wrap lines +(visual-line-mode) +;; Use one space to end sentences. +(setq sentence-end-double-space nil) +;; I typically want to use UTF-8. +(prefer-coding-system 'utf-8) +;; Enable highlighting of current line. +(global-hl-line-mode 1) +;; When finding file in non-existing directory, offer to create the +;; parent directory. +(defun with-buffer-name-prompt-and-make-subdirs () + (let ((parent-directory (file-name-directory buffer-file-name))) + (when (and (not (file-exists-p parent-directory)) + (y-or-n-p (format "Directory `%s' does not exist! Create it? " parent-directory))) + (make-directory parent-directory t)))) +(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" +(global-set-key (kbd "C-M-i") 'completion-at-point) +;; Keybind to format/prettify document, uses either format-all or +;; lsp-mode depending on availability +(global-set-key (kbd "C-c C-y") 'my/format-document) +;; Don't warn when cannot guess python indent level +(setq-default python-indent-guess-indent-offset-verbose nil) +(defun my/define-multiple-keys (map keys) + "Define multiple KEYS in a keymap. +Argument MAP keymap in which to bind the keys." + (dolist (key keys nil) + (define-key map (kbd (car key)) (nth 1 key)))) +(defun my/customize-set-variables (variables) + "Set multiple Customize VARIABLES at once." + (dolist (variable variables nil) + (customize-set-variable (car variable) (nth 1 variable)))) +(defun my/find-file-in-folder-shortcut (folder) + "Interactively call `find-file' after using 'cd' into 'FOLDER'." + (cd (expand-file-name folder)) + (call-interactively #'find-file)) +(defun my/electric-mode () + "Enable some basic features for coding." + (interactive) + (electric-pair-local-mode) + (electric-indent-local-mode)) +(defun dev () + "Shortcut to '~/dev' folder." + (interactive) + (my/find-file-in-folder-shortcut "~/dev")) +;; Disable scroll + C to zoom +(global-unset-key (kbd "C-")) +(global-unset-key (kbd "C-")) ''; usePackage = { @@ -616,6 +616,11 @@ in { hook = [ "(dired-mode-hook . org-download-enable)" ]; }; + org-fragtog ={ + enable = true; + hook = [ "(org-mode-hook . org-fragtog-mode)" ]; + }; + org-ref = { enable = true; init = '' diff --git a/home/packages.nix b/home/packages.nix index d98edba..40d51ca 100644 --- a/home/packages.nix +++ b/home/packages.nix @@ -29,7 +29,6 @@ in docker-compose fd findutils - fzf gawk gnuplot graphviz diff --git a/home/programs.nix b/home/programs.nix index 113710f..e20ab8b 100644 --- a/home/programs.nix +++ b/home/programs.nix @@ -49,6 +49,12 @@ ]; }; + fzf = { + enable = true; + defaultCommand = "${pkgs.fd}/bin/fd . ${config.home.homeDirectory}"; + enableZshIntegration = true; + }; + git = { enable = true; delta = { enable = true; }; diff --git a/system/zeus.darwin.nix b/system/zeus.darwin.nix index b13a09b..fded1e0 100644 --- a/system/zeus.darwin.nix +++ b/system/zeus.darwin.nix @@ -41,9 +41,6 @@ programs.man.enable = true; - programs.zsh.enableFzfCompletion = true; - programs.zsh.enableFzfGit = true; - programs.zsh.enableFzfHistory = true; programs.zsh.loginShellInit = '' reexec() { unset __NIX_DARWIN_SET_ENVIRONMENT_DONE