Last active
January 8, 2023 16:31
-
-
Save msoeken/4b2e3ee07b7252f8cb99 to your computer and use it in GitHub Desktop.
Toggle between current buffer and terminal in emacs
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
(defun toggle-term () | |
"Toggles between terminal and current buffer (creates terminal, if none exists)" | |
(interactive) | |
(if (string= (buffer-name) "*ansi-term*") | |
(switch-to-buffer (other-buffer (current-buffer))) | |
(if (get-buffer "*ansi-term*") | |
(switch-to-buffer "*ansi-term*") | |
(progn | |
(ansi-term (getenv "SHELL")) | |
(setq show-trailing-whitespace nil))))) | |
(global-set-key (kbd "<f9>") 'toggle-term) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment