summaryrefslogtreecommitdiff
path: root/modules/help-utils.el
diff options
context:
space:
mode:
Diffstat (limited to 'modules/help-utils.el')
-rw-r--r--modules/help-utils.el19
1 files changed, 19 insertions, 0 deletions
diff --git a/modules/help-utils.el b/modules/help-utils.el
index d6301782..ab9f2855 100644
--- a/modules/help-utils.el
+++ b/modules/help-utils.el
@@ -84,5 +84,24 @@
:defer 1
:bind ("C-h W" . wiki-summary))
+;; --------------------------- Browse Local Arch Wiki --------------------------
+;; on Arch: yay (or whatever your AUR package manager is) -S arch-wiki-docs
+;; browse the arch wiki topics offline
+
+
+(defun cj/local-arch-wiki-search ()
+ (interactive)
+ (let* ((dir "/usr/share/doc/arch-wiki/html/en")
+ (full-filenames (directory-files dir t "\\.html\\'"))
+ (basenames (mapcar 'file-name-base full-filenames))
+ (chosen (completing-read "Choose an ArchWiki Topic: " basenames)))
+ (if (member chosen basenames)
+ (let* ((idx (cl-position chosen basenames :test 'equal))
+ (fullname (nth idx full-filenames))
+ (url (concat "file://" fullname)))
+ (eww-browse-url url))
+ (message "File not found! Is arch-wiki-docs installed?"))))
+(global-set-key (kbd "C-h A") 'cj/local-arch-wiki-search)
+
(provide 'help-utils)
;;; help-utils.el ends here