some updates + testing out emacs
This commit is contained in:
parent
3b1d76f533
commit
769bc078ef
4 changed files with 316 additions and 118 deletions
|
@ -137,6 +137,155 @@
|
|||
};
|
||||
|
||||
programs = {
|
||||
emacs = {
|
||||
enable = true;
|
||||
package = pkgs.emacs29-pgtk;
|
||||
|
||||
extraPackages = epkgs:
|
||||
with epkgs; [
|
||||
catppuccin-theme
|
||||
company
|
||||
dashboard
|
||||
direnv
|
||||
doom-modeline
|
||||
eglot
|
||||
evil
|
||||
evil-leader
|
||||
flycheck
|
||||
flycheck-inline
|
||||
nix-mode
|
||||
treemacs
|
||||
treemacs-evil
|
||||
treesit-auto
|
||||
treesit-grammars.with-all-grammars
|
||||
tree-sitter-langs
|
||||
vterm
|
||||
];
|
||||
|
||||
extraConfig = ''
|
||||
; Catppuccin theme
|
||||
(load-theme 'catppuccin :no-confirm)
|
||||
|
||||
; Doom modeline
|
||||
(require 'doom-modeline)
|
||||
(doom-modeline-mode 1)
|
||||
|
||||
; Set font
|
||||
(set-frame-font "Maple Mono NF 12" nil t)
|
||||
|
||||
; Change default indent size to 2 spaces
|
||||
(setq-default indent-tabs-mode nil) ;; Use spaces instead of tabs
|
||||
(setq-default standard-indent 2) ;; Change indent
|
||||
(setq-default tab-width 2) ;; Change tab width
|
||||
|
||||
; Evil mode
|
||||
(setq evil-want-C-u-scroll t)
|
||||
(require 'evil)
|
||||
(evil-mode 1)
|
||||
|
||||
;; Treemacs (+ evil mode support)
|
||||
(require 'treemacs)
|
||||
(require 'treemacs-evil) ; Optional: if you want Evil keybindings for Treemacs
|
||||
|
||||
;; Evil leader
|
||||
(global-evil-leader-mode)
|
||||
(evil-leader/set-leader "<SPC>")
|
||||
(evil-leader/set-key "e" 'treemacs)
|
||||
|
||||
;; Centered scrolling
|
||||
(defun my/evil-scroll-up ()
|
||||
"Scroll up half a screen and center the line."
|
||||
(interactive)
|
||||
(evil-scroll-up nil)
|
||||
(recenter))
|
||||
|
||||
(defun my/evil-scroll-down ()
|
||||
"Scroll down half a screen and center the line."
|
||||
(interactive)
|
||||
(evil-scroll-down nil)
|
||||
(recenter))
|
||||
|
||||
(define-key evil-normal-state-map (kbd "C-u") 'my/evil-scroll-up)
|
||||
(define-key evil-normal-state-map (kbd "C-d") 'my/evil-scroll-down)
|
||||
|
||||
; Disable menubar and toolbar
|
||||
(menu-bar-mode -1)
|
||||
(tool-bar-mode -1)
|
||||
|
||||
; Dashboard
|
||||
(require 'dashboard)
|
||||
(dashboard-setup-startup-hook)
|
||||
(setq dashboard-startup-banner 'logo)
|
||||
|
||||
; Direnv
|
||||
(direnv-mode)
|
||||
|
||||
; Nix setup
|
||||
(require 'nix-mode)
|
||||
(add-to-list 'auto-mode-alist '("\\.nix\\'" . nix-mode))
|
||||
|
||||
; Tree-sitter setup
|
||||
(require 'treesit)
|
||||
(require 'tree-sitter-langs)
|
||||
(require 'treesit-auto)
|
||||
(global-treesit-auto-mode)
|
||||
|
||||
(add-hook 'prog-mode-hook #'tree-sitter-mode)
|
||||
(add-hook 'prog-mode-hook #'tree-sitter-hl-mode)
|
||||
|
||||
;; Use Tree-sitter for better syntax highlighting
|
||||
(dolist (lang treesit-language-source-alist)
|
||||
(let ((mode (intern (format "%s-ts-mode" (car lang)))))
|
||||
(when (fboundp mode)
|
||||
(add-to-list 'major-mode-remap-alist
|
||||
(cons (intern (car lang)) mode)))))
|
||||
|
||||
; Eglot setup
|
||||
(add-hook 'prog-mode-hook 'eglot-ensure)
|
||||
(add-hook 'nix-mode-hook 'eglot-ensure)
|
||||
|
||||
;; Function to format the buffer using Eglot
|
||||
(defun my/eglot-format-buffer-on-save ()
|
||||
"Format the current buffer if Eglot is active."
|
||||
(when (bound-and-true-p eglot--managed-p)
|
||||
(eglot-format-buffer)))
|
||||
|
||||
;; Add the function to the save-hook
|
||||
(add-hook 'before-save-hook #'my/eglot-format-buffer-on-save)
|
||||
|
||||
; Flycheck setup
|
||||
(require 'flycheck)
|
||||
(global-flycheck-mode)
|
||||
|
||||
; Flycheck-inline setup
|
||||
(require 'flycheck-inline)
|
||||
(add-hook 'flycheck-mode-hook #'flycheck-inline-mode)
|
||||
|
||||
; Disable Flycheck modeline error messages
|
||||
(setq-default flycheck-mode-line-prefix "")
|
||||
(setq-default flycheck-display-errors-function #'flycheck-inline-display-errors)
|
||||
|
||||
; Company mode setup
|
||||
(require 'company)
|
||||
(global-company-mode) ; Enable Company mode globally
|
||||
|
||||
; Key bindings for company mode
|
||||
(setq company-idle-delay 0.2) ; Start completion after a short delay
|
||||
(setq company-minimum-prefix-length 1) ; Start completion after typing 1 character
|
||||
(setq company-show-numbers t) ; Show numbers for completion candidates
|
||||
(global-set-key (kbd "M-/") 'company-complete) ; Trigger completion manually with M-/
|
||||
|
||||
(defun my/compile-and-focus-treemacs ()
|
||||
"Run `compile` and focus on the project root in `Treemacs`."
|
||||
(interactive)
|
||||
(let ((default-directory (project-root (project-current t))))
|
||||
(compile (read-shell-command "Compile command: " (concat (or compile-command "make") " ")))
|
||||
(treemacs-select-window)))
|
||||
|
||||
(global-set-key (kbd "C-c C-c") 'my/compile-and-focus-treemacs)
|
||||
'';
|
||||
};
|
||||
|
||||
wezterm.extraConfig = builtins.readFile ./wezterm.lua;
|
||||
|
||||
git = {
|
||||
|
|
|
@ -84,7 +84,7 @@ with pkgs; {
|
|||
|
||||
device = [
|
||||
{
|
||||
name = "logitech-usb-receiver";
|
||||
name = "logitech-g502-x-plus";
|
||||
sensitivity = -0.5;
|
||||
}
|
||||
];
|
||||
|
@ -191,7 +191,6 @@ with pkgs; {
|
|||
"${modS}, q, exit"
|
||||
|
||||
# Toggles
|
||||
"${mod}, j, togglesplit"
|
||||
"${mod}, Space, togglefloating"
|
||||
|
||||
# Focus movements
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue