Hello,
I am on arch linux. I try to set up Julia to use vi editing mode in a repl session but that somehow doesn鈥檛 work. I set set -o vi
in my ~/.bashrc
and set editing-mode vi
,
set keymap vi-command
in my ~/.inputrc
. But somehow Julia doesn鈥檛 pick up on that. I compiled Julia from source with all dependencies in a directory. It does not use any system provided libraries apart from pcre 8.35-1
. (Because pcre
will fail tests with the recent version of gcc
(4.9).) Other repls like R
or Python
do respect vi editing mode. Is there a way to get Julia to use vi editing?
I have the following in my .profile
file
export JULIA_EDITOR=vim
, but I can't find the documentation for that now.
Unfortunately, your solution doesn鈥檛 work for me. I wonder what is causing this.
Do you mean the behaviour provided by GNU Readline [1]? Julia's REPL used to use Readline but that was replaced by a pure Julia implementation in #6270, so there's probably no vi mode unless I've missed something.
[1] http://www.gnu.org/software/bash/manual/html_node/Readline-vi-Mode.html
Yes, I was talking about GNU Readline. Thanks so much for the link Michael that helped a lot. Does this bear on the README entry where it is stated that Shift-Return
can be set to insert a linefeed rather than evaluate the command in ~/.xmodmaprc
?
Yes, that is outdated. See #6775. There is now no difference between \r
and \n
; use meta-Enter
to insert a newline.
Thanks for clarifying that @mbauman.
While I don't use vi mode myself, I think this could remain open as a feature request.
Agreed. I think it's a decent up-for-grabs kind of issue. The backend for adding custom user keybindings is already there; it just needs to be exposed by an API. Adding the extra layer of vi's modality (switching keymaps on insert and command modes) would be a much bigger challenge, but I think it'd be doable for an intrepid vi user.
Agreed.
An alternative might be to use vim-ipython together with IJulia. For me it seems to work pretty well but with some quirks as vim-ipython assumes a python kernel. See ivanov/vim-ipython#74
Should be possible to use rlwrap
(https://github.com/hanslub42/rlwrap -- you should be able to apt-get it , iirc) to wrap julia back inside GNU readline, getting back vi mode.
While vi bindings would be cool, I doubt they would ever get shipped with Base. Adding a vi mode to the REPL deserves to be in a package.
vi mode would be great
+1
would love to have vi mode.
Also +1 for vi keybindings.
The hooks already exist for creating a vi mode via a package. Someone just needs to write that package.
Most helpful comment
While vi bindings would be cool, I doubt they would ever get shipped with Base. Adding a vi mode to the REPL deserves to be in a package.