Enabling vi key bindings in IPython qtconsole - ipython

I have enabled vi mode in my ~/.inputrc using the following lines in my mac.
set editing-mode vi
When I use IPython in terminal, I am getting proper vi key bindings, but when I use IPython in QtConsole using the command ipython qtconsole the vi key bindings don't work.
Is there anything else I have to do to get vi key bindings in IPython QtConsole?

Qt console is not built around readline or anything related to the OS terminal. It's a Qt widget that mimics much of the behavior of terminal IPython and also has several cool features of its own (like inline plots and the ability to render Latex).
It comes with a lot of key bindings (which you can find by going to the menu Help > Show QtConsole Help) but unfortunately none of them is customizable.

Related

Org-mode with Emacs: Where do I have to put my export in order to be able to use it in Emacs daemon?

I am struggling since this morning after the installation of CUDA 9 and cudnn 7. I am running emacs as a daemon, zsh as my default shell and I want to user org-mode to write notebook.
Here is my .zshenv:
...
export LIBRARY_PATH="/usr/include/gtk-3.0:$LIBRARY_PATH"
export LD_LIBRARY_PATH="/usr/local/cuda-9.0/lib64:$LD_LIBRARY_FOUND"
export PATH="/usr/local/cuda-9.0/bin:$PATH"
export SHELL="/bin/zsh"
export WORKON_HOME=$HOME/.virtualenvs
and here is the minimal notebook:
#+BEGIN_SRC ipython :results drawer :async t :session test
import os
print(os.environ["LD_LIBRARY_PATH"])
#+END_SRC
The problem is that emacs does not know LD_LIBRARY_PATH. It says KeyError.
Do you know where I can put my environment variables in order to be able to be read both by my terminal and Emacs-As-A-Daemon ? I thought it was in .zshenv and .zprofile but neither of them is working in daemon mode... (Because yes, it is working when I launch it regularly).
Precision:
The content of os.environ shows that it seems to read the .profile file only... But why ? My default terminal is zsh, not bash. I tried to put my export in .zprofile, restart systemd daemon of emacs, even rebooting, but without any effect.. Sorry if this is a silly question.
Alright, I succeed to solve my issue. Instead of dealing with Emacs configuration, I changed the systemd unit file with the addition of the EnvironmentFile variable which I set it equal to the path of my .zshenv:
EnvironmentFile=~/.zshenv

Stop ipython pop-up docs

In the ipython qtconsole it automatically displays the documentation for a function when I type the opening parenthesis. For example, when I'm typing
plt.show()
the documentation for pyplot.show is displayed when I've typed
plt.show(
This documentation is displayed in a pop-up window that, much more often than not, blocks my view what I'm typing. Is there a configuration to stop the ipython qtconsole from doing this?
The feature to which you refer is calltips or more precisely IPythonWidget.enable_calltips and is documented at https://ipython.org/ipython-doc/dev/config/options/qtconsole.html. The only effective way I have found to disable it is by adding --IPythonWidget.enable_calltips=False as an argument to qtconsole that in turn an argument of ipython. A command line for all of this is:
ipython qtconsole --IPythonWidget.enable_calltips=False
I have verified this with IPython QTConsole 3.2.0 and believe it generally works for versions below 4, which I have not been able to install yet without breaking QTConsole. (I believe what some refer to as IPython 4 is also known as Jupyter 4. See below for information on Jupyter and disabling calltips in it.)
On Linux and Windows system, generating this command line can be automated using a bash alias. On Windows it can be automated by using it as the Target of an icon configured in its properties.
It is supposed to be possible to disable calltips by setting c.IPythonWidget.enable_calltips = False in the right configuraton file in which c = get_config() is set on the first line. I tried doing this on a Windows 7 system in ipython_qtconsole_config.py and ipython_config.py in ~.ipython\profile_default\ and several other locations, but could not get it to work.
Project Jupyter is the successor to the IPython project and began in 2014. Its website is http://jupyter.org and information about its Qt console is at http://jupyter.org/qtconsole/stable/index.html. In response to a question about disabling IPython calltips, which I submitted to https://github.com/ipython/ipython/issues, I received the following on how to disable calltips for Jupyter:
On the command line
jupyter qtconsole --JupyterWidget.enable_calltips=False
or add
c.JupyterWidget.enable_calltips = False
to
~/.jupyter/juptyer_qtconsole_config.py

How to use ipython ZMQ-based console by default

I often use ipython with vim (vim-ipython plugin). It connects to ipython via ZMQ, so I need to run ipython console. I don't see any purpose to not use ipython console even if I don't use ZMQ features, so I want ipython to start ZMQ-based console without typing console. I know, that this problem could be partly solved with bash aliases, but I think that I would have problems with launching qtconsole or notebook.
We don't provide any way to make ipython console the default, and we're probably not about to, as it gets much less field testing than the regular terminal IPython. I'd recommend you just alias another convenient name to it.

The tab indent in emacs ipython shell

The environment is Emacs 24.1.1 on Ubuntu. using Ipython for python programming.
The auto indent is works well when running ipython command on shell directly, but when i come to emacs run ipython there is no auto indent any more. and even worse when i type TAB it will prompt the Completion buffer.I also have searched this issue many times but still not found a practical method. as a result i have to enter space manually.
anyone could help to resolve this issue ?
1. auto indent on emacs ipython shell
2. disable completion on emacs ipython shell separately.keep the Tab-completion work when i am not in ipython interactive shell.
In emacs you can use python-mode, and from there send the code to *REPL* buffer with C-c C-c.
When you send the buffer for the first time, it asks you what executable you use for python, so you can use ipython, or other one.
Any invocation of ipython-shell should do a correct setup.
Please file a bug-report.
If running python-mode.el -- modeline shows "Py" --
please checkout current trunk first
When bazaar is available
bzr branch lp:python-mode

IPython qtconsole highlighting

I am using the IPython qtconsole and the directories are dark blue and I can't seem to find any way to change this in the theme. I'm using pygments with the monokai theme for the syntax highlighting.
This coloring is actually done by ls itself.
You can use the LSCOLORS ( on OS X / BSD, or LS_COLORS on Linux) environment variable to customize this.
Here is a nifty utility for generating an LSCOLORS value.
You can probably Google-about for peoples favored dark-background LSCOLORS values.
Then just set the variable, either in Python:
import os
os.environ['LSCOLORS'] = 'gxfxcxdxbxegedabagacad'
or in your shell session prior to launching IPython (or .bashrc, etc.):
$> export LSCOLORS=gxfxcxdxbxegedabagacad
$> ipython qtconsole
see also: reference docs for LS_COLORS