http://qs1969.pair.com?node_id=1179334

jpl has asked for the wisdom of the Perl Monks concerning the following question:

I use the perl debugger a lot as a calculator, say when I'm doing exercises on Khan Academy. In my linux/ubuntu perl 5.22.1 environment, I can edit my debugger command line history using all the familiar (to me) vim commands, like cw to change the word "sin" to "cos", and . to change another instance in the same way. I recently went on the road with a MacBook, and found that editing the command line history didn't work there. I went so far as to install a new gcc compiler so I could build a new perl, and I installed Term::ReadLine::Perl, Term::ReadLine::Gnu and Term::ReadKey from CPAN. That gave me basic command line editing capabilities, but not the vim commands. I have no recollection of doing anything exotic to get vim and the debugger to play nice on linux, but I haven't turned up anything for how to do so in the OSX world. Suggestions (other than "use a different editor, Stupid") would be much appreciated.

Replies are listed 'Best First'.
Re: vim and debugger history (.inputrc)
by tye (Sage) on Jan 10, 2017 at 19:10 UTC

    You have to set 'vi' mode in your ~/.inputrc file. Such has worked for me in the Perl debugger, though I don't recall the details. The web suggests you try:

    set editing-mode vi set keymap vi-command

    - tye        

      The http://vim.wikia.com/wiki/Use_vi_shortcuts_in_terminal hit the mark. All I had to do was adjust my ~/.inputrc file on the Mac. This was last modified in 2006(!!!) on my linux box, so it's not a surprise that it was not fresh in my mind. Thanks to all.
Re: vim and debugger history
by LanX (Saint) on Jan 10, 2017 at 16:41 UTC
    It sounds as if you are using the debugger inside VIM (is there even an integration available?³), but I think you are calling vim from the debugger. (right?)

    AFAIR in the latter case you are able to customize an editor inside the debugger to edit multiple lines², wouldn't surprise me if Mac doesn't like VIM.°

    Or are you talking about switching only the line edit commands from GNU (i.e. emacs) to VI?

    IIRC there is a set option to do so.

    see http://vim.wikia.com/wiki/Use_vi_shortcuts_in_terminal

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Je suis Charlie!

    °) understandably as an emacser ;-)

    ²) seems what I remebered was the pager support, which doesn't really allow to edit the history though!

    see

    DB<1> h | |dbcmd Run debugger command, piping DB::OUT to current pager. ||dbcmd Same as |dbcmd but DB::OUT is temporarily select()ed as + well.

    ³) a sure Fritz Mehner of course :) http://www.vim.org/scripts/script.php?script_id=556

      Vim works on Mac OSX very well. Unlike your politics.
        Never denied it, Jeff!

        I was only talking about Mac politics to NOT favour it in default settings.

        Cheers Rolf
        (addicted to the Perl Programming Language and ☆☆☆☆ :)
        Je suis Charlie!

        PS: Sorry for feeding...