(use-package xah-fly-keys) (use-package kakoune) (use-package expand-region) (use-package hydra) (use-package drag-stuff) (use-package request) ;;; -- my personal functions -- ;; (defun o/ryo-stick () (interactive) (if (ryo-modal-mode) '(nil) (ryo-modal-mode 1))) (defun o/quit () (interactive) (execute-kbd-macro (kbd "C-g"))) (defun o/newline () (interactive) (end-of-line) (newline)) (defun o/newline-up () (interactive) (beginning-of-line) (newline) (forward-line -1)) (defun o/insert-forward () (interactive) (forward-char) (ryo-modal-mode -1)) (defun gk-pop-shell (arg) "Pop a shell in a side window. Pass arg to ‘shell’." (interactive "P") (select-window (display-buffer-in-side-window (save-window-excursion (let ((prefix-arg arg)) (call-interactively #'shell)) (current-buffer)) '((side . bottom))))) (global-set-key (kbd "M-c") 'gk-pop-shell) (defun o/delete () (interactive) (if (use-region-p) (xah-cut-line-or-region) (delete-char 1))) (defun o/voldown () (interactive) (shell-command "pamixer -d 5")) (defun o/volup () (interactive) (shell-command "pamixer -i 5")) (global-set-key (kbd "") 'o/voldown) (global-set-key (kbd "") 'o/volup) ;; Print screen (global-set-key (kbd "") (lambda () (interactive) (let ((path (concat "~/Documents/Screenshot-" (format-time-string "%Y-%m-%d,%H:%M:%S") ".png"))) (start-process-shell-command "scrot" nil (concat "scrot -s -f " path)) (message (concat "Screenshot saved to " path))))) ;; (defun x11-yank-image-at-point-as-image () ;; "Yank the image at point to the X11 clipboard as image/png." ;; (interactive) ;; (let ((image (get-text-property (point) 'display))) ;; (if (eq (car image) 'image) ;; (let ((data (plist-get (cdr image) ':data)) ;; (file (plist-get (cdr image) ':file))) ;; (cond (data ;; (with-temp-buffer ;; (insert data) ;; (call-shell-region ;; (point-min) (point-max) ;; "xclip -i -selection clipboard -t image/png"))) ;; (file ;; (if (file-exists-p file) ;; (start-process ;; "xclip-proc" nil "xclip" ;; "-i" "-selection" "clipboard" "-t" "image/png" ;; "-quiet" (file-truename file)))) ;; (t (message "The image seems to be malformed.")))) ;; (message "Point is not at an image.")))) ;; (global-set-key (kbd "M-p") 'x11-yank-image-at-point-as-image) (defun xah-insert-column-az () "Insert letters A to Z vertically, similar to `rectangle-number-lines'. The commpand will prompt for a start char, and number of chars to insert. The start char can be any char in Unicode. URL `http://ergoemacs.org/emacs/emacs_insert-alphabets.html' Version 2019-03-07" (interactive) (let ( ($startChar (string-to-char (read-string "Start char: " "a"))) ($howmany (string-to-number (read-string "How many: " "26"))) ($colpos (- (point) (line-beginning-position)))) (dotimes ($i $howmany ) (progn (insert-char (+ $i $startChar)) (forward-line) (beginning-of-line) (forward-char $colpos))))) (global-set-key (kbd "C-c z") 'xah-insert-column-az) (provide 'bind-fun)