Ask Your Question
0

Use Vi keys in sage console

asked 2016-09-17 15:54:01 +0200

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

I wish to have the sage console use the vi-style editing keys instead of the default emacs ones. I have configured IPython to do this already, but sage does not respect this option. Any help would be appreciated.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-12-20 07:58:48 +0200

Sage uses its own version of ipython with its own startup files. Those startup files should be under $DOT_SAGE/ipython-X.Y.Z/ ; so for me, the interesting directory is in ~/.sage/ipython-5.0.0/profile_default/ . There was no ipython_config.py file in there, so I copied it from the .ipython directory.

So here is what I did to get vi keybindings to work:

  1. Get vi keybindings to work in ipython by adding the line c.TerminalInteractiveShell.editing_mode = 'vi' to .ipython/profile_default/ipython_config.py
  2. cp -n ~/.ipython/profile_default/ipython_config.py ~/.sage/ipython-5.0.0/profile_default/
edit flag offensive delete link more

Comments

If you don't have the ipython_config.py file, you can create it with > ipython profile create [profilename] in the terminal. It will also populate the file with all possible options including vi mode. (And thank you @Eigentime, it solved it for me)

LAV gravatar imageLAV ( 2018-02-08 14:29:11 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-09-17 15:54:01 +0200

Seen: 567 times

Last updated: Sep 17 '16