From 4cdf45b531ba89e4484c8df7ea71def45fcfe69d Mon Sep 17 00:00:00 2001 From: cspark Date: Tue, 17 Dec 2024 10:15:27 +0000 Subject: [PATCH] Reorganise code --- config.org | 343 ++++++++++++++++++++++++++--------------------------- 1 file changed, 171 insertions(+), 172 deletions(-) diff --git a/config.org b/config.org index 6ed5546..0807fec 100644 --- a/config.org +++ b/config.org @@ -340,6 +340,59 @@ Midnight mode will automatically clear up configured buffers or buffers that hav (setq midnight-mode t) #+END_SRC +** Eshell +*** Bash-like Completion +#+BEGIN_SRC emacs-lisp + (add-hook + 'eshell-mode-hook + (lambda () + (setq pcomplete-cycle-completions nil))) + + (setq eshell-cmpl-cycle-completions nil) + + (use-package bash-completion + :ensure t + :init + (autoload 'bash-completion-dynamic-complete + "bash-completion" + "BASH completion hook") + (add-hook 'shell-dynamic-complete-functions + 'bash-completion-dynamic-complete) + (add-hook 'eshell-mode-hook + (lambda () + (add-hook 'completion-at-point-functions + 'bash-completion-capf-nonexclusive nil t))) + + ) +#+END_SRC +*** Zoxide +Zoxide Z like functionality, better cd inside eshell +#+BEGIN_SRC emacs-lisp + (use-package eshell-z + :init + (add-hook 'eshell-mode-hook + (defun my-eshell-mode-hook () + (require 'eshell-z))) + :ensure t) +#+END_SRC + +** Default Shell +Set the default shell used to run commands. +#+BEGIN_SRC emacs-lisp + (setq shell-file-name "/bin/sh") +#+END_SRC + +** TRAMP +TRAMP edit files over SSH configuration +#+BEGIN_SRC emacs-lisp + (use-package tramp + :ensure t + :config + (add-to-list 'tramp-remote-path 'tramp-own-remote-path) + (when (eq window-system 'w32) + (setq tramp-default-method "plink"))) +#+END_SRC + ** Custom *** Eshell Terminal Bind Bind the eshell terminal to Alt-Enter @@ -858,7 +911,8 @@ Install the package, enable it and ensure that it always is installed, and then :init (elcord-mode 1)) #+END_SRC -** Nix Mode +** Languages +*** Nix Mode An Emacs major mode for editing Nix expressions. There is also a manual available at nix-mode.org. #+BEGIN_SRC emacs-lisp @@ -867,7 +921,7 @@ An Emacs major mode for editing Nix expressions. There is also a manual availabl :mode "\\.nix\\'") #+END_SRC -** LUA Mode +*** LUA Mode lua-mode is a major mode for editing Lua sources in Emacs. #+BEGIN_SRC emacs-lisp @@ -876,7 +930,7 @@ lua-mode is a major mode for editing Lua sources in Emacs. (add-to-list 'auto-mode-alist '("\\.iy\\'" . lua-mode)) #+END_SRC -** Swift Mode +*** Swift Mode Major-mode for Apple's Swift programming language. #+BEGIN_SRC emacs-lisp @@ -894,47 +948,7 @@ Major-mode for Apple's Swift programming language. ;; ) #+END_SRC -** Snippets -YASnippet is a template system for Emacs. It allows you to type an abbreviation and automatically expand it into function templates. - -#+BEGIN_SRC emacs-lisp - (use-package yasnippet - :ensure t - :init - (yas-global-mode 1)) - - (use-package yasnippet-snippets - :ensure t) -#+END_SRC - -** Emmet Mode -Provides support for Zen Coding by producing HTML from CSS-like selectors - -#+BEGIN_SRC emacs-lisp - (use-package emmet-mode - :ensure t - :init - (add-hook 'html-mode-hook 'emmet-mode) - (add-hook 'css-mode-hook 'emmet-mode) - (add-hook 'js-mode-hook 'emmet-mode)) - - (define-key emmet-mode-keymap (kbd "C-j") 'emmet-expand-yas) -#+END_SRC - -** Prettier Mode -The prettier Emacs package reformats your code by running Prettier with minimal overhead, by request or transparently on file save. - -#+BEGIN_SRC emacs-lisp - (use-package prettier - :ensure t - :init - (add-hook 'after-init-hook #'global-prettier-mode) - :hook ((jtsx-jsx-mode . prettier-mode) - (jtsx-tsx-mode . prettier-mode) - (jtsx-typescript-mode . prettier-mode))) -#+END_SRC - -** TSX Mode +*** TSX Mode A batteries-included Emacs major mode for TSX/JSX files. #+BEGIN_SRC emacs-lisp @@ -984,6 +998,46 @@ A batteries-included Emacs major mode for TSX/JSX files. (add-hook 'jtsx-jsx-mode-hook 'jtsx-bind-keys-to-jtsx-jsx-mode-map) (add-hook 'jtsx-tsx-mode-hook 'jtsx-bind-keys-to-jtsx-tsx-mode-map)) #+END_SRC +*** Emmet Mode +Provides support for Zen Coding by producing HTML from CSS-like selectors + +#+BEGIN_SRC emacs-lisp + (use-package emmet-mode + :ensure t + :init + (add-hook 'html-mode-hook 'emmet-mode) + (add-hook 'css-mode-hook 'emmet-mode) + (add-hook 'js-mode-hook 'emmet-mode)) + + (define-key emmet-mode-keymap (kbd "C-j") 'emmet-expand-yas) +#+END_SRC + +** Snippets +YASnippet is a template system for Emacs. It allows you to type an abbreviation and automatically expand it into function templates. + +#+BEGIN_SRC emacs-lisp + (use-package yasnippet + :ensure t + :init + (yas-global-mode 1)) + + (use-package yasnippet-snippets + :ensure t) +#+END_SRC + +** Prettier Mode +The prettier Emacs package reformats your code by running Prettier with minimal overhead, by request or transparently on file save. + +#+BEGIN_SRC emacs-lisp + (use-package prettier + :ensure t + :init + (add-hook 'after-init-hook #'global-prettier-mode) + :hook ((jtsx-jsx-mode . prettier-mode) + (jtsx-tsx-mode . prettier-mode) + (jtsx-typescript-mode . prettier-mode))) +#+END_SRC + ** Flycheck Flycheck is a modern version of Flymake, provides error messages @@ -1208,7 +1262,79 @@ in the primary dired buffer. (use-package ranger :ensure t) #+END_SRC -** EXWM +** Libvterm +A better terminal +#+BEGIN_SRC emacs-lisp + (use-package vterm + :ensure t) +#+END_SRC +** Sudo Edit +Allows you to edit files as root via running sudo-edit +#+BEGIN_SRC emacs-lisp + (use-package sudo-edit + :ensure t) +#+END_SRC +** MPD +Clients that support MPD +*** MPDel +MPDel is an Emacs client for Music Player Daemon (MPD), a flexible, powerful, server-side application for playing music. ++BEGIN_SRC emacs-lisp + (use-package mpdel + :ensure t) ++END_SRC +*** Mingus +Mingus is a frontend for GNU Emacs to the Music Player daemon. The interface closely, though not strictly, resembles that of ncmpc. +#+BEGIN_SRC emacs-lisp + (use-package mingus + :ensure t + :config + (define-key mingus-global-map (kbd "") 'mingus-vol-up) + (define-key mingus-global-map (kbd "") 'mingus-vol-down) + ) +#+END_SRC + +** Databases +*** Sqlite Mode +Emacs has a built in sqlite mode to view sqlite database files and modify them. Configure to be a bit nicer +#+BEGIN_SRC emacs-lisp + (with-eval-after-load 'sqlite-mode + (define-key sqlite-mode-map (kbd "") 'sqlite-mode-list-data) + ) + ;; Hook into find-file, basically allows us to open the sqlite db file directly instead of using sqlite-mode-open-file function + (defun sqlite-find-file-hook () + (when (string= (file-name-extension buffer-file-name) "sqlite") + (let + ( + (sql-original-buffer-name (buffer-name)) + (sql-original-buffer-file-name (buffer-file-name)) + ) + + (kill-buffer sql-original-buffer-name) + (sqlite-mode-open-file sql-original-buffer-file-name) + ) + ) + ) + + (add-hook 'find-file-hook 'sqlite-find-file-hook) +#+END_SRC +*** PGMacs +PGmacs provides an editing interface for the PostgreSQL object-relational DBMS from Emacs. +#+BEGIN_SRC emacs-lisp + (use-package pg + :ensure t) + + (use-package pgmacs + :straight '(pgmacs :type git :host github :repo "emarsden/pgmacs") + :ensure t + :after pg) +#+END_SRC + +** Emacs Server +Start emacs server, this can then be used to open buffers/set the current emacs session as the EDITOR. +#+BEGIN_SRC emacs-lisp + (server-start) +#+END_SRC +** EXWM - Emacs as an operating system EXWM, The Emacs X Window Manager. As it says, it is an Emacs window manager for the X display server. The benefits include using all your emacs functions and fuzzy searching in tangent with X windows. @@ -1407,130 +1533,3 @@ Install the package, enable it and ensure that it always is installed, and then (or comment ""))) (setq counsel-linux-app-format-function #'ds/counsel-linux-app-format-function) #+END_SRC - -** Libvterm -A better terminal -#+BEGIN_SRC emacs-lisp - (use-package vterm - :ensure t) -#+END_SRC -** Sudo Edit -Allows you to edit files as root via running sudo-edit -#+BEGIN_SRC emacs-lisp - (use-package sudo-edit - :ensure t) -#+END_SRC -** Eshell -*** Bash-like Completion -#+BEGIN_SRC emacs-lisp - (add-hook - 'eshell-mode-hook - (lambda () - (setq pcomplete-cycle-completions nil))) - - (setq eshell-cmpl-cycle-completions nil) - - (use-package bash-completion - :ensure t - :init - (autoload 'bash-completion-dynamic-complete - "bash-completion" - "BASH completion hook") - (add-hook 'shell-dynamic-complete-functions - 'bash-completion-dynamic-complete) - (add-hook 'eshell-mode-hook - (lambda () - (add-hook 'completion-at-point-functions - 'bash-completion-capf-nonexclusive nil t))) - - ) -#+END_SRC -*** Zoxide -Zoxide Z like functionality, better cd inside eshell -#+BEGIN_SRC emacs-lisp - (use-package eshell-z - :init - (add-hook 'eshell-mode-hook - (defun my-eshell-mode-hook () - (require 'eshell-z))) - :ensure t) -#+END_SRC - -** Default Shell -Set the default shell used to run commands. -#+BEGIN_SRC emacs-lisp - (setq shell-file-name "/bin/sh") -#+END_SRC - -** TRAMP -TRAMP edit files over SSH configuration -#+BEGIN_SRC emacs-lisp - (use-package tramp - :ensure t - :config - (add-to-list 'tramp-remote-path 'tramp-own-remote-path) - (when (eq window-system 'w32) - (setq tramp-default-method "plink"))) -#+END_SRC - -** Emacs Server -Start emacs server, this can then be used to open buffers/set the current emacs session as the EDITOR. -#+BEGIN_SRC emacs-lisp - (server-start) -#+END_SRC -** MPD -Clients that support MPD -*** MPDel -MPDel is an Emacs client for Music Player Daemon (MPD), a flexible, powerful, server-side application for playing music. -+BEGIN_SRC emacs-lisp - (use-package mpdel - :ensure t) -+END_SRC -*** Mingus -Mingus is a frontend for GNU Emacs to the Music Player daemon. The interface closely, though not strictly, resembles that of ncmpc. -#+BEGIN_SRC emacs-lisp - (use-package mingus - :ensure t - :config - (define-key mingus-global-map (kbd "") 'mingus-vol-up) - (define-key mingus-global-map (kbd "") 'mingus-vol-down) - ) -#+END_SRC - -** Databases -*** Sqlite Mode -Emacs has a built in sqlite mode to view sqlite database files and modify them. Configure to be a bit nicer -#+BEGIN_SRC emacs-lisp - (with-eval-after-load 'sqlite-mode - (define-key sqlite-mode-map (kbd "") 'sqlite-mode-list-data) - ) - ;; Hook into find-file, basically allows us to open the sqlite db file directly instead of using sqlite-mode-open-file function - (defun sqlite-find-file-hook () - (when (string= (file-name-extension buffer-file-name) "sqlite") - (let - ( - (sql-original-buffer-name (buffer-name)) - (sql-original-buffer-file-name (buffer-file-name)) - ) - - (kill-buffer sql-original-buffer-name) - (sqlite-mode-open-file sql-original-buffer-file-name) - ) - ) - ) - - (add-hook 'find-file-hook 'sqlite-find-file-hook) - -#+END_SRC -*** PGMacs -PGmacs provides an editing interface for the PostgreSQL object-relational DBMS from Emacs. -#+BEGIN_SRC emacs-lisp - (use-package pg - :ensure t) - - (use-package pgmacs - :straight '(pgmacs :type git :host github :repo "emarsden/pgmacs" - :build (:not compile)) - :ensure t - :after pg) -#+END_SRC