Skip to content

Commit

Permalink
fix keybinding for term mode line/char switch
Browse files Browse the repository at this point in the history
  • Loading branch information
maryrosecook committed May 27, 2015
1 parent ee777d0 commit 988a5e2
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions init.el
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,22 @@
(split-window-sensibly (selected-window))
(other-window 1)
(ansi-term "/bin/bash"))
(switch-to-buffer-other-window "*ansi-term*")))
(switch-to-buffer "*ansi-term*")))

;; allow toggling between line mode and char mode in ansi-term using C-x C-j
(global-set-key (kbd "C-x C-j") 'jnm/term-toggle-mode)

(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)))

;; make ansi-term have infinite buffer size (scrollback)
(add-hook 'term-mode-hook
(lambda ()
(setq term-buffer-maximum-size 10000)))

;; Make C-u equivalent to C-x (for my dvorak keyboard)
(keyboard-translate ?\C-x ?\C-u)
Expand Down Expand Up @@ -271,19 +286,6 @@
;; 'minor-mode-alist ;; don't show minor modes
'(global-mode-string (global-mode-string)))))


;; allow toggling between line mode and char mode in ansi-term using C-x C-j

(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-j") 'jnm/term-toggle-mode)
(define-key term-raw-map (kbd "C-x C-j") 'jnm/term-toggle-mode)

;; source: http://steve.yegge.googlepages.com/my-dot-emacs-file
(defun rename-file-and-buffer (new-name)
"Renames both current buffer and file it's visiting to NEW-NAME."
Expand Down

0 comments on commit 988a5e2

Please sign in to comment.