feat: add name_on_tag, suggest_name, and confirm_untag prompts to toggle()#200
Open
awerebea wants to merge 3 commits into
Open
feat: add name_on_tag, suggest_name, and confirm_untag prompts to toggle()#200awerebea wants to merge 3 commits into
awerebea wants to merge 3 commits into
Conversation
Add two opt-in settings that make the toggle() command interactive:
name_on_tag (boolean, default false)
When true, toggle() shows a vim.ui.input prompt before creating a
new tag. Empty input creates an unnamed tag; Esc cancels silently.
Respects any vim.ui.input override (snacks.nvim, dressing.nvim, etc).
confirm_untag (boolean, default false)
When true, toggle() shows a yes/no confirmation before removing an
existing tag. Default choice is No so accidental <CR> is safe.
Both settings only affect toggle(). Direct tag() and untag() calls are
unchanged. The fast path (both settings false) preserves the original
synchronous implementation with no overhead.
Document both options in the settings block and in a dedicated
|grapple-toggle-prompts| help section with usage examples.
When suggest_name = true (requires name_on_tag = true), the vim.ui.input prompt is pre-filled with the file stem of the current buffer: my_file.txt -> my_file .config -> .config (hidden files keep their full name) The suggestion is editable; clearing it still creates an unnamed tag. Has no effect when name_on_tag is false.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add three opt-in boolean settings that make
toggle()interactive: prompt for a tagname on creation (optionally pre-filled), and ask for confirmation before removal.
New settings:
name_on_tag(boolean, defaultfalse): whentrue,toggle()shows avim.ui.inputprompt ("Tag name (optional):") before creating a tag. Emptyinput -> unnamed tag;
<Esc>cancels without tagging.suggest_name(boolean, defaultfalse): whentrue(andname_on_tagisalso
true), the name prompt is pre-filled with the file stem of the currentbuffer. Regular files lose their extension (
my_file.txt->my_file);hidden files keep their full name (
.config->.config). The suggestion iseditable. Has no effect when
name_on_tagisfalse.confirm_untag(boolean, defaultfalse): whentrue,toggle()shows avim.fn.confirmdialog before removing an existing tag. The default choice isNo, so an accidental
<CR>is safe.Implementation notes:
false, the original singleenter_with_savecode path is taken with zero overhead.vim.ui.inputis async (callback-based), so tag existence is checked firstwith
enter_with_result, then the save is performed inside the appropriatesync or async branch.
toggle()is affected.tag()anduntag()are unchanged.No breaking changes. All settings default to
false; existing behavior ispreserved exactly.