From 7d4ada316e01c0665342420e7fb204971ccdac01 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Wed, 23 Mar 2022 07:46:34 -0700 Subject: rename fcuny-navigation to my-navigation --- emacs/custom/my-navigation.el | 154 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 154 insertions(+) create mode 100644 emacs/custom/my-navigation.el (limited to 'emacs/custom/my-navigation.el') diff --git a/emacs/custom/my-navigation.el b/emacs/custom/my-navigation.el new file mode 100644 index 0000000..4a36310 --- /dev/null +++ b/emacs/custom/my-navigation.el @@ -0,0 +1,154 @@ +;;; my-navigation.el --- Configure parts related to navigation +;;; Commentary: +;;; Code: + +(require 'use-package) + +(setq help-window-select t) + +(use-package project + :ensure t + :bind-keymap ("C-c p" . project-prefix-map) + :custom + (project-switch-commands + '((?f "File" project-find-file) + (?d "Dired" project-dired) + (?b "Buffer" project-switch-to-buffer) + (?e "Eshell" project-eshell) + (?m "Magit status" magit-project-status) + (?r "Search" rg-project)))) + +(use-package bookmark + :custom + (bookmark-save-flag 1)) + +(use-package ls-lisp + :ensure nil + :custom + (ls-lisp-use-insert-directory-program nil) + (ls-lisp-dirs-first t)) + +(use-package dired + :defer t + :bind (("C-x C-d" . dired) + ("C-x C-j" . dired-jump)) + :init + (setq-default dired-dwim-target t) + (setq-default dired-listing-switches "-alh") + (setq dired-recursive-deletes 'always) + (setq dired-recursive-copies 'always)) + +(use-package dired-x + :ensure nil + :hook ((dired-mode . dired-omit-mode)) + :config + (setq dired-omit-verbose nil) + ;; hide backup, autosave, *.*~ files + ;; omit mode can be toggled using `C-x M-o' in dired buffer. + (setq dired-omit-files + (concat dired-omit-files "\\|^.DS_Store$\\|^.localized$\\|^.projectile$\\|^.git$"))) + +(use-package ibuffer + :bind ("C-x C-b" . ibuffer) + :commands + ibuffer-auto-mode + ibuffer-switch-to-saved-filter-groups + ibuffer-do-sort-by-alphabetic + :custom + (ibuffer-saved-filter-groups + (quote (("default" + ("org" (mode . org-mode)) + ("go" (mode . go-mode)) + ("nix" (mode . nix-mode)) + ("python" (mode . python-mode)) + ("config" (or + (name . "\\.conf$") + (name . "\\.json$") + (mode . yaml-mode))) + ("scripts" (mode . sh-mode)) + ("documentation" (or + (mode . markdown-mode) + (mode . rst-mode))) + ("dired" (mode . dired-mode)) + ("shell" (mode . eshell-mode)) + ("git" (or + (name . "^\*magit") + (name . "^\magit"))) + ("Emacs" (or + (mode . emacs-lisp-mode) + (name . "^\\*scratch\\*$") + (name . "^\\.emacs") + (name . "^\\*Messages\\*$"))))))) + :init + (add-hook 'ibuffer-mode-hook (lambda () (ibuffer-switch-to-saved-filter-groups "default")))) + +(use-package recentf + :init (recentf-mode 1) + :config + (setq recentf-max-saved-items 500 + recentf-exclude '(".gz" ".xz" ".zip") + recentf-save-file (expand-file-name "var/recentf" user-emacs-directory))) + +(use-package rg + :ensure t + :custom + (rg-group-result t) + (rg-show-columns t) + (rg-align-position-numbers t) + (rg-align-line-number-field-length 3) + (rg-align-column-number-field-length 3) + (rg-align-line-column-separator "#") + (rg-align-position-content-separator "|")) + +(use-package counsel + :diminish counsel-mode + :ensure t + :after ivy + :init (counsel-mode 1) + :bind + (("M-x" . counsel-M-x) + ("C-x C-f" . counsel-find-file) + ("C-x C-r" . counsel-recentf) + ("C-c i " . counsel-imenu) + ("C-c f" . counsel-git) + ("C-c /" . counsel-rg) + ("C-c m" . counsel-mark-ring) + ("C-c V" . counsel-describe-variable) + ("C-c C-l" . counsel-find-library) + ("C-c U" . counsel-unicode-char) + ("C-x r l" . counsel-bookmark)) + :custom + (counsel-find-file-ignore-regexp "\\.git\\|\\.DS_Store\\|\\.localized\\'") + (counsel-find-file-at-point t)) + +(use-package ivy + :ensure t + :diminish ivy-mode + :init (ivy-mode 1) + :custom + (ivy-use-virtual-buffers t) + (ivy-count-format "(%d/%d) ") + (ivy-height 20) + (ivy-use-selectable-prompt t) + :bind (("C-x b" . ivy-switch-buffer) + ("C-s" . swiper))) + +(use-package ivy-rich + :ensure t + :after (ivy) + :config + (ivy-rich-mode 1) + :custom + (ivy-extra-directories '("../" "./")) + (ivy-virtual-abbreviate 'full) + (ivy-rich-switch-buffer-align-virtual-buffer t) + (ivy-rich-path-style 'abbrev)) + +(use-package which-key + :diminish which-key-mode + :ensure t + :config + (which-key-mode)) + +(provide 'my-navigation) +;;; my-navigation.el ends here -- cgit 1.4.1