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

Support for cd to previous dir (change-directory -) #1441

Closed
Delapouite opened this issue Jun 14, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@Delapouite
Copy link
Contributor

commented Jun 14, 2017

In the terminal I often use cd - to go to the previous location.

Currently in kakoune the command change-directory - returns a unknow option '-'

Being able to do a change-directory - in kakoune would be a welcome addition when navigating back and forth in a deep project.

@lenormf

This comment has been minimized.

Copy link
Contributor

commented Jun 15, 2017

In itself, this change seems resonable enough, however it might put us on the path of having all the usual commands that you would expect a file explorer to have. After all, if we have a cd that behaves like the GNU implementation, why not have pwd as well? From there we can take many baby steps that will be very close to each other (cd -pwd → …), but overall be a symptom of not having a good interface with an actual file explorer whose job it is to allow comfortable navigation in a directory.

To navigate in large codebases, I usually use hatch_terminal to spawn a file explorer, and send the files to the parent session using a kak-edit script that makes use of $KAK_SESSION and $KAK_CLIENT.

@Delapouite

This comment has been minimized.

Copy link
Contributor Author

commented Jun 16, 2017

Relevant IRC discussion:

13:24:40     alex`` | mawww: how about :change-directory [~-+][candidate] ?
13:24:49     alex`` | :change-directory ~
13:24:58     alex`` | like unix cd -
13:25:12   ironzorg | `cd ~` already works
13:25:14     alex`` | :change-directory - (last)
13:25:27     alex`` | :change-directory -<history-candidates>
13:25:30     alex`` | same for +
13:25:43     alex`` | ah yep
13:37:43      mawww | cd ~ already works, I will need serious convincing to accept cd - and cd +, Kakoune is not a shell
13:38:51     alex`` | delapouite just suggested :cd - like shell
13:39:32     alex`` | i dont know what to think of that feature
13:41:57     alex`` | :cd - seems reasonable to switch back and forth, but on the other hand if we takes this path it's not enough flexible and
                    | there is other workflow to fit that need (like launching a file explorer and open in the client from where the command
                    | was launched - but not built-in)
13:42:36     alex`` | require some kak script and a kak bin

After better analysis of my workflow, I found that the real command I was after is going back to the project root dir.

So eventually, I implemented my needs in those small commands: https://github.com/Delapouite/kakoune-cd

@Delapouite Delapouite closed this Jun 16, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.