ctrlshiftbryan
IEx in Spacemacs terminal
I’ve been trying to get iex to work a spacemacs terminal but it doesn’t seem to be sending the up or down arrows to cycle through history.
I found this possible solution but don’t understand enough about spacemacs/emacs to get it working.
I tried adding this to my user-config but it didn’t do anything.
(defun term-send-up () (interactive) (term-send-raw-string “\e[A”))
(defun term-send-down () (interactive) (term-send-raw-string “\e[B”))
(defun term-send-right () (interactive) (term-send-raw-string “\e[C”))
(defun term-send-left () (interactive) (term-send-raw-string “\e[D”))
Has anyone else been able to get iex working in a spacemacs terminal?
I know alchemist iex is an option but I really prefer iex from a terminal? (alchemist iex seems to keep its own history of commands or something instead of actually sending the up arrow command to iex)
Most Liked
modraedlau
You can do this in ‘user-config’ as following:
(defun mo/term-send-up () (interactive) (term-send-raw-string "\e[A"))
(defun mo/term-send-down () (interactive) (term-send-raw-string "\e[B"))
(defun mo/term-send-right () (interactive) (term-send-raw-string "\e[C"))
(defun mo/term-send-left () (interactive) (term-send-raw-string "\e[D"))
(defun mo/setup-term-send-arrow-keys ()
(evil-local-set-key 'insert (kbd "<up>") 'mo/term-send-up)
(evil-local-set-key 'insert (kbd "<down>") 'mo/term-send-down)
(evil-local-set-key 'insert (kbd "<right>") 'mo/term-send-right)
(evil-local-set-key 'insert (kbd "<left>") 'mo/term-send-left)
)
(add-hook 'term-mode-hook 'mo/setup-term-send-arrow-keys)
alanm
Copy and paste this:
(defun term-send-up () (interactive) (term-send-raw-string “\e[A”))
(defun term-send-down () (interactive) (term-send-raw-string “\e[B”))
(defun term-send-right () (interactive) (term-send-raw-string “\e[C”))
(defun term-send-left () (interactive) (term-send-raw-string “\e[D”))
In your spacemacs.local between (defun dotspacemacs/user-init () and (defun dotspacemacs/user-config () as shown in the following:
...
(defun dotspacemacs/user-init ()
...
)
(defun term-send-up () (interactive) (term-send-raw-string "\e[A"))
(defun term-send-down () (interactive) (term-send-raw-string "\e[B"))
(defun term-send-right () (interactive) (term-send-raw-string "\e[C"))
(defun term-send-left () (interactive) (term-send-raw-string "\e[D"))
(defun dotspacemacs/user-config ()
...
restart spacemacs.
Now you have to use a terminal ‘shell’ instead of the default’ansi-term’ terminal, use spc-a-s-i to open a shell terminal, inside there you can cycle through commands history in the prompt using arrow keys, in erl and in iex.
hope it helps.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









