From a9b607a426ec25dbb5fa2ef4ae5c994db337f75d Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sat, 15 Oct 2022 13:17:23 -0700 Subject: ref(navigation): re-organize the module and load packages Load explicitly the packages I want and group the module for settings, bindings and hooks. Change-Id: I9e22043819bba096ee5d33e53fa03926eb559cc1 --- emacs/custom/my-navigation.el | 76 ++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 45 deletions(-) (limited to 'emacs/custom') diff --git a/emacs/custom/my-navigation.el b/emacs/custom/my-navigation.el index 5d03f86..12cc557 100644 --- a/emacs/custom/my-navigation.el +++ b/emacs/custom/my-navigation.el @@ -4,56 +4,42 @@ ;;; Code: -(setq help-window-select t) - +(require 'bookmark) (require 'project) - -(customize-set-variable '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))) - -(defun my/project-find-rust-module (dir) - "Find the Cargo.toml file in a DIR." - (when-let ((root (locate-dominating-file dir "Cargo.toml"))) - (cons 'rust-module root))) - -(cl-defmethod project-root ((project (head rust-module))) - "Set the project root for PROJECT." - (cdr project)) - -(defun my/project-find-go-module (dir) - "Find the go.mod file in a DIR." - (when-let ((root (locate-dominating-file dir "go.mod"))) - (cons 'go-module root))) - -(cl-defmethod project-root ((project (head go-module))) - "Set the project root for PROJECT." - (cdr project)) - -(add-to-list 'project-find-functions #'my/project-find-go-module) -(add-to-list 'project-find-functions #'my/project-find-rust-module) - -(customize-set-variable 'bookmark-save-flag 1) - +(require 'recentf) +(require 'rg) + +;;; settings +(setq help-window-select t) ;; select help window when opening it + +(setq 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))) + +(setq bookmark-save-flag 1) +(setq bookmark-default-file (expand-file-name "var/bookmarks" user-emacs-directory)) + +(setq rg-group-result t) +(setq rg-show-columns t) +(setq rg-align-position-numbers t) +(setq rg-align-line-number-field-length 3) +(setq rg-align-column-number-field-length 3) +(setq rg-align-line-column-separator "#") +(setq rg-align-position-content-separator "|") + +(setq recentf-max-saved-items 500) +(setq recentf-exclude '(".gz" ".xz" ".zip" "tmp/" "/ssh:")) + +;;; bindings (global-set-key (kbd "C-x C-b") 'ibuffer) (global-set-key (kbd "M-g i") 'imenu) -(customize-set-variable 'recentf-max-saved-items 500) -(customize-set-variable 'recentf-exclude '(".gz" ".xz" ".zip" "tmp/" "/ssh:")) +;;; hooks (add-hook 'after-init-hook 'recentf-mode) - -(customize-set-variable 'rg-group-result t) -(customize-set-variable 'rg-show-columns t) -(customize-set-variable 'rg-align-position-numbers t) -(customize-set-variable 'rg-align-line-number-field-length 3) -(customize-set-variable 'rg-align-column-number-field-length 3) -(customize-set-variable 'rg-align-line-column-separator "#") -(customize-set-variable 'rg-align-position-content-separator "|") - (add-hook 'after-init-hook 'which-key-mode) (provide 'my-navigation) -- cgit 1.4.1