From: Ian Kelling Date: Sun, 30 Aug 2020 11:52:31 +0000 (-0400) Subject: adjust keybinds for terminal X-Git-Url: https://iankelling.org/git/?a=commitdiff_plain;h=a06302c315d50d7da20288b9803d2f56c9b93516;p=dot-emacs adjust keybinds for terminal --- diff --git a/init.el b/init.el index 9ada6bd..44edd97 100644 --- a/init.el +++ b/init.el @@ -407,7 +407,7 @@ Fourth argument TYPE is the custom option type." ;;; readline complete fix - ;; I need this function here, where INSIDE_EMACS is replaced with RLC_INSIDE_EMACS. + ;; I need this function here, where INSIDE_EMACS is replaced with LC_INSIDE_EMACS. ;; ian: last update 2017-1-7. update this periodically from upstream ;; like when we do a major emacs update (defun comint-exec-1 (name buffer command switches) @@ -426,7 +426,7 @@ Fourth argument TYPE is the custom option type." (format "COLUMNS=%d" (window-width))) (list "TERM=emacs" (format "TERMCAP=emacs:co#%d:tc=unknown:" (window-width)))) - (list (format "RLC_INSIDE_EMACS=%s,comint" emacs-version)) + (list (format "LC_INSIDE_EMACS=%s,comint" emacs-version)) process-environment)) (default-directory (if (file-accessible-directory-p default-directory) @@ -925,10 +925,14 @@ and whatever was used" found (mu4e-message-contact-field-matches mu4e-compose-parent-message :to re))) (when found - (message "%s\n" found) + (setq user-full-name (car found)) + ;; we get an error unless we do this. that is a bug. I could + ;; send a patch... also a bug: setting message-from-style nil + ;; doesnt work in mu4e unless user-full-name is also nil. + (unless user-full-name + (setq message-from-style nil)) (setq user-mail-address (cdr found) - user-full-name (car found) - mail-signature sig)) + mail-signature nil)) found))) (defun iank-set-from (regexes) "If we find an address matching regex, then set that address as the to, @@ -961,12 +965,13 @@ and Ian Kelling as the name" (my-mu4e-commmon) (setq user-mail-address "iank@fsf.org" + iank-user-mail-address user-mail-address ;; WARNING: be careful editing this, there needs to be a space after --, and my editor ;; and git will automatically remove it unless i manually disable it. mail-signature fsf-sig ) ;; end setq (add-hook 'mu4e-compose-pre-hook 'my-mu4e-to) - (mu4e)) ;; end defun fsf-mu4e + (mu4e)) @@ -1548,7 +1553,7 @@ and Ian Kelling as the name" ;; from tramp manual, use the same ssh controlmaster. I was having problems with ;; tramp prompting me for a username and pass. -(customize-set-variable 'tramp-use-ssh-controlmaster-options nil) + (customize-set-variable 'tramp-use-ssh-controlmaster-options nil) (setq auto-revert-interval 2 @@ -1577,8 +1582,6 @@ and Ian Kelling as the name" ;; give us a shell to start instead of scratch ;;(setq initial-buffer-choice (lambda () (new-shell))) - ;; disable this nasty function, as I always use a gui - (defun suspend-frame() (interactive)) ;; Seed the random-number generator (random t) @@ -1586,6 +1589,14 @@ and Ian Kelling as the name" ;; easier to remember than keybinds (defalias 'scrypt 'mml-secure-message-encrypt-pgpmime) (defalias 'sign 'mml-secure-message-sign-pgpmime) + ;; otherwise we get error on sending: + ;; mml-secure-epg-sign: Couldn’t find any signer names; try setting `mml-secure-smime-sign-with-sender'. + ;; i dunno why sign+encrypt doesnt cause this, seems kinda dumb, + ;; + (setq mml-secure-openpgp-sign-with-sender t) + ;; i dun use smime, the smime signing fails complaining it doesnt have + ;; my key. todo: learn about smime + (setq mml-secure-smime-sign-with-sender t) (defun encrypt () (interactive) (mml-secure-message-encrypt-pgpmime 'dontsign)) @@ -2141,8 +2152,8 @@ indent yanked text (with prefix arg don't indent)." ;;; shell mode -;; # eval: (outline-minor-mode) -;; # outline-regexp: "\\( *\\)# [*]\\{1,8\\} " + ;; # eval: (outline-minor-mode) + ;; # outline-regexp: "\\( *\\)# [*]\\{1,8\\} " ;; avoid stupid git crap like "warning, terminal not fully functional" @@ -2438,7 +2449,7 @@ indent yanked text (with prefix arg don't indent)." ;;;; single/special keys ;;;;; tab - isearch - (define-key isearch-mode-map (kbd "") 'isearch-query-replace) + (define-key isearch-mode-map (kbd "TAB") 'isearch-query-replace) ;;;;; f12 - isearch-forward ;; explained in http://stackoverflow.com/questions/7411920/how-to-bind-search-and-search-repeat-to-c-f-in-emacs @@ -2492,7 +2503,10 @@ indent yanked text (with prefix arg don't indent)." (global-set-key (kbd "") 'back-to-indentation-or-beginning) ;;;;; s-tab - indent-buffer + ;; graphical (global-set-key (kbd "") 'indent-buffer) + ;; terminal + (global-set-key (kbd "") 'indent-buffer) ;;;;; s-delete - send-shell (global-set-key (kbd "") 'send-shell) @@ -2676,11 +2690,12 @@ modes like org-mode which have their own yank function." ;; stop splitting windows verticallly when I open a buffer or shell (setq split-height-threshold nil) -;;;;; s-left arrow - shell - (global-set-key (kbd "") 'shell-wrap) - (add-hook 'org-mode-hook - (lambda () - (define-key org-mode-map (kbd "") nil))) +;;;;; s-left arrow - --- + ;; cant be used in terminal + ;; When I had a binding, i did this so org-mode wouldnt clobber it + ;; (add-hook 'org-mode-hook + ;; (lambda () + ;; (define-key org-mode-map (kbd "") nil))) ;;;;; s-right arrow - keyboard-yank-primary (defun keyboard-yank-primary () @@ -2726,7 +2741,7 @@ modes like org-mode which have their own yank function." ;; kp-enter is shift return in terminal (global-set-key (kbd "") 'flyspell-auto-correct-previous-word) -;;;;; s-down arrow - my-contract-region +;;;;; s-up arrow - my-contract-region (global-set-key (kbd "") 'my-contract-region) ;;;;; c-up/down move 8 lines @@ -2785,16 +2800,6 @@ modes like org-mode which have their own yank function." ;;;; left primary -;;;;; C-2 copy-symbol - - (global-unset-key (kbd "C-2")) - (defun copy-symbol (&optional arg) - "Copy symbol at point into kill-ring" - (interactive "P") - (kill-new (thing-at-point 'symbol))) - - (global-set-key (kbd "C-2") 'copy-symbol) - ;;;;; M-2 shell-cd-to-file @@ -2808,13 +2813,18 @@ modes like org-mode which have their own yank function." (message "%s" "shell-cd-to-file: buffer has no file name")))) (global-set-key (kbd "M-2") 'shell-cd-to-file) -;;;;; C-M-2 --- - ; todo. whats going on here? +;;;;; C-M-2 copy-symbol (global-unset-key (kbd "C-M-2")) + (defun copy-symbol (&optional arg) + "Copy symbol at point into kill-ring" + (interactive "P") + (kill-new (thing-at-point 'symbol))) + + (global-set-key (kbd "C-M-2") 'copy-symbol) -;;;;; C-3 dot-mode-execute +;;;;; M-3 dot-mode-execute - (global-set-key (kbd "C-3") 'dot-mode-execute) + (global-set-key (kbd "M-3") 'dot-mode-execute) ;;;;; C-M-3 recenter-top-bottom @@ -2837,13 +2847,13 @@ modes like org-mode which have their own yank function." (global-set-key (kbd "C-M-q") 'quoted-insert) -;;;;; C-w +;;;;; C-w counsel-find-file (global-set-key (kbd "C-w") 'counsel-find-file) -;;;;; M-w org-clock-in +;;;;; M-w shell - (global-set-key (kbd "M-w") 'org-clock-in) + (global-set-key (kbd "M-w") 'shell-wrap) ;;;;; C-e copy-line @@ -3008,10 +3018,7 @@ modes like org-mode which have their own yank function." (define-key org-mode-map (kbd "C-M-f") 'org-kill-line))) (global-set-key (kbd "C-M-f") 'kill-line) -;;;;; C-g - cancel / other window - - (global-set-key (kbd "C-g") 'other-window) - +;;;;; C-g - keyboard-quit ;;;;; M-g - abort-recursive-edit (global-set-key (kbd "M-g") 'abort-recursive-edit) @@ -3021,8 +3028,12 @@ modes like org-mode which have their own yank function." (global-set-key (kbd "C-M-g") 'mu4e) ;;;;; C-z - undo-only - (global-set-key (kbd "C-z") 'undo-tree-undo) +;;;;; C-M-z - suspend-frame + (global-set-key (kbd "C-z") 'suspend-frame) + ;; previously, i meant to only use gui and ran this to + ;; be sure it never got ran + ;;(defun suspend-frame() (interactive)) ;;;;; C-x - kill-region @@ -3067,9 +3078,10 @@ modes like org-mode which have their own yank function." (define-key c-mode-base-map (kbd "") 'c-electric-delete-forward))) -;;;;; M-c - org-capture +;;;;; M-c - delete-other-windows - (define-key global-map "\M-c" 'org-capture) + ;; todo, consider binding/using org-capture + (define-key global-map "\M-c" 'delete-other-windows) ;;;;; C-M-c - copy-to-register @@ -3106,9 +3118,9 @@ modes like org-mode which have their own yank function." (global-set-key (kbd "C-M-v") 'yank-pop) -;;;;; C-b - delete-other-windows +;;;;; C-b - other-window - (global-set-key (kbd "C-b") 'delete-other-windows) + (global-set-key (kbd "C-b") 'other-window) ;;;;; M-b - isearch-backward-current-symbol @@ -3187,17 +3199,9 @@ modes like org-mode which have their own yank function." (global-set-key (kbd "") 'backward-kill-sexp) ;;;; right primary -;;;;; C-* - split-window-horizontally - - (global-set-key (kbd "C-*") 'split-window-horizontally) - -;;;;; C-M-* - calc-dispatch +;;;;; M-8 - delete-window-or-exit - (global-set-key (kbd "C-M-*") 'calc-dispatch) - -;;;;; C-9 - delete-window-or-exit - - (global-set-key (kbd "C-9") 'delete-window-or-exit) + (global-set-key (kbd "M-8") 'delete-window-or-exit) (defun delete-window-or-exit () "Delete window or exit emacs." @@ -3207,6 +3211,12 @@ modes like org-mode which have their own yank function." (progn (basic-save-buffer) (delete-frame)) (save-buffers-kill-terminal t)))) +;;;;; C-* - split-window-horizontally + (global-set-key (kbd "C-*") 'split-window-horizontally) +;;;;; C-M-* - calc-dispatch + + (global-set-key (kbd "C-M-*") 'calc-dispatch) + ;;;;; M-9 - kill-buffer (defun kill-buffer-no-ido () @@ -3245,7 +3255,15 @@ modes like org-mode which have their own yank function." )) ;;;;; C-i - - (define-key input-decode-map [?\C-i] [C-i]) + ;; todo: try making use + ;; this is the key in terminal + ;;M-[ 4 d is undefined + + ;; previously had this for enhancing graphical keybinds, + ;; but afaik its no help since i want terminal to work + ;; the same. + ;; (define-key input-decode-map [?\C-i] [C-i]) + ;;;;; C-M-i - query-replace-regexp (global-set-key (kbd "C-M-i") 'query-replace-regexp) @@ -3336,8 +3354,10 @@ modes like org-mode which have their own yank function." (move-beginning-of-line 2)) (global-set-key (kbd "C-M-;") 'comment-current-line-dwim) -;;;;; C-m - (define-key input-decode-map [?\C-m] [C-m]) +;;;;; C-m - --- + ;; terminal/console needs this. otherwise, we could do this + ;; to make C-m be a valid key in graphical mode. + ;; (define-key input-decode-map [?\C-m] [C-m]) ;;;;; C-M-m - recursive grep (define-key global-map (kbd "C-M-m") 'rgrep) @@ -3412,10 +3432,6 @@ modes like org-mode which have their own yank function." -;;;;; C-8 - calc-embedded-word - - (global-set-key (kbd "C-8") 'calc-embedded-word) - ;;;;; C-up-arrow - org prev headline ;; disabled just because i don't want to accidentally hit it @@ -3587,6 +3603,10 @@ modes like org-mode which have their own yank function." (global-set-key (kbd "C-M-6") 'insert-small-copyright) +;;;;; M-7 - calc-embedded-word + + (global-set-key (kbd "M-7") 'calc-embedded-word) + ;;;;; C-M-7 - insert-full-copyright (defun insert-full-copyright ()