Setup the noether mode

This commit is contained in:
Sameer Rahmani 2024-03-23 12:06:01 +00:00
parent e3f744ae8f
commit 8f2944e0e4
Signed by: lxsameer
GPG Key ID: 8741FACBF412FFA5
3 changed files with 81 additions and 55 deletions

View File

@ -26,6 +26,8 @@
(eval-when-compile (eval-when-compile
(require 'fpkg)) (require 'fpkg))
(require 'fg42/modeline)
;; (require 'fg42/utils) ;; (require 'fg42/utils)
;; (require 'fg42/modeline) ;; (require 'fg42/modeline)
;; (require 'fg42/cubes/modeline) ;; (require 'fg42/cubes/modeline)
@ -62,64 +64,71 @@ after enabling the minor mode if you enter ~C-x~ and wait for the default of
1 second the minibuffer will expand with all of the available key bindings 1 second the minibuffer will expand with all of the available key bindings
that follow ~C-x~ (or as many as space allows given your settings). that follow ~C-x~ (or as many as space allows given your settings).
This includes prefixes like ~C-x 8~ which are shown in a different face." This includes prefixes like ~C-x 8~ which are shown in a different face."
:init
(require 'which-key)
:config :config
(which-key-setup-side-window-bottom) (which-key-setup-side-window-bottom)
(which-key-mode)) (which-key-mode))
(use! projectile
"Projectile is a project interaction library for Emacs. Its goal is to provide
a nice set of features operating on a project level without introducing
external dependencies."
:hook (emacs-startup . projectile-mode)
:config
;; We don't want the auto discovery on startup
(setq projectile-auto-discover nil)
(setq projectile-enable-caching t)
:bind (:map projectile-mode-map
("s-p" . projectile-command-map)
("C-c p" . projectile-command-map)))
(use! projectile-ripgrep
"Use ripgrep with projectile"
:after projectile)
(use! helpful (use! helpful
"Helpful is an alternative to the built-in Emacs help that provides much more "Helpful is an alternative to the built-in Emacs help that provides much more
contextual information." contextual information."
:init :bind
(require 'helpful) (("C-h f" . helpful-callable)
:config ("C-h v" . helpful-variable)
(global-set-key (kbd "C-h f") #'helpful-callable) ("C-h k" . helpful-key)
(global-set-key (kbd "C-h v") #'helpful-variable) ("C-h x" . helpful-command)
(global-set-key (kbd "C-h k") #'helpful-key) ("C-c C-d" . helpful-at-point)))
(global-set-key (kbd "C-h x") #'helpful-command)
(global-set-key (kbd "C-c C-d") #'helpful-at-point))
(use! envrc (use! envrc
"Activate direnv whenever encounter a `.envrc' file" "Activate direnv whenever encounter a `.envrc' file"
:init :config
(require 'envrc)
(envrc-global-mode)) (envrc-global-mode))
(use! pinentry (use! pinentry
"Pinentry cube with setup the =pinentry= program to be used within FG42." "Pinentry cube with setup the =pinentry= program to be used within FG42."
:commands pinentry-start
:init :init
(progn (setq epa-pinentry-mode 'loopback))
(require 'pinentry)
(setq epa-pinentry-mode 'loopback)
(pinentry-start)))
(use! imenu-list (use! imenu-list
"his Emacs minor-mode creates an automatically updated buffer "his Emacs minor-mode creates an automatically updated buffer
called `Ilist' that is populated with the current buffer's imenu entries. called `Ilist' that is populated with the current buffer's imenu entries.
The `Ilist' buffer is typically shown as a sidebar (Emacs vertically splits the window)." The `Ilist' buffer is typically shown as a sidebar (Emacs vertically splits the window)."
:init :bind (("C-'" . imenu-list-smart-toggle)))
(global-set-key (kbd "C-'") #'imenu-list-smart-toggle))
(use! emojify (use! emojify
"Adds support for emojis to `FG42'" "Adds support for emojis to `FG42'"
:hook (after-init . global-emojify-mode)) :hook (emacs-startup . global-emojify-mode))
(use! discover (use! discover
"Adds support for the discover.el `https://github.com/mickeynp/discover.el'.") "Adds support for the discover.el `https://github.com/mickeynp/discover.el'.")
(use! exec-path-from-shell (use! exec-path-from-shell
"This package fixes the =exec-path-from-shell= issue on MacOS." "This package fixes the =exec-path-from-shell= issue on MacOS."
:init :config
(require 'exec-path-from-shell)
(when (memq window-system '(mac ns x)) (when (memq window-system '(mac ns x))
(exec-path-from-shell-initialize))) (exec-path-from-shell-initialize)))
(use! hl-line (use! hl-line
"Highlights the current line." "Highlights the current line."
:init :hook (emacs-startup . global-hl-line-mode))
(require 'hl-line)
(global-hl-line-mode))
(use! rainbow-delimiters (use! rainbow-delimiters
"rainbow-delimiters is a =rainbow parentheses= like mode which highlights delimiters "rainbow-delimiters is a =rainbow parentheses= like mode which highlights delimiters
@ -137,11 +146,6 @@ data. The typical example of this would be Lisp or Scheme source code."
(clojure-mode . paredit-mode) (clojure-mode . paredit-mode)
(scheme-mode . paredit-mode))) (scheme-mode . paredit-mode)))
(add-hook 'fg42/after-initializing-theme-hook
(lambda ()
(set-default 'cursor-type 'box)
(set-cursor-color "#eeeeec")))
(use! avy (use! avy
"This cube controls the different aspect of buffer navigation" "This cube controls the different aspect of buffer navigation"
:bind ("M-1" . avy-goto-word-1)) :bind ("M-1" . avy-goto-word-1))
@ -150,8 +154,6 @@ data. The typical example of this would be Lisp or Scheme source code."
"This cube controls the different aspect of buffer navigation" "This cube controls the different aspect of buffer navigation"
:bind ("C-<tab>" . ace-window)) :bind ("C-<tab>" . ace-window))
(fg42/setup-font)
(use! vertico (use! vertico
"Vertico provides a performant and minimalistic vertical completion UI "Vertico provides a performant and minimalistic vertical completion UI
based on the default completion system. The focus of Vertico is to provide based on the default completion system. The focus of Vertico is to provide
@ -185,11 +187,17 @@ match all of the components in any order."
(use! all-the-icons (use! all-the-icons
"A utility package to collect various Icon Fonts and propertize them within "A utility package to collect various Icon Fonts and propertize them within
Emacs.") Emacs."
:if (display-graphic-p))
;; In the following section we're setting some default behavior of FG42. ;; In the following section we're setting some default behavior of FG42.
;; Most of these configuration are opiniated and I think most of people ;; Most of these configuration are opiniated and I think most of people
;; shared the same opinion or don't care at all. ;; shared the same opinion or don't care at all.
(fg42/setup-font)
(add-hook 'fg42/after-initializing-theme-hook
(lambda ()
(set-default 'cursor-type 'bar)
(set-cursor-color "#eeeeec")))
;; Remove splash screen ;; Remove splash screen
(setq inhibit-splash-screen t) (setq inhibit-splash-screen t)

View File

@ -21,31 +21,53 @@
;; ;;
;;; Commentary: ;;; Commentary:
;;; Code: ;;; Code:
(eval-when-compile
(defvar fg42/modeline-setter #'fg42/default-mode-line-setter) (require 'fpkg))
(defmacro defmode-line (name &rest body) (defvar fg42/modeline-views nil
`(defun ,name () ,@body)) "A list of Noether views to use for modeline.")
;; The default modeline has to be nil to let the (defface fg42/-disabled-modeline-active-border
;; modeline setters know that they can use their '((t
;; default modeline :background "#bd93f9" :height 0.1 :box nil))
(defmode-line fg42/default-modeline) "A new face for modeline in active state."
:group 'fg42)
(defun fg42/default-mode-line-setter (def) (defface fg42/-disabled-modeline-dective-border
"Set the modeline definition in X to the `fg42-modeline'." '((t
(unless (null def) :background "#44475a" :height 0.1 :box nil))
(setq mode-line-format (plist-get def :brief)) "A new face for modeline in active state."
(setq mode-line-format (plist-get (fg42/default-modeline) :brief)))) :group 'fg42)
(defun fg42/setup-modeline-format (definition) (use! noether
"Setup the modeline by calling the setter function and passing the DEFINITION." "Smart mode line is a pretty simple yet fantastic alternative
(funcall fg42/modeline-setter definition)) to Emacs modeline."
:if (display-graphic-p)
:after projectile
:config
;;(require 'noether)
(require 'noether-views)
;; Disable the default modeline
(setq-default mode-line-format "")
(let ((face-remaps (default-value 'face-remapping-alist)))
(setf (alist-get 'mode-line face-remaps)
'fg42/-disabled-modeline-active-border
(alist-get 'mode-line-inactive face-remaps)
'fg42/-disabled-modeline-dective-border
(default-value 'face-remapping-alist) face-remaps))
(let ((vs (or fg42/modeline-views
(list
noether-minimal-mode-line
noether-minimal-location
noether-minimal-exwm))))
(setq noether-views vs)
(noether-global-mode)))
(provide 'fg42/modeline) (provide 'fg42/modeline)
;;; modeline.el ends here ;;; modeline.el ends here

View File

@ -24,20 +24,16 @@
;; Each system has to have a `start' function to start the setup process. ;; Each system has to have a `start' function to start the setup process.
;; ;;
;;; Code: ;;; Code:
(require 'fpkg) (eval-when-compile
(require 'fg42/flags) (require 'fpkg))
;;(fpkg/require 'projectile)
(fpkg/require 'f) (fpkg/require 'f)
(defflag fg42-project
"Enable the support for project files in FG42." t)
(defgroup fg42/project nil (defgroup fg42/project nil
"The customization group for the fg42-project-global-mode." "The customization group for the fg42-project-global-mode."
:group 'convenience) :group 'convenience)
(defvar fg42/visited-projects nil (defvar fg42/visited-projects nil
"A plist of all the visited projects. "A plist of all the visited projects.
It's mapping of project name to the project datastructure") It's mapping of project name to the project datastructure")