Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Built-in autojump-like functionality #27

Closed
joelthelion opened this issue Jul 28, 2014 · 8 comments
Closed

Built-in autojump-like functionality #27

joelthelion opened this issue Jul 28, 2014 · 8 comments

Comments

@joelthelion
Copy link

Hi,

Thanks for your new shell. It looks very promising. I would like to know if you have considered bundling somthing similar to autojump with your elvish?

In case you're not familiar with it, autojump (https://github.com/joelthelion/autojump) is a tool that learns the directories where you spend the most time and allows you to jump quickly to these directories. A lot of people have found it useful. Autojump is not built into the shells it extends, and as a result it is a bit fragile and difficult to maintain. Having it built into elvish could be a great addition to the already very nice features of the new shell.

Feel free to close this issue if you think this is a bad idea, or simply not a priority.

@xiaq
Copy link
Member

xiaq commented Jul 28, 2014

Yes.

I have always wanted such a feature, and I also know various others, e.g. fasd (inspired by your autojump). But I never find the CLI (as opposed to TUI) handy enough, and have never used one. Some thoughts:

  • It would be much much better if directory paths are automatically suggested to me, e.g. typing cd elv shows me cd ~/go/github.com/xiaq/elvish in some way. Compare this to the location bar of browsers.
  • A management command is still available, but most of the time the simple autosuggestion UI would be sufficient.
  • Elvish needs to have a permanent storage mechanism (Persistent storage mechanism #28) before this could be implemented.

@joelthelion
Copy link
Author

Absolutely agree on all points :-)

@jaredly
Copy link

jaredly commented Jul 28, 2014

OOoh yeah "awesomebar" for CLI would rock my world

@xiaq xiaq added the ready label Sep 21, 2014
xiaq added a commit that referenced this issue Jan 26, 2015
@xiaq
Copy link
Member

xiaq commented Jan 26, 2015

@joelthelion I just pushed 7a50c04 which introduces two builtin functions that expose the directory history. I know the names are clumsy :) The user is supposed to define a handy alias themselves in the rc file, which unfortunately is not yet supported. The history is recorded by the cd builtin (which is probably a bad idea since there is no opt-out). The backend is found in store/visisted_dir.go.

There is no TUI yet, since I am focusing on the language at the moment. I'll do it when I switch my focus to the editor.

Suggestions and contributions are always welcome!

@xiaq
Copy link
Member

xiaq commented Jan 26, 2015

Some time in future I would like to move this feature out of the core into a (pure elvish) module. But that will only be possible when the editor becomes programmable enough, which is not the case currently.

@xiaq xiaq changed the title Built-in autojump-like functionality? Built-in autojump-like functionality Feb 10, 2015
@xiaq
Copy link
Member

xiaq commented Feb 25, 2015

The UI of the command-t plugin for vim is an excellent model for that of directory jumping. The directory jumping UI should work as follows:

  1. A hot key (Ctrl-T by default) triggers the directory jumping mode. This mode is characterized by a buffer under the normal line editor buffer (like a minibuffer, should the reader be familiar with the word). The line buffer is preserved and still shown.
  2. As the user types, matching directories in the history are automatically suggested using the command completion UI. Since the command completion UI is used, the keys for navigating among completion candidates (arrow keys and tab) are also available and the user may select a directory other than the first one.
  3. Hitting Enter leaves the directory jumping mode and causes elvish to cd there. Hitting Ctrl-C (or maybe also Esc) leaves the mode without jumping.

An open question: how should the key bindings in this mode relate to those in the insert mode, vi-normal mode and completion mode? Specifically, when the user enters this mode from vi-normal mode, should line editing in the minibuffer use vi-normal key bindings?

@xiaq
Copy link
Member

xiaq commented Feb 12, 2016

I am also considering using Ctrl-L for the trigger key by analogy to browsers.

@xiaq xiaq closed this as completed in 7209b48 Feb 27, 2016
@xiaq
Copy link
Member

xiaq commented Feb 27, 2016

@joelthelion The UI for directory jumping has landed. I find it pretty cool :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants