;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*- ;; ;; Copyright (c) 2010-2024 Sameer Rahmani & Contributors ;; ;; Author: Sameer Rahmani ;; URL: https://devheroes.codes/FG42/FG42 ;; Version: 3.0.0 ;; ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see . ;; ;;; Commentary: ;;; Code: (require 'server) (eval-when-compile (require 'fpkg)) ;; (require 'fg42/utils) ;; (require 'fg42/modeline) ;; (require 'fg42/cubes/modeline) ;; (require 'fg42/themes) ;; (require 'fg42/project) (defvar fg42/font '("Fira Mono" 12)) (defun fg42/setup-font () "Set the default font of `FG42' to FONT-NAME and FONT-SIZE." (let ((name (car fg42/font)) (size (cadr fg42/font))) (add-to-list 'default-frame-alist (cons 'font (format "%s-%d" name size))) (set-face-attribute 'default t :font name))) (defun fg42/setup-editor () "Setup the overall functionality of FG42." (use! origami "A text folding minor mode for Emacs." :bind (("C-c TAB" . origami-toggle-node)) :config (global-origami-mode t)) (use! which-key "which-key is a minor mode for Emacs that displays the key bindings following your currently entered incomplete command (a prefix) in a popup. For example, 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! 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)) (use! envrc "Activate direnv whenever encounter a `.envrc' file" :init (require 'envrc) (envrc-global-mode)) (use! pinentry "Pinentry cube with setup the =pinentry= program to be used within FG42." :init (progn (require 'pinentry) (setq epa-pinentry-mode 'loopback) (pinentry-start))) (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)) (use! emojify "Adds support for emojis to `FG42'" :hook (after-init . 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) (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)) (use! rainbow-delimiters "rainbow-delimiters is a =rainbow parentheses= like mode which highlights delimiters such as parentheses, brackets or braces according to their depth. Each successive level is highlighted in a different color. This makes it easy to spot matching delimiters, orient yourself in the code, and tell which statements are at a given depth." ;; It doesn't work due to a problem/conflict in rainbow-delimiters ;; But we use it any way they might fix it :hook (prog-mode . rainbow-delimiters-mode)) (use! paredit "`paredit' is a minor mode for performing structured editing of S-expression data. The typical example of this would be Lisp or Scheme source code." :hook ((emacs-lisp-mode . paredit-mode) (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)) (use! ace-window "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 a UI which behaves correctly under all circumstances." :config (vertico-mode) (setq vertico-count 10) (setq vertico-cycle t)) (use! orderless "This package provides an orderless completion style that divides the pattern into space-separated components, and matches candidates that match all of the components in any order." :init (setq completion-styles '(orderless basic) completion-category-defaults nil completion-category-overrides '((file (styles partial-completion))))) (use! savehist "Persist history over Emacs restarts. Vertico sorts by history position." :init (savehist-mode)) (when-not-wm (use! ctrlf "Single buffer text search." :config (ctrlf-mode +1))) (use! all-the-icons "A utility package to collect various Icon Fonts and propertize them within Emacs.") ;; 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. ;; Remove splash screen (setq inhibit-splash-screen t) ;; scratch should be scratch (setq initial-scratch-message nil) ;; Don't allow tab as indent (setq-default indent-tabs-mode nil) ;; Default indent width (setq tab-width 2) ;; Share the clipboard with X applications (setq x-select-enable-clipboard t) ;; Automatically removed excess backups of the file (setq delete-old-versions t) ;; Emacs 28 and newer: Hide commands in M-x which do not work in the current ;; mode. Vertico commands are hidden in normal buffers. This setting is ;; useful beyond Vertico. (setq read-extended-command-predicate #'command-completion-default-include-p) ;; Support opening new minibuffers from inside existing minibuffers. (setq enable-recursive-minibuffers t) ;; Global configurations (tool-bar-mode -1) (menu-bar-mode -1) (when (display-graphic-p) (scroll-bar-mode -1)) (column-number-mode t) (show-paren-mode t) (electric-pair-mode 1) ;; Rectangular select (cua-selection-mode t) ;; Yank the region on type (delete-selection-mode 1) (defalias 'yes-or-no-p 'y-or-n-p) ;; Hooks --- ;; Deletel extra trailing white spaces on save (add-hook 'before-save-hook 'delete-trailing-whitespace) ;; Enable rainbow-delimiters for programming (add-hook 'prog-mode-hook #'rainbow-delimiters-mode) ;; With this section we will have two emacs server running ;; this way we can interact with the wm via emacsclient as well (when (not (server-running-p)) (when-wm (setq server-name "fg42-wm")) (server-start))) (provide 'fg42/editor) ;;; editor.el ends here