Last active
December 27, 2019 22:51
-
-
Save olmstadfm/6d589af3c776ad9be9016777684a30d8 to your computer and use it in GitHub Desktop.
Emacs - global hotkey to toggle read-only mode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Wdired-mode | |
;; | |
;; (C-c C-c to commit changes) | |
;; | |
(define-key dired-mode-map (kbd "C-x C-q") 'wdired-change-to-wdired-mode) | |
;; Wgrep-mode | |
;; | |
;; (C-c C-c to commit changes) | |
;; | |
(require 'wgrep) | |
(define-key grep-mode-map (kbd "C-x C-q") 'wgrep-change-to-wgrep-mode) | |
;; Occur-edit-mode | |
;; | |
;; (C-c C-c to commit changes) | |
;; | |
(define-key occur-mode-map (kbd "C-x C-q") 'occur-edit-mode) | |
;; Term-mode | |
;; | |
;; via http://joelmccracken.github.io/entries/switching-between-term-mode-and-line-mode-in-emacs-term/ | |
;; | |
(defun jnm/term-toggle-mode () | |
"Toggles term between line mode and char mode" | |
(interactive) | |
(if (term-in-line-mode) | |
(term-char-mode) | |
(term-line-mode))) | |
(define-key term-mode-map (kbd "C-x C-q") 'jnm/term-toggle-mode) | |
(define-key term-raw-map (kbd "C-x C-q") 'jnm/term-toggle-mode) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment