diff --git a/lisp/fg42/editor.el b/lisp/fg42/editor.el index d8259ca..47db633 100644 --- a/lisp/fg42/editor.el +++ b/lisp/fg42/editor.el @@ -26,6 +26,8 @@ (eval-when-compile (require 'fpkg)) +(require 'fg42/modeline) + ;; (require 'fg42/utils) ;; (require 'fg42/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 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." - :init - (require 'which-key) :config (which-key-setup-side-window-bottom) (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 "Helpful is an alternative to the built-in Emacs help that provides much more contextual information." - :init - (require 'helpful) - :config - (global-set-key (kbd "C-h f") #'helpful-callable) - (global-set-key (kbd "C-h v") #'helpful-variable) - (global-set-key (kbd "C-h k") #'helpful-key) - (global-set-key (kbd "C-h x") #'helpful-command) - (global-set-key (kbd "C-c C-d") #'helpful-at-point)) + :bind + (("C-h f" . helpful-callable) + ("C-h v" . helpful-variable) + ("C-h k" . helpful-key) + ("C-h x" . helpful-command) + ("C-c C-d" . helpful-at-point))) (use! envrc "Activate direnv whenever encounter a `.envrc' file" - :init - (require 'envrc) + :config (envrc-global-mode)) (use! pinentry "Pinentry cube with setup the =pinentry= program to be used within FG42." + :commands pinentry-start :init - (progn - (require 'pinentry) - (setq epa-pinentry-mode 'loopback) - (pinentry-start))) + (setq epa-pinentry-mode 'loopback)) (use! imenu-list "his Emacs minor-mode creates an automatically updated buffer 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)." - :init - (global-set-key (kbd "C-'") #'imenu-list-smart-toggle)) + :bind (("C-'" . imenu-list-smart-toggle))) (use! emojify "Adds support for emojis to `FG42'" - :hook (after-init . global-emojify-mode)) + :hook (emacs-startup . global-emojify-mode)) (use! discover "Adds support for the discover.el `https://github.com/mickeynp/discover.el'.") (use! exec-path-from-shell "This package fixes the =exec-path-from-shell= issue on MacOS." - :init - (require 'exec-path-from-shell) + :config (when (memq window-system '(mac ns x)) (exec-path-from-shell-initialize))) (use! hl-line "Highlights the current line." - :init - (require 'hl-line) - (global-hl-line-mode)) + :hook (emacs-startup . global-hl-line-mode)) (use! rainbow-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) (scheme-mode . paredit-mode))) - (add-hook 'fg42/after-initializing-theme-hook - (lambda () - (set-default 'cursor-type 'box) - (set-cursor-color "#eeeeec"))) - (use! avy "This cube controls the different aspect of buffer navigation" :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" :bind ("C-" . ace-window)) - (fg42/setup-font) - (use! vertico "Vertico provides a performant and minimalistic vertical completion UI 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 "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. ;; Most of these configuration are opiniated and I think most of people ;; 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 (setq inhibit-splash-screen t) diff --git a/lisp/fg42/modeline.el b/lisp/fg42/modeline.el index 1336f09..9dc41ff 100644 --- a/lisp/fg42/modeline.el +++ b/lisp/fg42/modeline.el @@ -21,31 +21,53 @@ ;; ;;; Commentary: ;;; Code: - -(defvar fg42/modeline-setter #'fg42/default-mode-line-setter) +(eval-when-compile + (require 'fpkg)) -(defmacro defmode-line (name &rest body) - `(defun ,name () ,@body)) +(defvar fg42/modeline-views nil + "A list of Noether views to use for modeline.") -;; The default modeline has to be nil to let the -;; modeline setters know that they can use their -;; default modeline -(defmode-line fg42/default-modeline) +(defface fg42/-disabled-modeline-active-border + '((t + :background "#bd93f9" :height 0.1 :box nil)) + "A new face for modeline in active state." + :group 'fg42) -(defun fg42/default-mode-line-setter (def) - "Set the modeline definition in X to the `fg42-modeline'." - (unless (null def) - (setq mode-line-format (plist-get def :brief)) - (setq mode-line-format (plist-get (fg42/default-modeline) :brief)))) +(defface fg42/-disabled-modeline-dective-border + '((t + :background "#44475a" :height 0.1 :box nil)) + "A new face for modeline in active state." + :group 'fg42) -(defun fg42/setup-modeline-format (definition) - "Setup the modeline by calling the setter function and passing the DEFINITION." - (funcall fg42/modeline-setter definition)) +(use! noether + "Smart mode line is a pretty simple yet fantastic alternative +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) ;;; modeline.el ends here diff --git a/lisp/fg42/project.el b/lisp/fg42/project.el index 7f659e9..5f7cf8d 100644 --- a/lisp/fg42/project.el +++ b/lisp/fg42/project.el @@ -24,20 +24,16 @@ ;; Each system has to have a `start' function to start the setup process. ;; ;;; Code: -(require 'fpkg) -(require 'fg42/flags) - -;;(fpkg/require 'projectile) +(eval-when-compile + (require 'fpkg)) (fpkg/require 'f) -(defflag fg42-project - "Enable the support for project files in FG42." t) - (defgroup fg42/project nil "The customization group for the fg42-project-global-mode." :group 'convenience) + (defvar fg42/visited-projects nil "A plist of all the visited projects. It's mapping of project name to the project datastructure")