Thank you to Mrdotb for the original repo which I have forked.
- Works on macos with Zsh
- When pasting from fzf back to IEX doesn't enter and submit the selected history automatically to the repl
- Allows you to leverage this solution with depending without tmux permanently, tmux only runs when you use the run_iex shell function then quits when we press "F10"
- Exit iex-fzf easily pressing ESC without leaving exit code
o
in the iex repl - Allows you to open iex to tmux fzf-enabled-mode and pass arguments to leverage this mode regardless of what iex use-case you have
- Run multiple iex tmux sessions that don't effect each other
Occasionally the fzf doesn't paste back to the iex repl this is a very intermittent problem I have noticed rarely in this case re-try fzf and it should work perfectly again. If not quit iex-tmux with 'F10' then reload iex however I have never had to do this.
Feel free to raise any issues or suggested improvements/fixes/updates.
Due to the nature of this project using tmux (for now) for pane splitting and piping between terminal sessions it will not work via ssh unless the remote server has tmux & fzf enabled.
Hard requirements:
brew install tmux
See here for latest
Run the following to your terminal I put in ~ but feel free to put it where you want
git clone https://github.com/AJReade/elixir-iex-fzf ~/.iex-history
cd ~/.iex-history
MIX_ENV=prod mix escript.build
Next to ensure the binary & shell script can execute:
read the shell code for your self execute at own risk.
chmod +x ~/.iex-history/iex-history
chmod +x ~/.iex-history/iex-history.sh
chmod +x ~/.iex-history/iex-history-shortcuts.sh
Next we edit our ~/.zshrc file:
I have set my alias shortcut to i then passing argument to that, feel free to do whatever is convenient.
# iex-history plugin
export PATH="<YOUR-HOME>.iex-history:$PATH"
alias i="run_iex"
alias is="run_iex -S mix phx.server"
source ~/.iex-history/iex-history-shortcuts.sh
The tmux binding I use is ctrl-r
, as I only use tmux for iex.
I also use F10
to exit tmux and iex simultaneously.
The set -g mouse on
allow you to scroll as normal in tmux.
bind-key -n F10 send-keys C-\\ \; kill-session
set -g mouse on
bind-key -n C-r run-shell "zsh ~/.iex-history/iex-history.sh #{session_name} #{window_id} #D #{pane_current_command}"
Don't forget to reload tmux config, press ^b
then :
keys and paste below:
source-file ~/.tmux.conf
Also reload your ~/.zshrc
my entering the below in the command line:
source ~/.zshrc