Ticket #67 (closed enhancement: fixed)

Opened 6 years ago

Last modified 3 years ago

Ctrl-P/Ctrl-N autocompletion

Reported by: tsee Owned by: tsee
Priority: minor Milestone: Satisfy all the requirements of PerlMonks
Component: Autocomplete Version: 0.47
Keywords: Cc:

Description

The current Ctrl-p autocompletion is modeled after what vim does. That's great. (I use vim.) However, vim has two modes of autocompletion that I know of and having them both would be a big win for me: Ctrl-N searches forward in the file from the current position and Ctrl-P searches backwards from the current position.

Any chance we can have both with the same semantics as vim?

I'll see whether I can come up with a patch soon.

Cheers,
Steffen

Attachments

forwards_backwards_completion.diff (3.7 KB) - added by tsee 6 years ago.
And here's the patch for forwards/backwards search

Change History

Changed 6 years ago by tsee

And here's the patch for forwards/backwards search

comment:1 follow-up: ↓ 2 Changed 6 years ago by szabgab

The problem with this is that Ctrl-N is the traditional key binding for new file.
I'd like to keep the *default* keyboard setting to be that.

So changing Ctrl-N to be forward autocompletion should be optional controlled by
some configuration option.

comment:2 in reply to: ↑ 1 Changed 6 years ago by tsee

  • Owner set to tsee
  • Status changed from new to accepted

Replying to szabgab:

The problem with this is that Ctrl-N is the traditional key binding for new file.
I'd like to keep the *default* keyboard setting to be that.

So changing Ctrl-N to be forward autocompletion should be optional controlled by
some configuration option.

Ah, I missed that when I wrote the patch. It was 1am. I agree that having Ctrl-n as "new file" is preferable. How about Ctrl-p forwards vs. Ctrl-Shift-P backwards?

Best regards,
Steffen

comment:3 Changed 6 years ago by szabgab

Actually Ctrl-P currently does not have a direction in Padre.
It just lists you all the possibilities and even that has
lots of missing issues.
It was added mostly as a basic help tool and to see how this can work.

As it provides a list of all the possibilities and does not cycle
through the possibilities I am not sure there is any point in the direction.

Can you explain a bit how do you use it in vi and how would that direction
thing work in Padre?

comment:4 Changed 5 years ago by szabgab

  • Milestone set to Satisfy all the requirements of PerlMonks

comment:5 in reply to: ↑ description Changed 5 years ago by alvar

Replying to tsee:
Ctrl-P is the shortcut for "print" in the Styleguides for Windows and AFAIK for Gnome, KDE and all othe X11 Desktops too. So this is not the best choice.
On OS X Ctrl-P may be OK, because print is Command-P (like the other default shortcuts use the better positioned Command key) ...

Beside vim: I think Ctrl-P is not very easy to type. Autocompletion in Eclipse is Ctrl-Space, and I think this is better to type. Nevertheless, P/N is logical OK for vim.

Another option may be to use automatic auto completion: while typing $f, a box appears with the suggestions $foo and $foobar etc. But it should not disturb while typing ... ;-)

Ciao

Alvar

comment:6 Changed 5 years ago by Sewi

  • Version set to 0.47

The autocompletion doesn't care of "forward" or "backwards", but you could enable it as "always" in the preferences which applies it on every new char.

Please check, if this is sufficient for this ticket and close it or drop a note that you need two-way - autocompletion in the core instead in the Vi plugin.

comment:7 Changed 3 years ago by szabgab

  • Component changed from editor to Autocomplete

comment:8 Changed 3 years ago by szabgab

  • Status changed from accepted to closed
  • Resolution set to fixed

The autocompletition as we have in 0.85 is a good start of what we wanted.
It uses Ctrl-Space for manual triggering and it can be configured to fire automatically.

Note: See TracTickets for help on using tickets.