Compare commits
11 Commits
70f14f5928
...
db5cee29d8
Author | SHA1 | Date |
---|---|---|
Sameer Rahmani | db5cee29d8 | |
Sameer Rahmani | 3bbd095f75 | |
Sameer Rahmani | 0c737c827f | |
Sameer Rahmani | 895294e1c0 | |
Sameer Rahmani | aea303fdb0 | |
Sameer Rahmani | 45e20f95bf | |
Sameer Rahmani | e17f16590d | |
Sameer Rahmani | 86699f34fb | |
Sameer Rahmani | 8f2944e0e4 | |
Sameer Rahmani | e3f744ae8f | |
Sameer Rahmani | 46f8869e1a |
|
@ -44,11 +44,11 @@
|
|||
"systems": "systems_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1709126324,
|
||||
"narHash": "sha256-q6EQdSeUZOG26WelxqkmR7kArjgWCdw5sfJVHPH/7j8=",
|
||||
"lastModified": 1710146030,
|
||||
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "d465f4819400de7c8d874d50b982301f28a84605",
|
||||
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
26
flake.nix
26
flake.nix
|
@ -28,6 +28,15 @@
|
|||
overlays = [ inputs.emacs-overlay.overlays.package ];
|
||||
};
|
||||
|
||||
test-x = pkgs.writeShellApplication {
|
||||
name = "test-x";
|
||||
runtimeInputs = [ pkgs.xorg.xorgserver ];
|
||||
|
||||
text = ''
|
||||
${pkgs.xorg.xorgserver.out}/bin/Xephyr -br -ac -noreset -screen 800x600 :1
|
||||
'';
|
||||
};
|
||||
|
||||
lemacs = pkgs.emacs29.override {
|
||||
# Gtk causes a flickering issue on WM mode
|
||||
withGTK3 = false;
|
||||
|
@ -49,6 +58,15 @@
|
|||
emacs = lemacs;
|
||||
};
|
||||
|
||||
run-test-wm = pkgs.writeShellApplication {
|
||||
name = "run-test-wm";
|
||||
runtimeInputs = [ fg42 ];
|
||||
|
||||
text = ''
|
||||
DISPLAY=:1 ${fg42}/bin/fg42-wm
|
||||
'';
|
||||
};
|
||||
|
||||
in {
|
||||
inherit pkgs;
|
||||
|
||||
|
@ -56,11 +74,11 @@
|
|||
packages.${system}.default = fg42;
|
||||
|
||||
devShells.default = pkgs.mkShell {
|
||||
nativeBuildInputs = [ fg42 pkgs.fish ];
|
||||
nativeBuildInputs = [ fg42 pkgs.fish test-x run-test-wm ];
|
||||
buildInputs = [ fg42 ];
|
||||
shellHook = ''
|
||||
fish && exit
|
||||
'';
|
||||
# shellHook = ''
|
||||
# fish && exit
|
||||
# '';
|
||||
};
|
||||
}
|
||||
);
|
||||
|
|
18
lisp/fg42.el
18
lisp/fg42.el
|
@ -65,6 +65,24 @@
|
|||
(setq fg42/initialized t))))
|
||||
|
||||
|
||||
(defun fg42/initialize-v4 ()
|
||||
"Initialize FG42 after the Emacs window is rendered by loading the user init file."
|
||||
;; (fg42/-startup-optimization)
|
||||
(require 'fg42/editor)
|
||||
|
||||
(when (file-exists-p user-init-file)
|
||||
(load user-init-file))
|
||||
|
||||
(fg42/setup-editor)
|
||||
|
||||
(add-hook 'emacs-startup-hook
|
||||
(lambda ()
|
||||
(run-hooks 'fg42/after-init-hook)
|
||||
(run-hooks 'fg42/after-initializing-theme-hook)
|
||||
(run-hooks 'fg42/ui-hook)
|
||||
(setq fg42/initialized t))))
|
||||
|
||||
|
||||
(defun fg42/-startup-optimization ()
|
||||
"Optimized FG42 startup."
|
||||
;; by setting gc threshold to the largest number
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2024 Sameer Rahmani & Contributors
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; 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 <http://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
(eval-when-compile
|
||||
(require 'fpkg))
|
||||
|
||||
|
||||
(use! company
|
||||
"Company is a modular text completion framework for GNU Emacs."
|
||||
:commands global-company-mode
|
||||
:bind (:map company-active-map
|
||||
("M-n" . company-select-next)
|
||||
("M-p" . company-select-previous)
|
||||
("TAB" . company-complete-common-or-cycle)
|
||||
("M-d" . company-show-doc-buffer))
|
||||
:init
|
||||
;; Use Company for completion
|
||||
(setq company-show-numbers t)
|
||||
(setq company-idle-delay 0)
|
||||
(setq company-tooltip-limit 20)
|
||||
(setq company-echo-delay 0)
|
||||
(setq company-tooltip-align-annotations t)
|
||||
(setq company-dabbrev-downcase nil)
|
||||
|
||||
:config
|
||||
(bind-key [remap completion-at-point] #'company-complete company-mode-map))
|
||||
|
||||
|
||||
(use! company-box
|
||||
"A company front-end with icons."
|
||||
:after company
|
||||
:hook (company-mode . company-box-mode))
|
||||
|
||||
|
||||
(provide 'fg42/autocomplete)
|
||||
;;; autocomplete.el ends here
|
|
@ -88,6 +88,11 @@ contextual information."
|
|||
(global-set-key (kbd "C-h x") #'helpful-command)
|
||||
(global-set-key (kbd "C-c C-d") #'helpful-at-point))
|
||||
|
||||
(->cube envrc
|
||||
"Activate direnv whenever encounter a `.envrc' file"
|
||||
:init
|
||||
(require 'envrc)
|
||||
(envrc-global-mode))
|
||||
|
||||
(defcube fg42/pinentry-cube
|
||||
"Pinentry cube with setup the =pinentry= program to be used within FG42."
|
||||
|
|
|
@ -24,8 +24,6 @@
|
|||
(require 'fpkg)
|
||||
(require 'fg42/cube)
|
||||
|
||||
|
||||
|
||||
(defcube fg42/elisp-cube
|
||||
"Elisp cube"
|
||||
:title "fg42/cubes/fg42/elisp-cube.org"
|
||||
|
|
|
@ -66,8 +66,6 @@
|
|||
ninja-mode
|
||||
eldoc-cmake
|
||||
cmake-mode
|
||||
pyenv-mode
|
||||
pyvenv
|
||||
poetry
|
||||
lsp-pyright
|
||||
python-black
|
||||
|
@ -94,8 +92,6 @@
|
|||
org-super-agenda
|
||||
org-ql
|
||||
ctrlf
|
||||
selectrum-prescient
|
||||
selectrum
|
||||
badwolf-theme
|
||||
ace-window
|
||||
avy
|
||||
|
@ -119,7 +115,12 @@
|
|||
exwm
|
||||
verilog-ext
|
||||
verilog-mode
|
||||
pkg-info)
|
||||
pkg-info
|
||||
envrc
|
||||
vertico
|
||||
orderless
|
||||
eglot
|
||||
)
|
||||
|
||||
(provide 'fg42/deps)
|
||||
;;; deps.el ends here
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (C) 2010-2024 Sameer Rahmani <lxsameer@gnu.org>
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; Keywords: lisp fg42 IDE package manager
|
||||
;; Version: 1.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 <http://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;; This file contains all the dependencies of FG42 v4 in no particular order.
|
||||
;; Whether we use a package during runtime or not we will build everything
|
||||
;; and decide what to load at runtime.
|
||||
;;
|
||||
;; We fetch these dependencies using Nix via the emacs-overlay.
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
|
||||
(provide 'fg42/direnv)
|
||||
;;; direnv.el ends here
|
|
@ -0,0 +1,346 @@
|
|||
;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2024 Sameer Rahmani & Contributors
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; 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 <http://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
(eval-when-compile
|
||||
(require 'fpkg)
|
||||
;; Language support
|
||||
(require 'fg42/autocomplete)
|
||||
(require 'fg42/langs/cpp)
|
||||
(require 'fg42/langs/verilog)
|
||||
(require 'fg42/langs/python)
|
||||
(require 'fg42/langs/elisp)
|
||||
(require 'fg42/langs/nix)
|
||||
(require 'fg42/wm))
|
||||
|
||||
(require 'server)
|
||||
(require 'fg42/modeline)
|
||||
|
||||
(defvar fg42/font '("Fira Mono" 12)
|
||||
"Font name and size to be used with FG42. (Default (\"Fira Mono\" 12).")
|
||||
|
||||
(defvar fg42/snippet-dir nil
|
||||
"Where to find user's snippets.")
|
||||
|
||||
|
||||
(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."
|
||||
: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! pkg-info
|
||||
"`pkg-info' integration.")
|
||||
|
||||
|
||||
(use! helpful
|
||||
"Helpful is an alternative to the built-in Emacs help that provides much more
|
||||
contextual information."
|
||||
: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"
|
||||
:config
|
||||
(envrc-global-mode))
|
||||
|
||||
(use! pinentry
|
||||
"Pinentry cube with setup the =pinentry= program to be used within FG42."
|
||||
:commands pinentry-start
|
||||
:init
|
||||
(setq epa-pinentry-mode 'loopback))
|
||||
|
||||
(use! imenu
|
||||
"The Imenu facility offers a way to find the major definitions in a file by name."
|
||||
:bind (("M-i" . imenu)))
|
||||
|
||||
(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)."
|
||||
:bind (("C-'" . imenu-list-smart-toggle)))
|
||||
|
||||
(use! emojify
|
||||
"Adds support for emojis to `FG42'"
|
||||
: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."
|
||||
:config
|
||||
(when (memq window-system '(mac ns x))
|
||||
(exec-path-from-shell-initialize)))
|
||||
|
||||
(use! hl-line
|
||||
"Highlights the current line."
|
||||
:hook (emacs-startup . 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)))
|
||||
|
||||
(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-<tab>" . ace-window))
|
||||
|
||||
|
||||
(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
|
||||
(require 'vertico-multiform)
|
||||
(require 'vertico-flat)
|
||||
(require 'vertico-grid)
|
||||
(require 'vertico-buffer)
|
||||
(require 'vertico-indexed)
|
||||
(require 'vertico-quick)
|
||||
(require 'vertico-repeat)
|
||||
(vertico-mode)
|
||||
(vertico-multiform-mode)
|
||||
;; Configure the display per command.
|
||||
;; Use a buffer with indices for imenu
|
||||
(setq vertico-multiform-commands
|
||||
'((imenu buffer indexed)))
|
||||
|
||||
;; Configure the display per completion category.
|
||||
;; Use the grid display for files and a buffer
|
||||
;; for the consult-grep commands.
|
||||
(setq vertico-multiform-categories
|
||||
'((file grid)))
|
||||
|
||||
(setq vertico-count 10)
|
||||
(setq vertico-cycle t)
|
||||
|
||||
(when-wm
|
||||
(setq vertico-multiform-commands
|
||||
'((t flat)))
|
||||
(setq vertico-multiform-categories
|
||||
'((file flat)))))
|
||||
|
||||
|
||||
(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
|
||||
;; Minibuffer related stuff
|
||||
|
||||
(use! ctrlf
|
||||
"Single buffer text search."
|
||||
:config
|
||||
(ctrlf-mode +1))
|
||||
|
||||
(use! display-line-numbers
|
||||
"The builtin replacement of linum. It's is pretty fast."
|
||||
:config
|
||||
(global-display-line-numbers-mode 1)))
|
||||
|
||||
(use! all-the-icons
|
||||
"A utility package to collect various Icon Fonts and propertize them within
|
||||
Emacs."
|
||||
:if (display-graphic-p))
|
||||
|
||||
(use! yasnippet
|
||||
"A Snippet is a template system for Emacs. "
|
||||
:config
|
||||
(let* ((snippet-home
|
||||
(expand-file-name
|
||||
"snippets"
|
||||
(file-name-directory (locate-library "yasnippet-snippets"))))
|
||||
(local-snippet (expand-file-name "snippets" fg42-home))
|
||||
(user-snippets (or fg42/snippet-dir local-snippet)))
|
||||
|
||||
(setq yas-snippet-dirs `(,user-snippets ,local-snippet ,snippet-home))
|
||||
(yas-global-mode 1)))
|
||||
|
||||
(use! yasnippet-snippets
|
||||
"Yasnippet's snippets."
|
||||
:after yasnippet)
|
||||
|
||||
;; Language Servers and friends
|
||||
(use! eglot
|
||||
"Eglot is a minimalistic yet powerful LSP replacement
|
||||
shipped with Emacs."
|
||||
:commands eglot
|
||||
:autoload eglot-ensure)
|
||||
|
||||
|
||||
(use! flycheck
|
||||
"Flycheck is a modern on-the-fly syntax checking extension for GNU Emacs."
|
||||
:config (global-flycheck-mode))
|
||||
|
||||
;; 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)
|
||||
;; 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)
|
||||
|
||||
(setq tooltip-use-echo-area t)
|
||||
(setq x-gtk-use-system-tooltips nil)
|
||||
|
||||
;; Global configurations
|
||||
(tool-bar-mode -1)
|
||||
(tooltip-mode nil)
|
||||
|
||||
(menu-bar-mode -1)
|
||||
(when (display-graphic-p)
|
||||
;; Smoother scrolling
|
||||
(pixel-scroll-precision-mode)
|
||||
(scroll-bar-mode -1))
|
||||
|
||||
(column-number-mode t)
|
||||
(show-paren-mode t)
|
||||
(electric-pair-mode 1)
|
||||
(global-company-mode)
|
||||
|
||||
;; 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))
|
||||
|
||||
(when-wm
|
||||
;; Activating the WM mode
|
||||
(exwm-enable)
|
||||
(exwm-systemtray-enable)
|
||||
(exwm-randr-enable)))
|
||||
|
||||
|
||||
(provide 'fg42/editor)
|
||||
;;; editor.el ends here
|
|
@ -0,0 +1,38 @@
|
|||
;;; ElispCube --- The elisp cube for FG42 -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2024 Sameer Rahmani & Contributors
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; 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 <http://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
(require 'fpkg)
|
||||
|
||||
|
||||
(defun fg42/setup-elisp ()
|
||||
"Setup the Emacs Lisp development environment."
|
||||
(use! eros
|
||||
:init
|
||||
(require 'eros)
|
||||
(eros-mode))
|
||||
|
||||
(add-hook 'emacs-lisp-mode-hook #'rainbow-delimiters-mode))
|
||||
|
||||
|
||||
(provide 'fg42/cubes/elisp)
|
||||
;;; elisp.el ends here
|
|
@ -40,7 +40,7 @@ Flags are defined using the \\[defflag] through out the source code.
|
|||
To see a list of available flags use \\[fg42/show-all-flags] and to see
|
||||
the documentation of each flag simply use \\[describe-flag]."
|
||||
:group 'fg42
|
||||
:package-version '(FG42 . "3.x")
|
||||
:package-version '(FG42 . "4.x")
|
||||
:type '(symbol)
|
||||
:tag "FG42 Flags")
|
||||
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2024 Sameer Rahmani & Contributors
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; 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 <http://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
|
||||
;; emacs --batch --eval=(require 'ox-texinfo) --eval=(find-file "README.org\") --eval=(org-texinfo-export-to-info)
|
||||
(require ox-texinfo)
|
||||
|
||||
(org-texinfo-export-to-info)
|
||||
|
||||
(defun build-manual ()
|
||||
"Build FG42's manual."
|
||||
(interactive)
|
||||
(with-temp-buffer
|
||||
(find-file (file-name-concat (expand-file-name fg42-home) "docs/fg42.org"))
|
||||
(org-texinfo-export-to-info)))
|
||||
|
||||
|
||||
(defun fg42-manual ()
|
||||
"Show FG42's manual."
|
||||
(interactive)
|
||||
;; TODO: move this to the init script
|
||||
(add-to-list 'Info-default-directory-list (file-name-concat (expand-file-name fg42-home) "docs/"))
|
||||
(info "(fg42)"))
|
||||
|
||||
(provide 'fg42/help)
|
||||
;;; help.el ends here
|
|
@ -25,23 +25,41 @@
|
|||
(when (string= (getenv "FG42_DEBUG") "1")
|
||||
(setq debug-on-error t))
|
||||
|
||||
|
||||
(eval-when-compile
|
||||
(defvar package-archives)
|
||||
(defvar use-package-ensure-function))
|
||||
|
||||
(defvar fg42-use-nix (or (getenv "FG42_USE_NIX") nil))
|
||||
|
||||
(defgroup fg42 nil
|
||||
"Customize your FG42 instance via this group of configurations.")
|
||||
|
||||
(defvar fg42/disabled-features nil
|
||||
"List of features to disable.")
|
||||
|
||||
(defvar fg42/after-init-hook nil
|
||||
"The hook tha runs when FG42 finished running the user configuration.")
|
||||
|
||||
(defvar fg42/debug-p nil
|
||||
"The hook tha runs when FG42 finished running the user configuration.")
|
||||
|
||||
(defvar fg42-home (or (getenv "FG42_HOME") "~/.fg42")
|
||||
"The pass to fg42-home.")
|
||||
|
||||
(defvar fg42-tmp (make-temp-file "fg42-" t))
|
||||
|
||||
|
||||
|
||||
(add-to-list 'load-path (concat (getenv "FG42_HOME") "/lisp"))
|
||||
|
||||
;; (when fg42-use-nix
|
||||
;; (require 'site-start))
|
||||
(add-to-list 'load-path (concat (getenv "FG42_HOME") "/lisp"))
|
||||
|
||||
;; Prevent package.el to install anything at startup
|
||||
(setq package-enable-at-startup nil)
|
||||
(setq package-archives nil)
|
||||
|
||||
(when fg42-use-nix
|
||||
(setq use-package-ensure-function 'ignore))
|
||||
|
||||
(setq use-package-ensure-function 'ignore)
|
||||
(setq tab-width 2)
|
||||
|
||||
(let ((emacsd (or (getenv "FG42_EMACSD") (format "%s/emacs.d" (getenv "FG42_HOME")))))
|
||||
|
@ -49,16 +67,18 @@
|
|||
(setq user-emacs-directory emacsd)
|
||||
(setq user-init-file
|
||||
(or (getenv "FG42_CONFIG_FILE")
|
||||
(format "%s/.fg42.el"
|
||||
(format "%s/.fg42.v4.el"
|
||||
(getenv "HOME")))))
|
||||
|
||||
|
||||
;; Load the customization file. In FG42 it is different than
|
||||
;; the default `user-init-file'
|
||||
(if (file-exists-p custom-file)
|
||||
(load custom-file))
|
||||
|
||||
|
||||
(require 'fg42)
|
||||
(fg42/initialize)
|
||||
(fg42/initialize-v4)
|
||||
|
||||
(provide 'fg42/init)
|
||||
;;; init.el ends here
|
||||
|
|
|
@ -0,0 +1,91 @@
|
|||
;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2024 Sameer Rahmani & Contributors
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; 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 <http://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
(eval-when-compile
|
||||
(require 'fpkg))
|
||||
|
||||
(defvar fg42/clangd-args
|
||||
(list
|
||||
(format "-j=%s" (- (num-processors) 2))
|
||||
"--clang-tidy"
|
||||
"--header-insertion=iwyu"
|
||||
"--pch-storage=memory"
|
||||
"--background-index"
|
||||
"--cross-file-rename"
|
||||
"--completion-style=detailed")
|
||||
"Arguments to pass to clangd.")
|
||||
|
||||
(use! cmake-ts-mode
|
||||
"Enable cmake-ts-mode instead of the non-TS version.")
|
||||
|
||||
(use! eldoc-cmake
|
||||
"ElDoc and cmake integration"
|
||||
:hook (cmake-ts-mode . eldoc-cmake-enable))
|
||||
|
||||
|
||||
(use! ninja-mode
|
||||
"This cube enables Ninja integration with FG42. For more info checkout:
|
||||
https://github.com/ninja-build/ninja/blob/master/misc/ninja-mode.el")
|
||||
|
||||
|
||||
(defun fg42/c_cpp_ls (_)
|
||||
"Return the proper lang server fo C/C++.
|
||||
By default it will return `clangd' or `ccls' depends on what you have
|
||||
installed. If you set `CPP_LS' env variable, then the value of that
|
||||
var will be used instead. You can use `add-advice' to change the
|
||||
return value of this function as well."
|
||||
(let ((ls (getenv "CPP_LS")))
|
||||
(if (null ls)
|
||||
(eglot-alternatives `(("clangd" ,@fg42/clangd-args) ("ccls")))
|
||||
(split-string ls " "))))
|
||||
|
||||
|
||||
(defun fg42/c-ts-mode-setup ()
|
||||
"A hook handler to setup cpp related configurations."
|
||||
(message "[FG42][C/C++]: Make sure to setup clangd to fit your needs. For more info: https://clangd.llvm.org/config")
|
||||
(setq-local company-backends
|
||||
'((company-capf :with company-yasnippet) :separate
|
||||
(company-keywords company-dabbrev company-ispell) :separate
|
||||
company-files))
|
||||
;; We set eglot's autoload command to `eglot-ensure'
|
||||
(eglot-ensure)
|
||||
(add-to-list 'eglot-server-programs
|
||||
`(c++-ts-mode . ,#'fg42/c_cpp_ls)))
|
||||
|
||||
|
||||
(use! c-ts-mode
|
||||
"C++ setup. We're using treesitter version of c++ mode."
|
||||
:init
|
||||
;; Remap the standard C/C++ modes
|
||||
(add-to-list 'major-mode-remap-alist '(c-mode . c-ts-mode))
|
||||
(add-to-list 'major-mode-remap-alist '(c++-mode . c++-ts-mode))
|
||||
(add-to-list 'major-mode-remap-alist '(c-or-c++-mode . c-or-c++-ts-mode))
|
||||
|
||||
:hook
|
||||
(c++-ts-mode . company-mode)
|
||||
(c++-ts-mode . fg42/c-ts-mode-setup)
|
||||
(c++-ts-mode . flyspell-prog-mode))
|
||||
|
||||
|
||||
(provide 'fg42/langs/cpp)
|
||||
;;; cpp.el ends here
|
|
@ -0,0 +1,41 @@
|
|||
;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2024 Sameer Rahmani & Contributors
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; 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 <http://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
(eval-when-compile
|
||||
(require 'fpkg))
|
||||
|
||||
|
||||
(use! eros
|
||||
"Evaluation Result OverlayS for Emacs Lisp."
|
||||
:commands eros-mode)
|
||||
|
||||
(use! emacs-lisp-mode
|
||||
"Elisp mode."
|
||||
:hook (emacs-lisp . rainbow-delimiters)
|
||||
:hook (emacs-lisp . paredit-mode)
|
||||
:hook (emacs-lisp . company-mode)
|
||||
:hook (emacs-lisp . eros-mode))
|
||||
|
||||
|
||||
(provide 'fg42/langs/elisp)
|
||||
;;; elisp.el ends here
|
|
@ -1,4 +1,4 @@
|
|||
;;; Flags --- Flags library of FG42 -*- lexical-binding: t; -*-
|
||||
;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2024 Sameer Rahmani & Contributors
|
||||
;;
|
||||
|
@ -21,10 +21,16 @@
|
|||
;;
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
(eval-when-compile
|
||||
(require 'fpkg))
|
||||
|
||||
(require 'fg42/flags)
|
||||
(use! nix-mode
|
||||
"Nix language support for Emacs."
|
||||
:mode "\\.nix\\'"
|
||||
:hook
|
||||
(nix-mode . eglot-ensure)
|
||||
(nix-mode . company-mode)
|
||||
(nix-mode . flyspell-prog-mode))
|
||||
|
||||
|
||||
|
||||
(provide 'lang-servers)
|
||||
;;; lang-servers.el ends here
|
||||
(provide 'fg42/langs/nix)
|
||||
;;; nix.el ends here
|
|
@ -0,0 +1,60 @@
|
|||
;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2024 Sameer Rahmani & Contributors
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; 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 <http://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
(eval-when-compile
|
||||
(require 'fpkg))
|
||||
|
||||
|
||||
(use! python-black
|
||||
"This cube reformats python code using black formatter tool."
|
||||
:commands (python-black-on-save-mode
|
||||
python-black-buffer
|
||||
python-black-region
|
||||
python-black-statement)
|
||||
:hook (python-mode . python-black-on-save-mode))
|
||||
|
||||
|
||||
(use! poetry
|
||||
"Poetry support for FG42. To use it, just use `M-x poetry'."
|
||||
:config
|
||||
(setq poetry-tracking-strategy 'switch-buffer)
|
||||
:hook (python-mode . poetry-tracking-mode))
|
||||
|
||||
|
||||
(use! python-ts-mode
|
||||
"Python setup. We're using treesitter version of python mode."
|
||||
:init
|
||||
;; Remap the standard python mode
|
||||
(add-to-list 'major-mode-remap-alist '(python-mode . python-ts-mode))
|
||||
|
||||
:config
|
||||
(setq python-indent-guess-indent-offset-verbose nil)
|
||||
|
||||
:hook
|
||||
(python-ts-mode . eglot-ensure)
|
||||
(python-ts-mode . company-mode)
|
||||
(python-ts-mode . flyspell-prog-mode))
|
||||
|
||||
|
||||
(provide 'fg42/langs/python)
|
||||
;;; python.el ends here
|
|
@ -0,0 +1,64 @@
|
|||
;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2024 Sameer Rahmani & Contributors
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; 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 <http://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
(eval-when-compile
|
||||
(require 'fpkg))
|
||||
|
||||
|
||||
(use! verilog-mode
|
||||
"Add support for verilog and system verilog to FG42. More info at
|
||||
https://www.veripool.org/verilog-mode/")
|
||||
|
||||
(use! verilog-ext
|
||||
"This package provides useful extensions on top of `verilog-mode' and `verilog-ts-mode'."
|
||||
:hook (verilog-mode . verilog-ext-mode)
|
||||
:init
|
||||
(setq verilog-ext-eglot-default-server 've-svls)
|
||||
(setq verilog-ext-feature-list
|
||||
'(font-lock
|
||||
xref
|
||||
capf
|
||||
hierarchy
|
||||
eglot
|
||||
lsp
|
||||
flycheck
|
||||
beautify
|
||||
navigation
|
||||
template
|
||||
formatter
|
||||
compilation
|
||||
imenu
|
||||
which-func
|
||||
hideshow
|
||||
typedefs
|
||||
time-stamp
|
||||
block-end-comments
|
||||
ports))
|
||||
:config
|
||||
(setq verilog-ext-eglot-default-server 've-svls)
|
||||
(verilog-ext-eglot-set-server 've-svls)
|
||||
(verilog-ext-mode-setup))
|
||||
|
||||
|
||||
(provide 'fg42/langs/verilog)
|
||||
;;; verilog.el ends here
|
|
@ -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
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -111,6 +111,5 @@ OPTS:
|
|||
;;(kill-process process)
|
||||
))))))
|
||||
|
||||
|
||||
(provide 'fg42/shell)
|
||||
;;; ssh.el ends here
|
||||
;;; shell.el ends here
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
;; way. Cubes are composable and a composition of cubes creates an editor.
|
||||
;;
|
||||
;;; Code:
|
||||
(eval-when-compile
|
||||
(require 'fpkg))
|
||||
(require 'fg42/utils)
|
||||
|
||||
(defvar fg42/ui-hook ()
|
||||
|
@ -46,5 +48,45 @@ It executes way before the rest of the cubes.")
|
|||
,@body))
|
||||
|
||||
|
||||
(defmacro use-theme! (name &rest body)
|
||||
"Create a function to setup a them with the given NAME and BODY to customize it."
|
||||
(declare (indent defun))
|
||||
(let ((fn-name (intern (format "fg42/setup-%s" (symbol-name name)))))
|
||||
`(defun ,fn-name ()
|
||||
(use! ,name
|
||||
"Setting up the ,name package."
|
||||
:init
|
||||
(fg42/setup-theme
|
||||
(require ',name)
|
||||
,@body)))))
|
||||
|
||||
|
||||
(use-theme! dracula-theme
|
||||
:init
|
||||
(fg42/setup-theme
|
||||
(require 'dracula-theme)
|
||||
(load-theme 'dracula t)
|
||||
(custom-theme-set-faces
|
||||
'dracula
|
||||
'(match ((t (:background "#44475a"))))
|
||||
'(all-the-icons-lgreen ((t (:background "#bd93f9"))))
|
||||
'(all-the-icons-faicon ((t (:background "#bd93f9"))))
|
||||
'(font-lock-comment-face ((t (:foreground "#8B9298"))))
|
||||
;; This fixes lsp-ui-sideline issue
|
||||
'(lsp-ui-sideline-current-symbol ((t (:line-width -1 :foreground "#bd93f9"))))
|
||||
'(font-lock-comment-delimiter-face ((t (:foreground "#5B6268")))))
|
||||
(enable-theme 'dracula)
|
||||
(set-face-attribute 'region nil :background "#888")))
|
||||
|
||||
|
||||
(use-theme! badwolf-theme
|
||||
:init
|
||||
(fg42/setup-theme
|
||||
(load-theme 'badwolf t)
|
||||
(custom-theme-set-faces
|
||||
'badwolf)
|
||||
(enable-theme 'badwolf)))
|
||||
|
||||
|
||||
(provide 'fg42/themes)
|
||||
;;; themes.el ends here
|
||||
|
|
|
@ -0,0 +1,173 @@
|
|||
;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*-
|
||||
;;
|
||||
;; Copyright (c) 2010-2024 Sameer Rahmani & Contributors
|
||||
;;
|
||||
;; Author: Sameer Rahmani <lxsameer@gnu.org>
|
||||
;; 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 <http://www.gnu.org/licenses/>.
|
||||
;;
|
||||
;;; Commentary:
|
||||
;;; Code:
|
||||
(eval-when-compile
|
||||
(require 'fpkg))
|
||||
|
||||
|
||||
(defvar workspace-configuration
|
||||
'(0 "HDMI-1"
|
||||
1 "HDMI-1"
|
||||
2 "HDMI-1"
|
||||
3 "HDMI-1"
|
||||
4 "HDMI-1"
|
||||
5 "HDMI-1"
|
||||
6 "HDMI-1"
|
||||
7 "HDMI-1"
|
||||
8 "HDMI-1"
|
||||
9 "HDMI-1")
|
||||
"Workspace configuration for EXWM. (default 10 screens on HDMI-1).")
|
||||
|
||||
;; TODO: Document this
|
||||
;; (add-hook 'exwm-randr-screen-change-hook
|
||||
;; (lambda ()
|
||||
;; (start-process-shell-command
|
||||
;; "xrandr" nil "xrandr --output HDMI-1 --above eDP-1 --mode 1920x1080")))
|
||||
|
||||
|
||||
(when-wm
|
||||
(use! exwm-randr
|
||||
"EXWM plugin to interact with xrandr."
|
||||
:commands exwm-randr-enable
|
||||
:config
|
||||
(setq exwm-randr-workspace-output-plist workspace-configuration))
|
||||
|
||||
|
||||
(use! exwm-systemtray
|
||||
"Enables systemtray on EXWM"
|
||||
:commands exwm-systemtray-enable)
|
||||
|
||||
|
||||
;; (use! mini-frame
|
||||
;; "Place minibuffer at the top of the current frame on `read-from-minibuffer'."
|
||||
;; :hook (emacs-startup . mini-frame-mode)
|
||||
;; :custom
|
||||
;; (mini-frame-show-parameters
|
||||
;; '((top . 10)
|
||||
;; (width . 0.5)
|
||||
;; (left . 0.5)
|
||||
;; (height . 15))))
|
||||
|
||||
|
||||
(use! exwm
|
||||
"Emacs X Widnow manager."
|
||||
:commands exwm-enable
|
||||
:config
|
||||
(require 'exwm-config)
|
||||
(exwm-config-ido)
|
||||
|
||||
;; Set the initial number of workspaces (they can also be created later).
|
||||
(setq exwm-workspace-number 10)
|
||||
;; All buffers created in EXWM mode are named "*EXWM*". You may want to
|
||||
;; change it in `exwm-update-class-hook' and `exwm-update-title-hook', which
|
||||
;; are run when a new X window class name or title is available. Here's
|
||||
;; some advice on this topic:
|
||||
;; + Always use `exwm-workspace-rename-buffer` to avoid naming conflict.
|
||||
;; + For applications with multiple windows (e.g. GIMP), the class names of
|
||||
;; all windows are probably the same. Using window titles for them makes
|
||||
;; more sense.
|
||||
;; In the following example, we use class names for all windows except for
|
||||
;; Java applications and GIMP.
|
||||
(add-hook 'exwm-update-class-hook
|
||||
(lambda ()
|
||||
(unless (or (string-prefix-p "sun-awt-X11-" exwm-instance-name)
|
||||
(string= "gimp" exwm-instance-name))
|
||||
(exwm-workspace-rename-buffer exwm-class-name))))
|
||||
|
||||
(add-hook 'exwm-update-title-hook
|
||||
(lambda ()
|
||||
(when (or (not exwm-instance-name)
|
||||
(string-prefix-p "sun-awt-X11-" exwm-instance-name)
|
||||
(string= "gimp" exwm-instance-name))
|
||||
(exwm-workspace-rename-buffer exwm-title))))
|
||||
|
||||
;; Global keybindings can be defined with `exwm-input-global-keys'.
|
||||
;; Here are a few examples:
|
||||
(setq exwm-input-global-keys
|
||||
`(
|
||||
;; Bind "s-r" to exit char-mode and fullscreen mode.
|
||||
([?\s-r] . exwm-reset)
|
||||
([?\s-g] . keyboard-quit)
|
||||
([8388640] . other-window)
|
||||
;; Bind "s-w" to switch workspace interactively.
|
||||
([?\s-w] . exwm-workspace-switch)
|
||||
;; Bind "s-0" to "s-9" to switch to a workspace by its index.
|
||||
,@(mapcar (lambda (i)
|
||||
`(,(kbd (format "s-%d" i)) .
|
||||
(lambda ()
|
||||
(interactive)
|
||||
(exwm-workspace-switch-create ,i))))
|
||||
(number-sequence 0 9))
|
||||
;; Bind "s-&" to launch applications ('M-&' also works if the output
|
||||
;; buffer does not bother you).
|
||||
([?\s-d] . (lambda (command)
|
||||
(interactive (list (read-shell-command "$ ")))
|
||||
(start-process-shell-command command nil command)))
|
||||
;; Bind "s-<f2>" to "slock", a simple X display locker.
|
||||
([s-f2] . (lambda ()
|
||||
(interactive)
|
||||
(start-process "" nil "slock")))))
|
||||
|
||||
;; To add a key binding only available in line-mode, simply define it in
|
||||
;; `exwm-mode-map'. The following example shortens 'C-c q' to 'C-q'.
|
||||
(define-key exwm-mode-map [?\C-q] #'exwm-input-send-next-key)
|
||||
|
||||
(push ?\C-c exwm-input-prefix-keys)
|
||||
|
||||
;; You can hide the minibuffer and echo area when they're not used, by
|
||||
;; uncommenting the following line.
|
||||
;;(setq exwm-workspace-minibuffer-position 'bottom)
|
||||
|
||||
;; The following example demonstrates how to use simulation keys to mimic
|
||||
;; the behavior of Emacs. The value of `exwm-input-simulation-keys` is a
|
||||
;; list of cons cells (SRC . DEST), where SRC is the key sequence you press
|
||||
;; and DEST is what EXWM actually sends to application. Note that both SRC
|
||||
;; and DEST should be key sequences (vector or string).
|
||||
(setq exwm-input-simulation-keys
|
||||
`(
|
||||
;; movement
|
||||
(,(kbd "C-b") . left)
|
||||
(,(kbd "M-b") . ,(kbd "C-<left>"))
|
||||
(,(kbd "C-f") . right)
|
||||
(,(kbd "M-f") . ,(kbd "C-<right>"))
|
||||
(,(kbd "C-p") . up)
|
||||
(,(kbd "C-n") . down)
|
||||
(,(kbd "C-a") . home)
|
||||
(,(kbd "C-e") . end)
|
||||
(,(kbd "M-v") . prior)
|
||||
(,(kbd "C-v") . next)
|
||||
(,(kbd "C-d") . delete)
|
||||
;;(,(kbs "C-k") . [S-end delete])
|
||||
;; navigation
|
||||
(,(kbd "C-c b") . ,(kbd "M-<left>"))
|
||||
(,(kbd "C-c f") . ,(kbd "M-<right>"))
|
||||
(,(kbd "C-c w") . ,(kbd "C-w"))
|
||||
(,(kbd "C-w") . ,(kbd "C-x"))
|
||||
(,(kbd "M-w") . ,(kbd "C-c"))
|
||||
(,(kbd "C-y") . ,(kbd "C-v"))
|
||||
;; search
|
||||
(,(kbd "C-s") . ,(kbd "C-f"))))))
|
||||
|
||||
|
||||
(provide 'fg42/wm)
|
||||
;;; wm.el ends here
|
48
lisp/fpkg.el
48
lisp/fpkg.el
|
@ -24,54 +24,46 @@
|
|||
;; Simple package manager for FG42
|
||||
;;
|
||||
;;; Code:
|
||||
|
||||
(require 'map)
|
||||
|
||||
(defvar package-names ())
|
||||
|
||||
(eval-when-compile
|
||||
(defvar fg42-use-nix)) ;; defined in fg42-config.el
|
||||
|
||||
(defun inject-straight (args)
|
||||
"Inject `:straight t' to ARGS it the key was missing."
|
||||
(if fg42-use-nix
|
||||
;; We don't use straight with nix
|
||||
(map-delete args :straight)
|
||||
(if (member :straight args)
|
||||
args
|
||||
(append args '(:straight t)))))
|
||||
(defvar fg42/disabled-features '())
|
||||
(require 'use-package))
|
||||
|
||||
|
||||
(defun inject-params (args)
|
||||
"Inject required `use-package' params to ARGS if the key is missing."
|
||||
(if fg42-use-nix
|
||||
(append '(:ensure nil) args)
|
||||
;; (if (member :defer args)
|
||||
;; args
|
||||
;; (append args '(:defer t)))
|
||||
args))
|
||||
;; (if (member :defer args)
|
||||
;; (append '(:ensure nil) args)
|
||||
(append args '(:ensure nil)))
|
||||
|
||||
|
||||
(defmacro fpkg/use (pkg &rest details)
|
||||
"Install the given package DETAILS PKG via `use-package' and straight."
|
||||
(declare (indent defun))
|
||||
(if (and (listp details) (< 0 (length details)))
|
||||
(let ((p (inject-straight (inject-params details))))
|
||||
`(progn
|
||||
(use-package ,pkg ,@p)))
|
||||
(let ((p (inject-params details)))
|
||||
`(progn
|
||||
(use-package ,pkg ,@p)))
|
||||
`(progn
|
||||
(use-package ,pkg :defer t :ensure nil))))
|
||||
|
||||
|
||||
(defmacro fpkg/require (pkg)
|
||||
"Work like require but make sure that PKG is installed first."
|
||||
(defmacro use! (pkg docs &rest details)
|
||||
"Loading the given package DETAILS PKG via `use-package'.
|
||||
|
||||
DOCS is the documentation of the package."
|
||||
(declare (indent defun) (doc-string 2))
|
||||
|
||||
(when (not (stringp docs))
|
||||
(error "Missing docstring for '%s' package" pkg))
|
||||
|
||||
(let ((disabled (or (member pkg fg42/disabled-features) nil)))
|
||||
(when (not disabled)
|
||||
`(use-package ,pkg ,@details))))
|
||||
|
||||
(let ((pkg-name (intern (symbol-name `,(cadr pkg)))))
|
||||
(if fg42-use-nix
|
||||
`(require ,pkg)
|
||||
`(fpkg/use ,pkg-name
|
||||
:init
|
||||
(require ,pkg)))))
|
||||
|
||||
(provide 'fpkg)
|
||||
;;; fpkg.el ends here
|
||||
|
|
20
nix/fg42.nix
20
nix/fg42.nix
|
@ -23,6 +23,9 @@
|
|||
ourPackages,
|
||||
writeText,
|
||||
symlinkJoin,
|
||||
direnv,
|
||||
nix,
|
||||
nil, # nix lsp server
|
||||
|
||||
# python deps
|
||||
python311,
|
||||
|
@ -37,14 +40,16 @@
|
|||
vazir-fonts,
|
||||
fira-code,
|
||||
nerdfonts,
|
||||
noto-fonts,
|
||||
gcc,
|
||||
ltex-ls,
|
||||
bash,
|
||||
tree-sitter,
|
||||
|
||||
supportWM ? true,
|
||||
xorg,
|
||||
|
||||
xorg,
|
||||
slock,
|
||||
|
||||
supportPython ? true,
|
||||
|
||||
supportVerilog ? true,
|
||||
|
@ -71,6 +76,9 @@ let
|
|||
git
|
||||
ltex-ls
|
||||
tree-sitter
|
||||
direnv
|
||||
nix
|
||||
nil
|
||||
] ++ (lib.optional supportPython [
|
||||
python311
|
||||
# Python deps
|
||||
|
@ -82,8 +90,11 @@ let
|
|||
python3Packages.flake8
|
||||
]) ++ (lib.optional supportVerilog [
|
||||
svls
|
||||
]) ++ (lib.optional (supportVerilog && stdenv.isLinux) [
|
||||
# SystemC is required by verilator that at the
|
||||
# moment is only available on Linux
|
||||
verilator
|
||||
]) ++ (lib.optional supportWM [
|
||||
]) ++ (lib.optional (supportWM && stdenv.isLinux) [
|
||||
# Window manager supports works on Linux only
|
||||
xorg.xhost
|
||||
]);
|
||||
|
@ -102,8 +113,10 @@ in stdenv.mkDerivation (final: rec{
|
|||
LISPDIR=$out/share/fg42/
|
||||
mkdir -p $out/bin
|
||||
install -d $LISPDIR
|
||||
|
||||
cp -rv ${src}/lisp/ $LISPDIR
|
||||
cp -rv ${src}/share $out/
|
||||
cp -rv ${src}/snippets $LISPDIR/snippets
|
||||
|
||||
runHook preBuild
|
||||
|
||||
|
@ -166,6 +179,7 @@ in stdenv.mkDerivation (final: rec{
|
|||
${vazir-fonts}
|
||||
${fira-code}
|
||||
${nerdfonts}
|
||||
${noto-fonts}
|
||||
${lib.strings.concatLines paths}
|
||||
EOF
|
||||
|
||||
|
|
Loading…
Reference in New Issue