ci_edit icon indicating copy to clipboard operation
ci_edit copied to clipboard

CTRL_P not working as intended?

Open aaxu opened this issue 7 years ago • 6 comments

Is this a feature that has yet to be fully implemented? I see the groundwork laid out, but It doesn't seem to be functional (or I'm just using it wrong). What is InteractivePrediction supposed to do?

aaxu avatar Oct 09 '17 16:10 aaxu

I'm up for discussing what ctrl+p should do. Right now it will try to guess which other file you'd like to open.

  • with one file open, suggest 'alternate' file (like if it's a .c file, suggest the .h file)
  • with multiple files open, suggest the most recently used file (like ctrl+tab)
  • with no files open, suggest a new, empty buffer

In some cases, alternate files are included at the bottom of the list (in case the suggestion is wrong and the alternate was desired).

Something I don't like about this arrangement, is that it's not easy to know what it's going to suggest.

The navigation to select a file can be done with ctrl+p (or up arrow) and ctrl+n (or down arrow).

Typing in the p: prompt does have any effect at the moment. That bit is WIP.

dschuyler avatar Oct 09 '17 17:10 dschuyler

What about using it to go to the next/previously edited files? CTRL_TAB/CTRL_SHIFT_TAB can't be differentiated on my computer. Both show up as CTRL_I keys in curses, so unless we can figure out some hack to determine modifier keys (I really want CTRL_backspace :( ), then I don't think we'll be able to have this functionality. What if we moved this tab/file switching to CTRL_P?

aaxu avatar Oct 09 '17 18:10 aaxu

I'm not sure how well the prediction thing would work. It seems like more often than not, it would maybe show up the incorrect file. But even if we do use some algorithms to predict what files the user wants to go to, I feel like this would be something that could be tacked onto CTRL_O as an enhancement rather than a new feature.

aaxu avatar Oct 09 '17 18:10 aaxu

CTRL_TAB/CTRL_SHIFT_TAB can't be differentiated on my computer It would be great to have that work.

so unless we can figure out some hack to determine modifier keys afaik we'd need to find a terminal that did that. (or create/modify one to do it).

dschuyler avatar Oct 10 '17 02:10 dschuyler

Here are the features I'm looking for (that can be combined into ctrl+p or separated)

  • switch to another open file (like ctrl+tab)
  • switch to an alternate file (like .c to .h)
  • switch to perviously opened files (like a 'recently opened' list)
  • open the source file that defines/declares a code element like a class or function (like symbol lookup)
  • open file referred to by #include/import (if the cursor was on such a line)
  • open url link in browser (if the cursor was on such)
  • maybe some other lookups, like define word or show results of equation.

That was kinda too much stuff to make separate commands for (I thought), so I wondered about a key that would say 'figure out what I want' to the editor. :) (which I grant, may be intractable).

So far I'm not sure if combining the first two items above are good.

dschuyler avatar Oct 10 '17 02:10 dschuyler

I like the 4th bullet point. Been using it a lot recently after discovering it in some other editors. I don't know if there is a more suitable key for that though. I know the other editors have CTRL_SHIFT_R to search for all files in the project for declaration and CTRL_R to search for the current file for class/function declaration. Maybe we could just use it for switching to alternate files, though not sure how limited that would be. It could be for .c/.h for C, model/model_controller/model.html.* for ruby, etc so I could see that being useful.

aaxu avatar Oct 10 '17 18:10 aaxu