Compare commits
3 Commits
09a545edc1
...
fb3073ca19
Author | SHA1 | Date |
---|---|---|
Sameer Rahmani | fb3073ca19 | |
Sameer Rahmani | d1e00e67d7 | |
Sameer Rahmani | b8e23dcb61 |
|
@ -0,0 +1,52 @@
|
|||
# Fg42 - Emacs Editor for advance users
|
||||
#
|
||||
# Copyright (c) 2010-2024 Sameer Rahmani <lxsameer@gnu.org>
|
||||
#
|
||||
# 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, version 2.
|
||||
#
|
||||
# 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/>.
|
||||
|
||||
# This is the home manager module that exposes FG42. It differs
|
||||
# from FG42 modules that are structurally the same but used in
|
||||
# different context
|
||||
|
||||
# A list of default FG42 modules to build FG42 with.
|
||||
{ lib, config, pkgs, makeFG42Drv, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.fg42.c-family;
|
||||
|
||||
deps =
|
||||
(with pkgs.emacsPackages; [
|
||||
eldoc-cmake
|
||||
ninja-mode
|
||||
]);
|
||||
|
||||
drv = makeFG42Drv {
|
||||
pname = "c-family";
|
||||
version = config.fg42.version;
|
||||
buildInputs = deps;
|
||||
src = ./.;
|
||||
};
|
||||
in
|
||||
{
|
||||
options.fg42.c-family.enable = mkAndEnableOption "c-family";
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
fg42.elispPackages = [ drv ] ++ deps;
|
||||
|
||||
fg42.paths = (with pkgs;[
|
||||
cmake-language-server
|
||||
]);
|
||||
|
||||
fg42.requires = [ drv.pname ];
|
||||
};
|
||||
}
|
|
@ -0,0 +1,96 @@
|
|||
;;; 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: 4.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."
|
||||
:mode ("\\(?:CMakeLists\\.txt\\|\\.cmake\\)\\'" . cmake-ts-mode)
|
||||
:hook
|
||||
(cmake-ts-mode . fg42/autocomplete)
|
||||
(cmake-ts-mode . fg42/ensure-lang-server)
|
||||
(before-save . fg42/lang-server-format))
|
||||
|
||||
|
||||
(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 " "))))
|
||||
|
||||
|
||||
;;;###autoload
|
||||
(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")
|
||||
|
||||
(fg42/ensure-lang-server)
|
||||
(when (and (boundp 'eglot-managed-p) (eglot-managed-p))
|
||||
(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 . fg42/autocomplete)
|
||||
(c++-ts-mode . fg42/c-ts-mode-setup)
|
||||
(c++-ts-mode . flyspell-prog-mode)
|
||||
(before-save . fg42/lang-server-format))
|
||||
|
||||
|
||||
(provide 'fg42/c-family)
|
||||
;;; c-family.el ends here
|
|
@ -31,6 +31,8 @@ let
|
|||
./autocomplete
|
||||
./language-server
|
||||
./nix
|
||||
./c-family
|
||||
./python
|
||||
];
|
||||
|
||||
pkgsModule = { config, ... }: {
|
||||
|
|
|
@ -31,6 +31,7 @@ let
|
|||
projectile-ripgrep
|
||||
pkg-info
|
||||
expand-region
|
||||
direnv
|
||||
helpful
|
||||
envrc
|
||||
pinentry
|
||||
|
@ -71,6 +72,7 @@ in
|
|||
fg42.paths = (with pkgs;[
|
||||
ripgrep
|
||||
dicts
|
||||
direnv
|
||||
]);
|
||||
|
||||
fg42.font = {
|
||||
|
|
|
@ -194,11 +194,17 @@ contextual information."
|
|||
"Flycheck is a modern on-the-fly syntax checking extension for GNU Emacs."
|
||||
:config (global-flycheck-mode))
|
||||
|
||||
(use! rainbow-delimiters-mode
|
||||
(use! rainbow-delimiters
|
||||
"It is a rainbow parentheses like mode which highlights delimiters such as
|
||||
parentheses, brackets or braces according to their depth."
|
||||
;; Enable rainbow-delimiters for programming
|
||||
:hook (prog-mode-hook . rainbow-delimiters-mode))
|
||||
:hook (prog-mode . rainbow-delimiters-mode))
|
||||
|
||||
|
||||
(use! direnv
|
||||
"Direnv integration for FG42."
|
||||
:config
|
||||
(direnv-mode))
|
||||
|
||||
|
||||
(defun fg42/setup-editor ()
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
let
|
||||
deps = (with pkgs.emacsPackages; [
|
||||
eros
|
||||
rainbow-delimiters
|
||||
paredit
|
||||
]);
|
||||
drv = makeFG42Drv {
|
||||
|
@ -35,5 +34,10 @@ let
|
|||
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
../language-server
|
||||
];
|
||||
|
||||
fg42.elispPackages = [ drv ] ++ deps;
|
||||
fg42.requires = [ drv.pname ];
|
||||
}
|
||||
|
|
|
@ -29,13 +29,17 @@
|
|||
"Evaluation Result OverlayS for Emacs Lisp."
|
||||
:commands eros-mode)
|
||||
|
||||
(use! paredit
|
||||
"Minor mode for editing parentheses."
|
||||
:commands enable-paredit-mode)
|
||||
|
||||
|
||||
(use! elisp-mode
|
||||
"Elisp mode."
|
||||
:hook
|
||||
((emacs-lisp-mode . rainbow-delimiters-mode)
|
||||
(emacs-lisp-mode . paredit-mode)
|
||||
;; (emacs-lisp-mode . company-mode)
|
||||
(emacs-lisp-mode . eros-mode)))
|
||||
(emacs-lisp-mode . enable-paredit-mode)
|
||||
(emacs-lisp-mode . fg42/lang-server-format)
|
||||
(emacs-lisp-mode . eros-mode))
|
||||
|
||||
|
||||
(provide 'fg42/elisp)
|
||||
|
|
|
@ -34,10 +34,13 @@ shipped with Emacs."
|
|||
|
||||
(use! eldoc-box
|
||||
"View eldoc stuff in a frame."
|
||||
:commands eldoc-box-hover-mode)
|
||||
:commands eldoc-box-hover-mode
|
||||
:hook (eldoc-mode . eldoc-box-hover-mode))
|
||||
|
||||
|
||||
(use! markdown-mode
|
||||
"Renders markdown in Emacs.")
|
||||
"Renders markdown in Emacs."
|
||||
:init (setq markdown-command "multimarkdown"))
|
||||
|
||||
|
||||
;;;###autoload
|
||||
|
@ -53,6 +56,7 @@ or via `use!' `:hook'."
|
|||
(interactive)
|
||||
;; TODO: Configure LSP here as an alternative here by looking at
|
||||
;; the configs in `fg42/config'
|
||||
|
||||
(add-hook 'eglot-managed-mode-hook #'eldoc-box-hover-mode t)
|
||||
(eglot-ensure))
|
||||
|
||||
|
@ -64,7 +68,7 @@ or via `use!' `:hook'."
|
|||
This function is supposed to be run as a hook handler."
|
||||
(interactive)
|
||||
(cond
|
||||
((and (boundp 'eglot-managed-p) (eglot-managed-p))
|
||||
((and (functionp 'eglot-managed-p) (eglot-managed-p))
|
||||
(eglot-format-buffer))))
|
||||
|
||||
|
||||
|
|
|
@ -41,7 +41,8 @@
|
|||
(let ((nil-lsp '(nix-mode . ("nil"
|
||||
:initializationOptions
|
||||
(:formatting (:command ["nixpkgs-fmt"]))))))
|
||||
(add-to-list 'eglot-server-programs nil-lsp))))
|
||||
(add-to-list 'eglot-server-programs nil-lsp)
|
||||
(add-hook 'before-save-hook #'fg42/lang-server-format))))
|
||||
|
||||
|
||||
(use! nix-drv-mode
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
# Fg42 - Emacs Editor for advance users
|
||||
#
|
||||
# Copyright (c) 2010-2024 Sameer Rahmani <lxsameer@gnu.org>
|
||||
#
|
||||
# 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, version 2.
|
||||
#
|
||||
# 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/>.
|
||||
|
||||
# This is the home manager module that exposes FG42. It differs
|
||||
# from FG42 modules that are structurally the same but used in
|
||||
# different context
|
||||
|
||||
# A list of default FG42 modules to build FG42 with.
|
||||
{ lib, config, pkgs, makeFG42Drv, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.fg42.python-support;
|
||||
|
||||
deps =
|
||||
(with pkgs.emacsPackages; [
|
||||
poetry
|
||||
python-black
|
||||
]);
|
||||
|
||||
drv = makeFG42Drv {
|
||||
pname = "python-support";
|
||||
version = config.fg42.version;
|
||||
buildInputs = deps;
|
||||
src = ./.;
|
||||
};
|
||||
|
||||
py = pkgs.python3.withPackages (p: [
|
||||
p.ipython
|
||||
p.black
|
||||
p.pep8
|
||||
p.flake8
|
||||
p.mypy
|
||||
p.isort
|
||||
]);
|
||||
tools = (with pkgs;[
|
||||
py
|
||||
pyright
|
||||
]);
|
||||
in
|
||||
{
|
||||
options.fg42.python-support.enable = mkAndEnableOption "python-support";
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
fg42.elispPackages = [ drv ] ++ deps;
|
||||
|
||||
fg42.paths = tools;
|
||||
|
||||
fg42.requires = [ drv.pname ];
|
||||
};
|
||||
}
|
|
@ -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: 4.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-ts-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 . fg42/ensure-lang-server)
|
||||
(python-ts-mode . fg42/autocomplete)
|
||||
(python-ts-mode . flyspell-prog-mode))
|
||||
|
||||
|
||||
(provide 'fg42/python-support)
|
||||
;;; python-support.el ends here
|
|
@ -24,6 +24,10 @@ with lib;
|
|||
let
|
||||
cfg = config.fg42;
|
||||
|
||||
deps = (with pkgs.emacsPackages; [
|
||||
treesit-grammars.with-all-grammars
|
||||
]);
|
||||
|
||||
drv = makeFG42Drv {
|
||||
pname = "unit";
|
||||
version = config.fg42.version;
|
||||
|
@ -179,7 +183,7 @@ in
|
|||
|
||||
config = {
|
||||
fg42.version = import ../../version.nix { };
|
||||
fg42.elispPackages = [ drv ];
|
||||
fg42.elispPackages = [ drv ] ++ deps;
|
||||
fg42.theme = lib.mkDefault "base16-eighties";
|
||||
fg42.theme-package-name = lib.mkDefault "base16-theme";
|
||||
|
||||
|
@ -192,20 +196,6 @@ in
|
|||
'')
|
||||
];
|
||||
|
||||
# Extract the package pname's to pass to elisp to `require` them in the init
|
||||
# file, while compiling.
|
||||
# fg42.requires = map nix2elispName config.fg42.elispPackages;
|
||||
# fg42.docstrings = (with builtins;
|
||||
# let
|
||||
# desc = opt:
|
||||
# if hasAttr "description" opt
|
||||
# then opt.description
|
||||
# else "";
|
||||
|
||||
# in
|
||||
# lib.concatMapAttrs
|
||||
# (k: v: { ${k} = desc v; })
|
||||
# options.fg42);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue