diff --git a/ui.el b/ui.el index 94098d6..3ab07d5 100644 --- a/ui.el +++ b/ui.el @@ -98,9 +98,7 @@ (setq tab-bar-close-button-show nil) ;; hide tab close / X button (setq tab-bar-new-tab-choice "*enlight*");; buffer to show in new tabs (setq tab-bar-tab-hints t) ;; show tab numbers - (setq tab-bar-format '(tab-bar-format-tabs tab-bar-separator)) ;; elements to include in bar - (defvar tab-bar-select-tab-hook nil "Hook for `tab-bar-select-tab'") ;; Hook for tab change, since it doesn't exist by default - (advice-add 'tab-bar-select-tab :after (lambda (x) (run-hooks 'tab-bar-select-tab-hook)))) + (setq tab-bar-format '(tab-bar-format-tabs tab-bar-separator))) ;; elements to include in bar ;; Hideshow (add-hook 'prog-mode-hook #'hs-minor-mode) diff --git a/userland/flycheck_dired-custom.el b/userland/flycheck_dired-custom.el new file mode 100644 index 0000000..f684798 --- /dev/null +++ b/userland/flycheck_dired-custom.el @@ -0,0 +1,104 @@ +;;; dired-custom.el --- Custom dired config -*- lexical-binding: t -*- + +;; This file is not part of GNU Emacs + +;; This program is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + + +;;; Commentary: + +;; commentary + +;;; Code: + +(require 'dired) + +(setq dired-listing-switches "-lh") +(setq dired-recursive-deletes t) +(setq dired-recursive-copies t) + +(defun dired-init () + "Theurgy Dired config." + ;; Hide file permissions + (dired-hide-details-mode 1) + ;; Kill new buffers + (when (>= emacs-major-version 28) + (setq dired-kill-when-opening-new-dired-buffer t)) + (when (< emacs-major-version 28) + (progn + (define-key dired-mode-map (kbd "RET") 'dired-find-alternate-file) + (define-key dired-mode-map (kbd "^") (lambda () (interactive) (find-alternate-file ".."))))) + ;; Human readable file size + (setq dired-listing-switches "-lh")) + +(add-hook 'dired-mode-hook 'dired-init) +(add-hook 'dired-mode-hook 'auto-revert-mode) + +;; Icons in dired +(use-package all-the-icons-dired + :config + (add-hook 'dired-mode-hook 'all-the-icons-dired-mode)) + +;; Multimedia and PDF viewing +(when (not (equal system-type 'windows-nt)) + (use-package ready-player + :ensure t + :config + (setq ready-player-autoplay nil) + (ready-player-mode 1)) + + (use-package pdf-tools + :config (pdf-loader-install))) + + +;; Preview files +(defun dired-preview-to-the-right () + "My preferred `dired-preview-display-action-alist-function'." + '((display-buffer-in-side-window) + (side . right) + (slot . 0) + (window-width . 0.3))) + +(use-package dired-preview + :after (ready-player) + :config + (setq dired-preview-display-action-alist #'dired-preview-to-the-right) + (setq dired-preview-buffer-name-indicator "[Preview]") + (setq dired-preview-ignored-extensions-regexp + (concat "\\." + "\\(gz\\|" + "zst\\|" + "tar\\|" + "xz\\|" + "rar\\|" + "zip\\|" + "iso\\|" + "epub" + "\\)")) + (dired-preview-global-mode 1)) + +;; Automatically kill preview buffers when opening a file +(add-hook 'find-file-hook (lambda () + (dolist (buf (buffer-list)) + (when (string-match-p "\\[Preview\\]" (buffer-name buf)) + (kill-buffer buf))))) + +(use-package neotree + :config + (define-key global-map (kbd "") 'neotree-toggle) + (setq neo-theme (if (display-graphic-p) 'icons 'arrow))) + +(provide 'dired-custom) + +;;; dired-custom.el ends here diff --git a/userland/projects.el b/userland/projects.el index f2a4d52..08ba049 100644 --- a/userland/projects.el +++ b/userland/projects.el @@ -49,17 +49,8 @@ (whaler :action (lambda (dir) (find-file (get-project-default-file dir)) (tab-rename (file-name-nondirectory (string-remove-suffix "/" dir))) - (tab-bar-change-tab-group (concat "project: " dir)) ;; We use the tab group name to store the project working directory (neotree-dir dir)))) -(defun theurgy-swap-to-tab-project () - "Go to the project dir of the tab group." - (let ((tab-group-name (tab-bar-tab-group-default (tab-bar--current-tab)))) - (when (string-match-p "^project:" tab-group-name) - (neotree-dir (string-remove-prefix "project: " tab-group-name))))) - -(add-hook 'tab-bar-select-tab-hook #'theurgy-swap-to-tab-project) - (defun theurgy-edit-projects-list () "Open list of projects in customize." (interactive)