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

feat: add the command ToggleTermBufferDir to create and/or toggle a terminal with the current buffer directory #555

Closed
wants to merge 7 commits into from

Conversation

TimaSv-Uk
Copy link

This PR introduces the :ToggleTermBufferDir command, which allows users to switch the buffer directory in the terminal. If a terminal instance with a buffer directory wasn’t already there, one is created. However, once a terminal instance is created, the buffer terminal name or direction cannot be changed.

The :TermSelect command can be used to utilize toggleterm from another buffer in the current buffer. By default, the name is set to PATH_TO_CURRENT_BUFFER and the direction is set to float. The size is taken from the setup function.

Here is an example usage of the command:
:ToggleTermBufferDir name=desktop direction=horizontal

I love to use Harpoon or Telescop, and the new command allows me to quickly open Terminla after jumping to a new project. If there are any issues, I'll try to fix them.

Uploading ToggleTermBufferDir_example.mp4…

@akinsho
Copy link
Owner

akinsho commented Mar 28, 2024

@TimaSv-Uk thanks for the PR. In general I strongly try to avoid increasing the surface area of my plugins by adding more and more commands. In this case (apologies as I only skimmed this PR) I don't understand exactly why this is needed. A user can just run cd MY_DIR once the terminal is open. Why does this need to be a builtin command?

@TimaSv-Uk
Copy link
Author

@akinsho ,Hello :),

As a university student, you’re often working on various small programs in different languages, like Python, C#, and others. It can indeed be a pain to have to navigate into the directory every time you want to run a console application, especially when you need to show and run several scripts one after another to your professor. 

This year, I participated in AdventOfCode for the first time (super fun, btw) and ran into the same issue. That’s why you thought this feature might be useful; it saved me a lot of time.

Thank you for considering my suggestion.

P.S. Should I close the PR? No hard feelings, this was my first try at open source and I appreciate the opportunity to learn.

@akinsho akinsho closed this Jul 17, 2024
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

Successfully merging this pull request may close these issues.

None yet

2 participants