diff options
Diffstat (limited to '.emacs.d/init.el')
-rw-r--r-- | .emacs.d/init.el | 85 |
1 files changed, 80 insertions, 5 deletions
diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 7dad538..4d62bef 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -736,6 +736,74 @@ Contains the list of packages that need to be installed.") (setq message-send-mail-function 'smtpmail-send-it smtpmail-stream-type 'ssl)) +;;;; sudo completion +(defun pcomplete/sudo () + "Completion rules for the `sudo' command." + (let ((pcomplete-ignore-case t)) + (pcomplete-here (funcall pcomplete-command-completion-function)) + (while (pcomplete-here (pcomplete-entries))))) + +;;;; systemctl completion +(defcustom pcomplete-systemctl-commands + '("disable" "enable" "status" "start" "restart" "stop" "reenable" + "list-units" "list-unit-files") + "p-completion candidates for `systemctl' main commands" + :type '(repeat (string :tag "systemctl command")) + :group 'pcomplete) + +(defvar pcomplete-systemd-units + (split-string + (shell-command-to-string + "(systemctl list-units --all --full --no-legend;systemctl list-unit-files --full --no-legend)|while read -r a b; do echo \" $a\";done;")) + "p-completion candidates for all `systemd' units") + +(defvar pcomplete-systemd-user-units + (split-string + (shell-command-to-string + "(systemctl list-units --user --all --full --no-legend;systemctl list-unit-files --user --full --no-legend)|while read -r a b;do echo \" $a\";done;")) + "p-completion candidates for all `systemd' user units") + +(defun pcomplete/systemctl () + "Completion rules for the `systemctl' command." + (pcomplete-here (append pcomplete-systemctl-commands '("--user"))) + (cond ((pcomplete-test "--user") + (pcomplete-here pcomplete-systemctl-commands) + (pcomplete-here pcomplete-systemd-user-units)) + (t (pcomplete-here pcomplete-systemd-units)))) + +;;;; man completion +(defvar pcomplete-man-user-commands + (split-string + (shell-command-to-string + "apropos -s 1 .|while read -r a b; do echo \" $a\";done;")) + "p-completion candidates for `man' command") + +(defun pcomplete/man () + "Completion rules for the `man' command." + (pcomplete-here pcomplete-man-user-commands)) + +;; hut completion +(defcustom pcomplete-hut-commands + '("builds" "export" "git" "graphql" "lists" "help" "hg" + "init" "meta" "pages" "paste" "todo") + "p-completion candidates for `hut' main commands" + :type '(repeat (string :tag "hut command")) + :group 'pcomplete) + +(defvar pcomplete-hut-user-commands + (split-string + (shell-command-to-string + "hut |while read -r a b; do echo \" $a\";done;")) + "p-completion candidates for `hut' command") + +(defun apollo/hut () + "Replace." + (replace-match "Usage:" "Someasdf")) + +(defun pcomplete/hut () + "Completion rules for `hut' command" + (pcomplete-here (append pcomplete-hut-user-commands))) + (defun apollo/html-boostrap-boilerplate () "Insert html boilerplate with boostrap link." (interactive) @@ -843,13 +911,16 @@ Contains the list of packages that need to be installed.") (switch-to-buffer (get-buffer-create "*Keimenografos*")) (text-mode)) +(defun create-scratch () + (interactive) + (switch-to-buffer (get-buffer-create "*scratch*")) + (emacs-lisp-mode)) + (define-key dired-mode-map "b" 'dired-up-directory) (global-set-key (kbd "<escape>") 'keyboard-escape-quit) -(global-set-key (kbd "C-=") 'text-scale-increase) -(global-set-key (kbd "C--") 'text-scale-decrease) -(global-set-key (kbd "C-k") 'copy-region-as-kill) +(global-set-key (kbd "C-c c") 'copy-region-as-kill) ;; Pass (global-set-key (kbd "C-c p i") 'password-store-insert) @@ -932,11 +1003,15 @@ Contains the list of packages that need to be installed.") (setq openai-key (password-store-get "chatgpt/api2")) (setq openai-key (password-store-get "chatgpt/api"))) -(setq circe-network-options +(use-package circe + :ensure t + :config + (setq circe-network-options `(("Libera Chat" :host "irc.libera.chat" :port 6697 :tls t :nick "thanosapollo" :sasl-username "thanos_apollo" :channels ("#emacs" "#emacs-circe") :sasl-password ,(password-store-get "liberachat/thanos_apollo") - ))) + ))) + (define-key thanos/applications-map (kbd "i") 'circe)) |