diff options
| author | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2019-05-17 20:03:47 +0200 |
|---|---|---|
| committer | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2019-05-17 20:03:47 +0200 |
| commit | 6473d813fd7e65db75842fd15715b46c8e23e492 (patch) | |
| tree | b94d9aef056be24f5f6866db394b2136e968dd87 | |
| parent | 9430e438f3c6847107554ac57bbc9b1f22def7a7 (diff) | |
| download | dotfiles-6473d813fd7e65db75842fd15715b46c8e23e492.tar.xz | |
Add keybindings to switch to specific input methods
| -rw-r--r-- | .emacs | 49 |
1 files changed, 30 insertions, 19 deletions
@@ -36,25 +36,6 @@ (global-set-key (kbd "C-x C-b") 'ibuffer) -;; C-c [[:alpha:]] is reserved for users - let's make good use of it. - -(global-set-key (kbd "C-c c") 'compile) -(global-set-key (kbd "C-c e f") 'auto-fill-mode) -(global-set-key (kbd "C-c k f") 'my/kill-ring-filename) -(global-set-key (kbd "C-c k |") 'my/kill-ring-pipe-region) -(global-set-key (kbd "C-c k !") 'my/kill-ring-shell) -(global-set-key (kbd "C-c m") 'man) -(global-set-key (kbd "C-c p c") 'my/project-compile) -(global-set-key (kbd "C-c p f") 'project-find-file) -(global-set-key (kbd "C-c t") 'toggle-truncate-lines) -(global-set-key (kbd "C-c v") 'visual-line-mode) -(global-set-key (kbd "C-c w c") 'whitespace-cleanup) -(global-set-key (kbd "C-c w f") 'page-break-lines-mode) -(global-set-key (kbd "C-c w m") 'whitespace-mode) -(global-set-key (kbd "C-c w t") 'my/set-tab-width) - -(rg-enable-default-bindings) ; Uses the C-c s prefix. - ;; Hopefully these will be easier to remember than TeX commands: (require 'quail) @@ -76,6 +57,36 @@ ;; Pictograms '("/!\\" ?⚠))) +(defun my/make-toggle-input-method (input-method) + (lambda () + (interactive) + ;; `current-input-method' is a string; if INPUT-METHOD is a + ;; symbol, neither eq, eql nor equal would return t. + (if (string= current-input-method input-method) + (deactivate-input-method) + (set-input-method input-method t)))) + +;; C-c [[:alpha:]] is reserved for users - let's make good use of it. + +(global-set-key (kbd "C-c c") 'compile) +(global-set-key (kbd "C-c e f") 'auto-fill-mode) +(global-set-key (kbd "C-c i t") (my/make-toggle-input-method 'TeX)) +(global-set-key (kbd "C-c i u") (my/make-toggle-input-method 'my/input-method)) +(global-set-key (kbd "C-c k f") 'my/kill-ring-filename) +(global-set-key (kbd "C-c k |") 'my/kill-ring-pipe-region) +(global-set-key (kbd "C-c k !") 'my/kill-ring-shell) +(global-set-key (kbd "C-c m") 'man) +(global-set-key (kbd "C-c p c") 'my/project-compile) +(global-set-key (kbd "C-c p f") 'project-find-file) +(global-set-key (kbd "C-c t") 'toggle-truncate-lines) +(global-set-key (kbd "C-c v") 'visual-line-mode) +(global-set-key (kbd "C-c w c") 'whitespace-cleanup) +(global-set-key (kbd "C-c w f") 'page-break-lines-mode) +(global-set-key (kbd "C-c w m") 'whitespace-mode) +(global-set-key (kbd "C-c w t") 'my/set-tab-width) + +(rg-enable-default-bindings) ; Uses the C-c s prefix. + ;; What's life without a little risk? (setq disabled-command-function nil) |
