I recently discovered auto-completetion in the python interperter here: https://docs.python.org/2.7/tutorial/interactive.html . This is fantastic for speeding up tests that I do in the interactive interpreter. There are two things that complete does that are both useful.
If I simply put C+f: complete
in my .inputrc (or use readline without rlcompleter), when I press Ctl+f, I get completion of files in the directory that I started the interpreter from. When I load the modules readline
and rlcompleter
and add readline.parse_and_bind('C-n: complete')
to the .pystartup file, it converts both the Ctl+n and Ctl+f to auto completing python objects.
I would like to do both, but am not sure how to keep rlcompleter
from overriding the standard complete. Is there a way to start up two instances of readline
, one that does and one that doesn't use rlcompleter
?
Here is my .pystartup file
import atexit
import os
import readline
import rlcompleter #removing this does file completion.
readline.parse_and_bind('C-n: complete')
historyPath = os.path.expanduser("~/.pyhistory")
def save_history(historyPath=historyPath):
import readline
readline.write_history_file(historyPath)
if os.path.exists(historyPath):
readline.read_history_file(historyPath)
atexit.register(save_history)
del os, atexit, readline, rlcompleter, save_history, historyPath