diff --git a/.config/emacs/init.el b/.config/emacs/init.el index a6a6cde..8099e20 100644 --- a/.config/emacs/init.el +++ b/.config/emacs/init.el @@ -75,15 +75,7 @@ (use-package helpful :straight t - :commands (helpful-callable helpful-variable helpful-command helpful-key) - :custom - (counsel-describe-function-function #'helpful-callable) - (counsel-describe-variable-function #'helpful-variable) - :bind - ([remap describe-function] . counsel-describe-function) - ([remap describe-command] . helpful-command) - ([remap describe-variable] . counsel-describe-variable) - ([remap describe-key] . helpful-key)) + :commands (helpful-callable helpful-variable helpful-command helpful-key)) (use-package super-save :straight t @@ -127,7 +119,7 @@ (global-set-key (kbd "") 'keyboard-escape-quit) ;; Escape exits out of prompts - ;; Define Leader Key +;; Define Leader Key (use-package general :straight t :config @@ -136,9 +128,9 @@ :keymaps '(normal insert visual emacs) :prefix "SPC" :global-prefix "C-SPC") - ;; Define Keybindings (potentially move into own file) + ;; Define Keybindings (potentially move into own file) (opal/leader-keys - ;; Leader-map + ;; Leader-map ";" #'pp-eval-expression ;; Eval expression ":" #'execute-extended-command ;; Eq to M-x "u" #'universal-argument ;; Universal argument @@ -152,21 +144,25 @@ "gg" #'magit-status "gi" #'magit-init "gc" #'magit-clone - - ;; Buffers - "bd" #'kill-buffer + + ;; Workspaces + "bi" #'persp-ibuffer + "bl" #'persp-next + "bh" #'persp-prev + "br" #'persp-rename + "bd" #'persp-remove-buffer ;; Terminal/Shell "tt" #'vterm "te" #'eshell ;; Org - ; Babel + ;; Babel "obt" #'org-babel-tangle - ; Gen + ;; Gen "ol" #'org-insert-link "or" #'org-reload - ; Agenda + ;; Agenda "oa" #'org-agenda ;; Eval @@ -284,11 +280,53 @@ :init (marginalia-mode)) +(use-package company + :straight t + :commands (company-complete-common + company-complete-common-or-cycle + company-manual-begin + company-grab-line) + :init + (setq company-minimum-prefix-length 2 + company-tooltip-limit 14 + company-tooltip-align-annotations t + company-require-match 'never + company-global-modes + '(not erc-mode + message-mode + help-mode + vterm-mode) + company-frontends + '(company-pseudo-tooltip-frontend ; always show candidates in overlay tooltip + company-echo-metadata-frontend) ; show selected candidate docs in echo area + company-backends '(company-capf) + company-auto-commit nil + company-dabbrev-other-buffers nil + company-dabbrev-ignore-case nil + company-dabbrev-downcase nil)) + +(use-package perspective + :straight t + :config + (persp-mode)) + (use-package bufler :straight t) (use-package winner :straight t) +(use-package dired + :init + (setq dired-auto-revert-buffer t + dired-dwim-target t + dired-hide-details-hide-symlink-targets nil + dired-recursive-copies 'always + dired-recursive-deletes 'top + dired-create-destination-dirs 'ask)) + +(use-package dired-rsync + :straight t + :general (dired-mode-map "C-c C-r" #'dired-rsync)) (use-package all-the-icons-dired :straight t) (use-package dired-single :straight t) (use-package dired-collapse :straight t) @@ -319,16 +357,6 @@ (dired-rainbow-define vc "#0074d9" ("git" "gitignore" "gitattributes" "gitmodules")) (dired-rainbow-define-chmod executable-unix "#38c172" "-.*x.*")) -;; Set org agenda dir -(setq org-directory "~/Org/") - -;; Tell Org to stop indenting inside of org source blocks. -(setq org-edit-src-content-indentation 0) - -;; Open links in browser -(setq browse-url-browser-function 'browse-url-generic - browse-url-generic-program "firefox") - (defun opal/org-font-setup () ;; Replace list hyphen with dot (font-lock-add-keywords 'org-mode @@ -439,6 +467,16 @@ ("pp" "Project File" entry (file+olp "~/org/projects/auto-infra-overview.org" "Inbox") "* TODO %?\n %U\n %a\n %i" :empty-lines 1))) + ;; Tell Org to stop indenting inside of org source blocks. + (setq org-edit-src-content-indentation 0) + + ;; Set org agenda dir + (setq org-directory "~/Org/") + + ;; Open links in browser + (setq browse-url-browser-function 'browse-url-generic + browse-url-generic-program "firefox") + ;; Init org font setup (opal/org-font-setup)) @@ -449,6 +487,8 @@ :custom (org-bullets-bullet-list '("◉" "○" "●" "○" "●" "○" "●"))) +(use-package org-make-toc :straight t) + (defun opal/org-mode-visual-fill () (setq visual-fill-column-width 100 visual-fill-column-center-text t) @@ -462,7 +502,8 @@ (with-eval-after-load 'org (org-babel-do-load-languages 'org-babel-load-languages - '((emacs-lisp . t))) + '((emacs-lisp . t) + (lisp . t))) (push '("conf-unix" . conf-unix) org-src-lang-modes)) @@ -474,12 +515,7 @@ (add-to-list 'org-structure-template-alist '("sh" . "src shell")) (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp")) - (add-to-list 'org-structure-template-alist '("py" . "src python")) - (add-to-list 'org-structure-template-alist '("yml" . "src yaml")) (add-to-list 'org-structure-template-alist '("scm" . "src scheme")) - (add-to-list 'org-structure-template-alist '("js" . "src javascript")) - (add-to-list 'org-structure-template-alist '("html" . "src html")) - (add-to-list 'org-structure-template-alist '("css" . "src css")) (add-to-list 'org-structure-template-alist '("cl" . "src lisp"))) (use-package flycheck :straight t) @@ -509,6 +545,7 @@ evil)) (add-hook 'prog-mode-hook #'parinfer-mode))) +(defvar inferior-lisp-program "sbcl") (use-package sly :straight t) (use-package magit @@ -517,7 +554,6 @@ (use-package eshell-git-prompt :straight t) (use-package eshell - :hook (eshell-first-time-mode . eshell-config) :config ;; Save command history when commands are entered (add-hook 'eshell-pre-command-hook 'eshell-save-some-history) @@ -529,16 +565,28 @@ (evil-define-key '(normal insert visual) eshell-mode-map (kbd "") 'eshell-bol) (evil-normalize-keymaps) - (setq eshell-history-size 10000 - eshell-buffer-maximum-lines 10000 - eshell-hist-ignoredups t - eshell-scroll-to-bottom-on-input t) - (with-eval-after-load 'esh-opt (setq eshell-destroy-buffer-when-process-dies t) (setq eshell-visual-commands '("htop" "zsh" "vim"))) - (eshell-git-prompt-use-theme 'powerline)) + (eshell-git-prompt-use-theme 'powerline) + + (setq eshell-banner-message + '(format "%s %s\n" + (propertize (format " %s " (string-trim (buffer-name))) + 'face 'mode-line-highlight) + (propertize (current-time-string) + 'face 'font-lock-keyword-face)) + eshell-scroll-to-bottom-on-input 'all + eshell-scroll-to-bottom-on-output 'all + eshell-kill-processes-on-exit t + eshell-hist-ignoredups t + ;; em-prompt + eshell-prompt-regexp "^.* λ " + ;; em-glob + eshell-history-size 10000 + eshell-buffer-maximum-lines 10000 + eshell-scroll-to-bottom-on-input t)) (use-package vterm :straight t @@ -601,3 +649,64 @@ ;; erc-interpret-mirc-color t ;; erc-rename-buffers t ;; erc-track-exclude-server-buffer t)) + +;; (defun efs/exwm-update-class () +;; (exwm-workspace-rename-buffer exwm-class-name)) + +;; (use-package exwm +;; :config +;; (setq exwm-workspace-number 5) + +;; ;; These keys will pass through to Emacs +;; (setq exwm-input-prefix-keys +;; '(?\C-x +;; ?\C-u +;; ?\C-h +;; ?\M-x +;; ?\M-` +;; ?\M-& +;; ?\M-: +;; ?\C-\M-j ;; Buffer list +;; ?\C-\ )) ;; Ctrl+Space + +;; ;; This will allow the next key to be sent directly +;; (define-key exwm-mode-map [?\C-q] 'exwm-input-send-next-key) + +;; ;; Set up global key bindings. These always work, no matter the input state! +;; ;; Keep in mind that changing this list after EXWM initializes has no effect. +;; (setq exwm-input-global-keys +;; `( +;; ;; Reset to line-mode (C-c C-k switches to char-mode via exwm-input-release-keyboard) +;; ([?\s-r] . exwm-reset) + +;; ;; Move between windows +;; ([s-h] . windmove-left) +;; ([s-l] . windmove-right) +;; ([s-k] . windmove-up) +;; ([s-j] . windmove-down) + +;; ;; Launch applications via shell command +;; ([?\s-&] . (lambda (command) +;; (interactive (list (read-shell-command "$ "))) +;; (start-process-shell-command command nil command))) + +;; ;; Switch workspace +;; ([?\s-w] . exwm-workspace-switch) + +;; ;; 's-N': Switch to certain workspace with Super (Win) plus a number key (0 - 9) +;; ,@(mapcar (lambda (i) +;; `(,(kbd (format "s-%d" i)) . +;; (lambda () +;; (interactive) +;; (exwm-workspace-switch-create ,i)))) +;; (number-sequence 0 9)))) + +;; (start-process-shell-command "xrandr" nil "") +;; (start-process-shell-command "xmodmap" nil "xmodmap ~/.config/exwm/Xmodmap") + +;; (require 'exwm-randr) +;; (exwm-randr-enable) + +;; (require 'exwm-systemtray) +;; (exwm-systemtray-enable) +;; (exwm-enable)) diff --git a/.config/exwm/Xmodmap b/.config/exwm/Xmodmap new file mode 100644 index 0000000..d349fa4 --- /dev/null +++ b/.config/exwm/Xmodmap @@ -0,0 +1,2 @@ +clear lock +keycode 66 = Escape Caps_Lock NoSymbol NoSymbol \ No newline at end of file diff --git a/.config/nyxt/init.lisp b/.config/nyxt/init.lisp index e71b200..62c0324 100644 --- a/.config/nyxt/init.lisp +++ b/.config/nyxt/init.lisp @@ -1,4 +1,9 @@ -(load-after-system :slynk "~/.config/nyxt/my-slynk.lisp") +(in-package :nyxt) +(load "~/quicklisp/setup.lisp") +(ql:quickload 'slynk) + +(load-after-system :slynk (nyxt-init-file "my-slink.lisp")) +;; (load-after-system :slynk "~/.config/nyxt/my-slynk.lisp") ;; Vim-normal mode by default (define-configuration buffer @@ -125,6 +130,47 @@ (define-configuration buffer ((password-interface (make-instance 'password:user-keepassxc-interface)))) +(define-command set-url (&key (prefill-current-url-p t)) + "Set the URL for the current buffer, completing with history." + (let ((history (set-url-history *browser*)) + (actions (list (make-command buffer-load* (suggestion-values) + "Load first selected URL in current buffer and the rest in new buffer(s)." + (mapc (lambda (suggestion) (make-buffer :url (url suggestion))) (rest suggestion-values)) + (buffer-load (url (first suggestion-values)))) + (make-command new-buffer-load (suggestion-values) + "Load URL(s) in new buffer(s)." + (mapc (lambda (suggestion) (make-buffer :url (url suggestion))) (rest suggestion-values)) + (make-buffer-focus :url (url (first suggestion-values))))))) + (pushnew-url-history history (url (current-buffer))) + (prompt + :prompt "Open URL" + :input (if prefill-current-url-p + (render-url (url (current-buffer))) "") + :history history + :sources (list (make-instance 'user-new-url-or-search-source :actions actions) + (make-instance 'bookmark-source :actions actions) + (make-instance 'user-global-history-source :actions actions) + (make-instance 'search-engine-url-source :actions actions))))) + +(define-command set-url-new-buffer (&key (prefill-current-url-p t)) + "Prompt for a URL and set it in a new focused buffer." + (let ((history (set-url-history *browser*)) + (actions (list (make-command new-buffer-load (suggestion-values) + "Load URL(s) in new buffer(s)" + (mapc (lambda (suggestion) (make-buffer :url (url suggestion))) + (rest suggestion-values)) + (make-buffer-focus :url (url (first suggestion-values))))))) + (pushnew-url-history history (url (current-buffer))) + (prompt + :prompt "Open URL in new buffer" + :input (if prefill-current-url-p + (render-url (url (current-buffer))) "") + :history history + :sources (list (make-instance 'user-new-url-or-search-source :actions actions) + (make-instance 'bookmark-source :actions actions) + (make-instance 'user-global-history-source :actions actions) + (make-instance 'search-engine-url-source :actions actions))))) + ;; I would like to implement redirection, or some extension to handle it for me. ;; todo: Redirect reddit to teddit ;; (defun old-reddit-handler (request-data) @@ -142,3 +188,16 @@ ;; ((request-resource-hook ;; (hooks:add-hook %slot-default% (make-handler-resource #'old-reddit-handler))))) ;; (See url-dispatching-handler for a simpler way to achieve the same result.) + +(defun nyxt-init-file (&optional subpath) + "Return SUBPATH relative to `*init-file-path*'. +Return nil if `*init-file-path*' is nil. + +Example: +If we want to load a define-command procedure that lives in ~/path/to/nyxt/config/dir/my-slink.lisp +(load-after-system :slynk (nyxt-init-file \"my-slink.lisp\"))" + (if subpath + (uiop:subpathname* (uiop:pathname-directory-pathname + (expand-path *init-file-path*)) + subpath) + (expand-path *init-file-path*))) diff --git a/.gitignore b/.gitignore index aeed060..3d0d0a8 100644 --- a/.gitignore +++ b/.gitignore @@ -19,4 +19,4 @@ !.config/doom !.config/user-dirs.dirs !.gitignore -!.stow-local-ignore +!.stow-local-ignore \ No newline at end of file diff --git a/Emacs.org b/Emacs.org index 49cbd33..237725a 100644 --- a/Emacs.org +++ b/Emacs.org @@ -1,10 +1,32 @@ #+TITLE: Emacs Configuration #+PROPERTY: header-args:emacs-lisp :tangle ~/Dotfiles/.config/emacs/init.el :mkdirp yes :lexical yes -* Emacs Configuration +* Configuration +** Table of Contents :PROPERTIES: -:VISIBILITY: children -:END: +:TOC: :include all :depth 3 :force (depth) :ignore (this) :local (depth) +:END: +:CONTENTS: +- [[#configuration][Configuration]] + - [[#package-management][Package Management]] + - [[#general][General]] + - [[#theme][Theme]] + - [[#fonts][Fonts]] + - [[#keybinding][Keybinding]] + - [[#completion-frameworks][Completion Frameworks]] + - [[#buffer--workspaces][Buffer & Workspaces]] + - [[#file-browser][File Browser]] + - [[#org][Org]] + - [[#programmingeditor][Programming/Editor]] +- [[#tools][Tools]] + - [[#magit][Magit]] + - [[#eshell][Eshell]] + - [[#vterm][Vterm]] + - [[#pdf][PDF]] + - [[#e-mail][E-Mail]] + - [[#irc][IRC]] +:END: + ** Package Management I use [[https://github.com/raxod502/straight.el][straight.el]] for managing packages as it's fairly simple and robust. At some point I'd like to move to primarily using Guix for Emacs package management. @@ -114,15 +136,7 @@ Helpful.el is a package that reformats the describe-X functions to be much more #+begin_src emacs-lisp (use-package helpful :straight t - :commands (helpful-callable helpful-variable helpful-command helpful-key) - :custom - (counsel-describe-function-function #'helpful-callable) - (counsel-describe-variable-function #'helpful-variable) - :bind - ([remap describe-function] . counsel-describe-function) - ([remap describe-command] . helpful-command) - ([remap describe-variable] . counsel-describe-variable) - ([remap describe-key] . helpful-key)) + :commands (helpful-callable helpful-variable helpful-command helpful-key)) #+end_src *** Autosaves #+begin_src emacs-lisp @@ -188,7 +202,7 @@ I really enjoy having a leader key and eschewing the Control and Alt keys entire #+begin_src emacs-lisp (global-set-key (kbd "") 'keyboard-escape-quit) ;; Escape exits out of prompts - ;; Define Leader Key +;; Define Leader Key (use-package general :straight t :config @@ -197,9 +211,9 @@ I really enjoy having a leader key and eschewing the Control and Alt keys entire :keymaps '(normal insert visual emacs) :prefix "SPC" :global-prefix "C-SPC") - ;; Define Keybindings (potentially move into own file) + ;; Define Keybindings (potentially move into own file) (opal/leader-keys - ;; Leader-map + ;; Leader-map ";" #'pp-eval-expression ;; Eval expression ":" #'execute-extended-command ;; Eq to M-x "u" #'universal-argument ;; Universal argument @@ -213,21 +227,25 @@ I really enjoy having a leader key and eschewing the Control and Alt keys entire "gg" #'magit-status "gi" #'magit-init "gc" #'magit-clone - - ;; Buffers - "bd" #'kill-buffer + + ;; Workspaces + "bi" #'persp-ibuffer + "bl" #'persp-next + "bh" #'persp-prev + "br" #'persp-rename + "bd" #'persp-remove-buffer ;; Terminal/Shell "tt" #'vterm "te" #'eshell ;; Org - ; Babel + ;; Babel "obt" #'org-babel-tangle - ; Gen + ;; Gen "ol" #'org-insert-link "or" #'org-reload - ; Agenda + ;; Agenda "oa" #'org-agenda ;; Eval @@ -241,8 +259,7 @@ I really enjoy having a leader key and eschewing the Control and Alt keys entire "dv" #'describe-variable "ds" #'describe-symbol "dk" #'describe-key - "dp" #'describe-package)) - + "dp" #'describe-package)) #+end_src *** Evil @@ -330,7 +347,7 @@ Persistent history (savehist-mode)) #+end_src -*** Counsel +*** Consult #+begin_src emacs-lisp (use-package consult :straight t @@ -369,7 +386,42 @@ Marginalia provides annotations next to minibuffer items. (marginalia-mode)) #+end_src +*** Company +#+begin_src emacs-lisp +(use-package company + :straight t + :commands (company-complete-common + company-complete-common-or-cycle + company-manual-begin + company-grab-line) + :init + (setq company-minimum-prefix-length 2 + company-tooltip-limit 14 + company-tooltip-align-annotations t + company-require-match 'never + company-global-modes + '(not erc-mode + message-mode + help-mode + vterm-mode) + company-frontends + '(company-pseudo-tooltip-frontend ; always show candidates in overlay tooltip + company-echo-metadata-frontend) ; show selected candidate docs in echo area + company-backends '(company-capf) + company-auto-commit nil + company-dabbrev-other-buffers nil + company-dabbrev-ignore-case nil + company-dabbrev-downcase nil)) +#+end_src + ** Buffer & Workspaces +*** Perspective +#+begin_src emacs-lisp +(use-package perspective + :straight t + :config + (persp-mode)) +#+end_src *** Bufler Helps organize buffers in groups. #+begin_src emacs-lisp @@ -384,6 +436,18 @@ Allows window undo ** File Browser I don't even think I've heard of an alternative to Dired... #+begin_src emacs-lisp +(use-package dired + :init + (setq dired-auto-revert-buffer t + dired-dwim-target t + dired-hide-details-hide-symlink-targets nil + dired-recursive-copies 'always + dired-recursive-deletes 'top + dired-create-destination-dirs 'ask)) + +(use-package dired-rsync + :straight t + :general (dired-mode-map "C-c C-r" #'dired-rsync)) (use-package all-the-icons-dired :straight t) (use-package dired-single :straight t) (use-package dired-collapse :straight t) @@ -417,16 +481,6 @@ I don't even think I've heard of an alternative to Dired... ** Org *** General Configuration #+begin_src emacs-lisp -;; Set org agenda dir -(setq org-directory "~/Org/") - -;; Tell Org to stop indenting inside of org source blocks. -(setq org-edit-src-content-indentation 0) - -;; Open links in browser -(setq browse-url-browser-function 'browse-url-generic - browse-url-generic-program "firefox") - (defun opal/org-font-setup () ;; Replace list hyphen with dot (font-lock-add-keywords 'org-mode @@ -537,6 +591,16 @@ I don't even think I've heard of an alternative to Dired... ("pp" "Project File" entry (file+olp "~/org/projects/auto-infra-overview.org" "Inbox") "* TODO %?\n %U\n %a\n %i" :empty-lines 1))) + ;; Tell Org to stop indenting inside of org source blocks. + (setq org-edit-src-content-indentation 0) + + ;; Set org agenda dir + (setq org-directory "~/Org/") + + ;; Open links in browser + (setq browse-url-browser-function 'browse-url-generic + browse-url-generic-program "firefox") + ;; Init org font setup (opal/org-font-setup)) #+end_src @@ -552,6 +616,11 @@ Creates nicer (-) bullets. (org-bullets-bullet-list '("◉" "○" "●" "○" "●" "○" "●"))) #+end_src +*** Org Table of Contents +#+begin_src emacs-lisp +(use-package org-make-toc :straight t) +#+end_src + *** Visual Fill Mode Creates margins in Org mode to make it more pleasant to look at. #+begin_src emacs-lisp @@ -631,6 +700,7 @@ Sets HTML strings to have the background of the color they represent. #+end_src *** Common Lisp #+begin_src emacs-lisp +(defvar inferior-lisp-program "sbcl") (use-package sly :straight t) #+end_src * Tools @@ -644,7 +714,6 @@ Sets HTML strings to have the background of the color they represent. (use-package eshell-git-prompt :straight t) (use-package eshell - :hook (eshell-first-time-mode . eshell-config) :config ;; Save command history when commands are entered (add-hook 'eshell-pre-command-hook 'eshell-save-some-history) @@ -656,16 +725,28 @@ Sets HTML strings to have the background of the color they represent. (evil-define-key '(normal insert visual) eshell-mode-map (kbd "") 'eshell-bol) (evil-normalize-keymaps) - (setq eshell-history-size 10000 - eshell-buffer-maximum-lines 10000 - eshell-hist-ignoredups t - eshell-scroll-to-bottom-on-input t) - (with-eval-after-load 'esh-opt (setq eshell-destroy-buffer-when-process-dies t) (setq eshell-visual-commands '("htop" "zsh" "vim"))) - (eshell-git-prompt-use-theme 'powerline)) + (eshell-git-prompt-use-theme 'powerline) + + (setq eshell-banner-message + '(format "%s %s\n" + (propertize (format " %s " (string-trim (buffer-name))) + 'face 'mode-line-highlight) + (propertize (current-time-string) + 'face 'font-lock-keyword-face)) + eshell-scroll-to-bottom-on-input 'all + eshell-scroll-to-bottom-on-output 'all + eshell-kill-processes-on-exit t + eshell-hist-ignoredups t + ;; em-prompt + eshell-prompt-regexp "^.* λ " + ;; em-glob + eshell-history-size 10000 + eshell-buffer-maximum-lines 10000 + eshell-scroll-to-bottom-on-input t)) #+end_src ** Vterm #+begin_src emacs-lisp @@ -742,3 +823,67 @@ Right now I'm pretty happy with Matrix bridging into IRC rooms so this will stay ;; erc-rename-buffers t ;; erc-track-exclude-server-buffer t)) #+end_src +* Window Management (EXWM) +#+begin_src emacs-lisp +;; (defun efs/exwm-update-class () +;; (exwm-workspace-rename-buffer exwm-class-name)) + +;; (use-package exwm +;; :config +;; (setq exwm-workspace-number 5) + +;; ;; These keys will pass through to Emacs +;; (setq exwm-input-prefix-keys +;; '(?\C-x +;; ?\C-u +;; ?\C-h +;; ?\M-x +;; ?\M-` +;; ?\M-& +;; ?\M-: +;; ?\C-\M-j ;; Buffer list +;; ?\C-\ )) ;; Ctrl+Space + +;; ;; This will allow the next key to be sent directly +;; (define-key exwm-mode-map [?\C-q] 'exwm-input-send-next-key) + +;; ;; Set up global key bindings. These always work, no matter the input state! +;; ;; Keep in mind that changing this list after EXWM initializes has no effect. +;; (setq exwm-input-global-keys +;; `( +;; ;; Reset to line-mode (C-c C-k switches to char-mode via exwm-input-release-keyboard) +;; ([?\s-r] . exwm-reset) + +;; ;; Move between windows +;; ([s-h] . windmove-left) +;; ([s-l] . windmove-right) +;; ([s-k] . windmove-up) +;; ([s-j] . windmove-down) + +;; ;; Launch applications via shell command +;; ([?\s-&] . (lambda (command) +;; (interactive (list (read-shell-command "$ "))) +;; (start-process-shell-command command nil command))) + +;; ;; Switch workspace +;; ([?\s-w] . exwm-workspace-switch) + +;; ;; 's-N': Switch to certain workspace with Super (Win) plus a number key (0 - 9) +;; ,@(mapcar (lambda (i) +;; `(,(kbd (format "s-%d" i)) . +;; (lambda () +;; (interactive) +;; (exwm-workspace-switch-create ,i)))) +;; (number-sequence 0 9)))) + +;; (start-process-shell-command "xrandr" nil "") +;; (start-process-shell-command "xmodmap" nil "xmodmap ~/.config/exwm/Xmodmap") + +;; (require 'exwm-randr) +;; (exwm-randr-enable) + +;; (require 'exwm-systemtray) +;; (exwm-systemtray-enable) +;; (exwm-enable)) + +#+end_src diff --git a/Nyxt.org b/Nyxt.org index 00d29d0..29b1430 100644 --- a/Nyxt.org +++ b/Nyxt.org @@ -4,18 +4,15 @@ Nyxt is a browser written in Common Lisp that follows the same philosophy of extensibility as Emacs. This makes it a perfect companion to an Emacs centered eco-system when you need a browser with more features than Eww or w3m. * Load Quicklisp -#+begin_src emacs-lisp +#+begin_src lisp +(in-package :nyxt) (load "~/quicklisp/setup.lisp") (ql:quickload 'slynk) -;; #-quicklisp -;; (let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp" -;; (user-homedir-pathname)))) -;; (when (probe-file quicklisp-init) -;; (load quicklisp-init))) #+end_src -* Start Slynk server +* Import Functions #+begin_src lisp -(load-after-system :slynk "~/.config/nyxt/my-slynk.lisp") +(load-after-system :slynk (nyxt-init-file "my-slink.lisp")) +;; (load-after-system :slynk "~/.config/nyxt/my-slynk.lisp") #+end_src * Keybindings @@ -153,8 +150,9 @@ Password managers are an essential feature and thankfully Nyxt allows me to inte ((password-interface (make-instance 'password:user-keepassxc-interface)))) #+end_src * Functions -#+begin_src emacs-lisp -(in-package :nyxt) +** Show bookmarks first +I've ripped these functions out of the source code and swapped the sources in order to have bookmarks show up first upon executing set-url or set-url-new-buffer. +#+begin_src lisp (define-command set-url (&key (prefill-current-url-p t)) "Set the URL for the current buffer, completing with history." (let ((history (set-url-history *browser*)) @@ -220,3 +218,18 @@ I would like to keep expanding on these redirection functions so I can have nati ;; (hooks:add-hook %slot-default% (make-handler-resource #'old-reddit-handler))))) ;; (See url-dispatching-handler for a simpler way to achieve the same result.) #+end_src +* Testing +#+begin_src lisp +(defun nyxt-init-file (&optional subpath) + "Return SUBPATH relative to `*init-file-path*'. +Return nil if `*init-file-path*' is nil. + +Example: +If we want to load a define-command procedure that lives in ~/path/to/nyxt/config/dir/my-slink.lisp +(load-after-system :slynk (nyxt-init-file \"my-slink.lisp\"))" + (if subpath + (uiop:subpathname* (uiop:pathname-directory-pathname + (expand-path *init-file-path*)) + subpath) + (expand-path *init-file-path*))) +#+end_src