Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I would like to map Ctrl-U to "kill line" when using Mathematica 9.0 in command line mode (i.e. not within the front end, but when called from a Unix command line by "math").

I am aware that (on a Mac) the directory /Applications/Mathematica.app/SystemFiles/FrontEnd/TextResources/Macintosh contains the file "KeyEventTranslations.tr", however this file seems to only affect the front end, not the behavior of the kernel when called from the command line.

I also know that Ctrl-C and Ctrl-G are already mapped to "Kill line" (although they don't seem to have corresponding entries in "KeyEventTranslations.tr"). But I would prefer to use Ctrl-U since this is what I am using in all other applications. (Note: Ctrl-U used to work in Math 8.0).

share|improve this question
    
    
Please see my answer in the above link. This should help you. –  halirutan Aug 14 '13 at 2:44
    
Hmm, it doesn't seem to work. Maybe one has to tweak rlwrap. At least you could have a look at this. –  halirutan Aug 14 '13 at 2:52
    
Ditto. I just did port -install rlwrap and then rlwrap .../MathKernel, but the problem persists. But thanks for the idea. I'd rather fix it in Mathematica than tweak rlwrap. –  edgeloss Aug 14 '13 at 2:54

1 Answer 1

According to a talk at the Wolfram Technical Conference last year, Mathematica 9's command-line interface now uses the GNU readline library. I believe that normally this library can be made to read its configuration settings from a file. However, in the talk (at about 23:00) he says that "currently they are hard coded, so it's a list of assignments, but ideally they should be read from a config file, so you should be able to reset to whatever you like." And on the screen it says "a user-defined config file is on TODO list." So my guess is that you are stuck with whatever he used until this is improved in a later version of Mathematica. If you really hate the new terminal input system (esp. on Windows, which already has its own superior keyboard editing support) you can get rid of it by deleting or renaming the file term.dll/libterm.so in SystemFiles/Kernel/Binaries/($SystemID).

share|improve this answer
1  
GNU readline is supposed to read ~/.inputrc, but it does not seem to be read by Mathematica. Removing ...Kernel/.../libterm.* does seem to work: it kills the Mathematica input system completely, and leaves the original one inherited from the shell. –  edgeloss Aug 14 '13 at 4:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.