Skip to content

Instantly share code, notes, and snippets.

@andiogenes
Created March 20, 2025 05:17
Show Gist options
  • Save andiogenes/246265cc5a1bc469e5021c6130f951aa to your computer and use it in GitHub Desktop.
Save andiogenes/246265cc5a1bc469e5021c6130f951aa to your computer and use it in GitHub Desktop.
Open shell in directory corresponding to buffer
(defun shell-here ()
"Create new shell rooted at default-directory and open it in
new window if there is no other shells associated with
default-directory, open existing shell otherwise."
(interactive)
(let* ((buffer-dir (directory-file-name (expand-file-name default-directory)))
(shell-buffer-name (concat "*shell*<" buffer-dir "/>")))
(shell shell-buffer-name)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment