Nairebis
Nairebis

Reputation: 283

How to get php readline() to default to Vim mode?

This is on CentOS 7.2, PHP version 5.6.20. According to readline_info():

<?php
print_r(readline_info());

gives

Array
(
    [line_buffer] =>
    [point] => 0
    [end] => 0
    [library_version] => EditLine wrapper
    [readline_name] =>
    [attempted_completion_over] => 0
)

OK, so readline() is using EditLine. I created a ~/.editrc file with:

bind -v

The permission is 664. I then tried:

<?php
    $line = readline('Enter: ');

But it doesn't seem to read the file, and it's not in Vim mode. Doing an Alt-X followed by a manual command of "bind -v" puts it in Vim mode, so I know it has Vim mode.

I read somewhere else that I might need to manually set the path in an environment variable. So tried setting the full path:

$ export EDITRC=/home/work/.editrc

Still nothing. I've also seen that "export EL_EDITOR=vi" is supposed to work, but still doesn't work.

Does anyone have any way to make this work? I really need Vim mode to work.

Upvotes: 3

Views: 215

Answers (0)

Related Questions