summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--emacs.d/core/core-bindings.el4
-rw-r--r--emacs.d/core/core-defun.el22
2 files changed, 14 insertions, 12 deletions
diff --git a/emacs.d/core/core-bindings.el b/emacs.d/core/core-bindings.el
index 91fc32a..377b89c 100644
--- a/emacs.d/core/core-bindings.el
+++ b/emacs.d/core/core-bindings.el
@@ -4,8 +4,8 @@
 
 (global-set-key (kbd "<s-return>") 'toggle-frame-fullscreen)
 
-(global-set-key (kbd "C-c C-d") 'fcuny-terminal)
+(global-set-key (kbd "C-c s") 'fcuny/visit-term-buffer)
 
-(global-set-key (kbd "s-N") 'switch-to-scratch)
+(global-set-key (kbd "s-N") 'fcuny/switch-to-scratch)
 
 (provide 'core-bindings)
diff --git a/emacs.d/core/core-defun.el b/emacs.d/core/core-defun.el
index a2fb02f..5180e68 100644
--- a/emacs.d/core/core-defun.el
+++ b/emacs.d/core/core-defun.el
@@ -1,12 +1,4 @@
-(defun fcuny-terminal ()
-  "Switch to terminal. Launch if nonexistent."
-  (interactive)
-  (if (get-buffer "*ansi-term*")
-      (switch-to-buffer "*ansi-term*")
-    (ansi-term "/bin/bash"))
-  (get-buffer-process "*ansi-term*"))
-
-(defun switch-to-scratch ()
+(defun fcuny/switch-to-scratch ()
   "Switch to scratch, grab the region if it's active."
   (interactive)
   (let ((contents
@@ -19,7 +11,7 @@
           (goto-char (buffer-end 1))
           (insert contents)))))
 
-(defun rename-this-buffer-and-file ()
+(defun fcuny/rename-this-buffer-and-file ()
   "Renames current buffer and file it is visiting."
   (interactive)
   (let ((name (buffer-name))
@@ -37,4 +29,14 @@
                (set-buffer-modified-p nil)
                (message "File '%s' successfully renamed to '%s'" name (file-name-nondirectory new-name))))))))
 
+(defun fcuny/visit-term-buffer ()
+  "Create or visit a terminal buffer."
+  (interactive)
+  (if (not (get-buffer "*ansi-term*"))
+      (progn
+        (split-window-sensibly (selected-window))
+        (other-window 1)
+        (ansi-term (getenv "SHELL")))
+    (switch-to-buffer-other-window "*ansi-term*")))
+
 (provide 'core-defun)