Add support to start external terminal emulators in context.

Integrated terminal emulators/integrated shells get the job done for
quick-and-dirty shell commands, but a lot of people take great care to tweak
their terminal workflow exactly to their liking. This makes it possible to
switch to that workflow seamlessly, by opening their terminal emulator of
choosing in the current directory or at the project root, and even supports
working over `ssh` using `tramp`.
This commit is contained in:
Uros Perisic 2019-02-06 00:55:49 -08:00 committed by Maximilian Wolff
parent db005ca406
commit 628fe9adba
No known key found for this signature in database
GPG key ID: 2DD07025BFDBD89A
3 changed files with 27 additions and 6 deletions

View file

@ -22,6 +22,7 @@
- [[#configuration][Configuration]]
- [[#default-shell][Default shell]]
- [[#default-shell-position-width-and-height][Default shell position, width, and height]]
- [[#external-terminal-emulator][External terminal emulator]]
- [[#set-shell-for-term-ansi-term-and-vterm][Set shell for term, ansi-term and vterm]]
- [[#set-shell-for-multi-term][Set shell for multi-term]]
- [[#width-of-the-shell-popup-buffers][Width of the shell popup buffers]]
@ -39,6 +40,7 @@ This layer configures the various shells available in Emacs.
** Features:
- Shell integration
- Running external terminal emulator in current/project directory
* Install
To use this configuration layer, add it to your =~/.spacemacs=. You will need to
@ -144,6 +146,12 @@ your shell is positioned on the left or the right.
shell-default-width 40)))
#+END_SRC
** External terminal emulator
This layer supports opening an external terminal emulator using [[https://github.com/davidshepherd7/terminal-here][terminal-here]].
By default =terminal-here= finds an appropriate default shell for you.
If this does not work please check the package documentation how to
change it.
** Set shell for term, ansi-term and vterm
The default shell can be set by setting the variable =shell-default-term-shell=.
Default value is =/bin/bash=.
@ -280,7 +288,9 @@ Some advanced configuration is setup for =eshell= in this layer:
| Key binding | Description |
|-------------+------------------------------------------------------------|
| ~SPC '~ | Open, close or go to the default shell |
| ~SPC p '~ | Open a shell in the project's root |
| ~SPC "~ | Open external terminal emulator in current directory |
| ~SPC p '~ | Open a shell in the projects root |
| ~SPC p "~ | Open external terminal emulator in project root |
| ~SPC a s e~ | Open, close or go to an =eshell= |
| ~SPC a s i~ | Open, close or go to a =shell= |
| ~SPC a s m~ | Open, close or go to a =multi-term= |

View file

@ -27,7 +27,7 @@
(defvar shell-default-position 'bottom
"Position of the shell. Possible values are `top', `bottom', `full',
`left' and `right'.")
`left' and `right'.")
(defvar shell-default-height 30
"Height in percents for the shell window.")
@ -40,16 +40,16 @@
(defvar shell-enable-smart-eshell nil
"If non-nil then `em-smart' is enabled. `em-smart' allows to quickly review
commands, modify old commands or enter a new one.")
commands, modify old commands or enter a new one.")
(defvar shell-protect-eshell-prompt t
"If non-nil then eshell's prompt is protected. This means that
movement to the prompt is inhibited like for `comint-mode'
prompts and the prompt is made read-only")
movement to the prompt is inhibited like for `comint-mode'
prompts and the prompt is made read-only")
(defvar shell-default-full-span t
"If non-nil, the `shell' buffer spans full width of a frame.")
(defvar close-window-with-terminal nil
"If non-nil, the window is closed when the terminal is stopped.
This is only applied to `term' and `ansi-term' modes.")
This is only applied to `term' and `ansi-term' modes.")

View file

@ -27,6 +27,7 @@
shell-pop
(term :location built-in)
xterm-color
terminal-here
vi-tilde-fringe
(vterm :toggle (not (spacemacs/system-is-mswindows)))
))
@ -293,6 +294,16 @@
(remove 'ansi-color-process-output comint-output-filter-functions))
(add-hook 'eshell-mode-hook 'spacemacs/init-eshell-xterm-color))))
(defun shell/init-terminal-here ()
:defer t
:init
(progn
(spacemacs/register-repl 'terminal-here 'terminal-here)
(spacemacs/set-leader-keys
"\"" 'terminal-here-launch
"p \"" 'terminal-here-project-launch)
))
(defun shell/post-init-vi-tilde-fringe ()
(spacemacs/add-to-hooks 'spacemacs/disable-vi-tilde-fringe
'(comint-mode-hook