Skip to content

feat(context): add inline visual selection insertion#326

Merged
sudo-tee merged 3 commits intosudo-tee:mainfrom
jugarpeupv:feature/add_visual_selection_like_codecompanion
Mar 17, 2026
Merged

feat(context): add inline visual selection insertion#326
sudo-tee merged 3 commits intosudo-tee:mainfrom
jugarpeupv:feature/add_visual_selection_like_codecompanion

Conversation

@jugarpeupv
Copy link
Contributor

@jugarpeupv jugarpeupv commented Mar 17, 2026

Adds a new command and API to insert the current visual selection as a formatted code block directly into the input buffer. This includes a new add_visual_selection_inline function, a corresponding keymap, and a helper to build the formatted text. Unit tests are provided to ensure correct formatting and error handling for edge cases.

image

Adds a new command and API to insert the current visual selection as a
formatted code block directly into the input buffer. This includes a new
`add_visual_selection_inline` function, a corresponding keymap, and a
helper to build the formatted text. Unit tests are provided to ensure
correct formatting and error handling for edge cases.
@sudo-tee
Copy link
Owner

@jugarpeupv

I like the idea but I would prefer not to hardcode the string Here is some code from

Thanks for the PR

@jugarpeupv
Copy link
Contributor Author

@sudo-tee yeah, nice point, i will modify the code, it is fine for me

Update the inline visual selection text to use bolded file path formatting
(**`path/to/file`**) instead of the previous "Here is some code from"
prefix. Adjust unit tests to match the new output format. This change
makes the inserted context more visually distinct and concise.
@sudo-tee
Copy link
Owner

Thanks for the Fix

One last thing can you update the README default config to include the new keymap ?

Thanks a lot :)

Add new action `add_visual_selection_inline` with keymap `<leader>oY` to
insert visually selected code directly into the input buffer as a Markdown
code block, prefixed with the file path. Updates documentation with usage
details and example. Leaves cursor in normal mode for prompt editing.
@sudo-tee
Copy link
Owner

Awesome thanks a lot

@sudo-tee sudo-tee merged commit 3a3d8cb into sudo-tee:main Mar 17, 2026
5 checks passed
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.

2 participants