Created
March 22, 2022 21:45
-
-
Save erikLundstedt/1182a024fe700ecafb7b8c6d3c39ad05 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; rational-module.el -*- lexical-binding: t; -*- | |
;;; License | |
;; Copyright (C) 2022 | |
;; SPDX-License-Identifier: MIT | |
;; Author: Erik Lundstedt, System Crafters Community | |
;;; Commentary: | |
;; this file was made with outline-minor-mode in mind | |
;; and therefore have ";;;+"-comments as headders. | |
;; rational-moodule to setup "rational defaults" for speedbar | |
;; speedbar is a file-tree (and more) that comes builtin to emacs | |
;; it also has integreation with some packages like Rmail and projectile | |
;;; Code: | |
;;;; simple function for use in keybindings | |
(defun speedbar-switch-to-quick-buffers () | |
"Switch to quick-buffers expansion list." | |
(interactive) | |
(speedbar-change-initial-expansion-list "quick buffers") | |
) | |
;;;; im assuming that the "default" builtin keybinds are ok for non-evil users | |
(with-eval-after-load 'speedbar | |
(with-eval-after-load 'evil | |
;;edit/open file under point | |
(define-key speedbar-mode-map (kbd "<return>") 'speedbar-edit-line) | |
;;toggle thing at point | |
(define-key speedbar-mode-map (kbd "<tab>") 'speedbar-toggle-line-expansion) | |
;;evaluate as elisp if file at point is elisp, I dont use this too much but might be useful | |
(define-key speedbar-mode-map (kbd "<C-return>") 'speedbar-item-load) | |
;;temporarly change mode in speedbar to "buffer-switching mode". | |
;;useful for quickly switching to an open buffer | |
(define-key speedbar-mode-map (kbd "b") 'speedbar-switch-to-quick-buffers) | |
) | |
) | |
;; this only runs in some cases | |
(with-eval-after-load 'evil-collection | |
(evil-collection-speedbar-setup) | |
) | |
;;; set some sane defaults, can be easily extended by user | |
(setq-default speedbar-frame-parameters | |
'( | |
(name . "speedbar") | |
(title . "speedbar") | |
(minibuffer . nil) | |
(border-width . 2) | |
(menu-bar-lines . 0) | |
(tool-bar-lines . 0) | |
(unsplittable . t) | |
(left-fringe . 10) | |
) | |
) | |
;;; list of supported extensions | |
;; as the default list is verry minimal | |
;; not sure if all of these are really needed, | |
;;and if they should be added by individual modules, | |
;;BUT it doesnt hurt to have more so feel free to add to the list | |
(speedbar-add-supported-extension | |
(list | |
".lua" | |
".fnl" | |
".fennel" | |
".sh" | |
".php" | |
".html" | |
".htm" | |
".css" | |
".less" | |
".scss" | |
".sass" | |
".c" | |
".cpp" | |
".h" | |
"makefile" | |
"MAKEFILE" | |
"Makefile" | |
".java" | |
".kt";;for kotlin | |
".mvn" | |
".gradle" ".properties";; for gradle-projects | |
".scm" | |
".lisp" | |
".clj" | |
".el";;duh | |
".js" | |
".json" | |
".yaml" | |
".toml" | |
".md";;why would you... | |
".markdown";;...use something that isnt... | |
".org";;...orgmode? | |
) | |
) | |
;;; make speedbar update automaticaly, and dont use ugly icons(images) | |
(setq-default speedbar-update-flag t) | |
(setq-default speedbar-use-images nil) | |
;;in my opinion,this looks better than the icons used by default | |
;; it can be set back to use icons by simply doing | |
;;`(setq-default speedbar-use-images t)` in your own config | |
;;; should it turn the speedbar on automaticaly | |
(provide 'rational-speedbar) | |
;;; rational-speedbar.el ends here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment