-
Notifications
You must be signed in to change notification settings - Fork 807
Fix VIM-945: Implement i_CTRL-R_CTRL-O to insert register literally #1417
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
Conversation
Adds support for <C-R><C-R> and <C-R><C-O> in insert mode, which insert the contents of a register literally without auto-indent. This matches Vim's behavior as described in :h i_ctrl-r_ctrl-o. Implementation: - Created InsertRegisterLiterallyAction class that handles both key combinations - Follows the same pattern as the existing command-line mode implementation - Both variants use the same PutData configuration as the regular <C-R> Tests: - Added comprehensive tests for both key combinations - Tests cover named registers, default register, and numbered registers - Tests verify text insertion with and without existing content Fixes: https://youtrack.jetbrains.com/issue/VIM-945 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
Pull Request ReviewThank you for implementing the Critical IssueIdentical Implementation Between
|
| SelectionType.CHARACTER_WISE | ||
| ) | ||
| val putData = | ||
| PutData(textData, null, 1, insertTextBeforeCaret = true, rawIndent = true, caretAfterInsertedText = true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This rawIndent = true is correct for the "literally" variant - it prevents auto-indent as expected for <C-R><C-R> and <C-R><C-O>.
| import org.jetbrains.plugins.ideavim.VimTestCase | ||
| import org.junit.jupiter.api.Test | ||
|
|
||
| class InsertRegisterLiterallyActionTest : VimTestCase() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing test coverage: Consider adding tests that verify the auto-indent behavior difference between <C-R> and <C-R><C-R>/<C-R><C-O>.
For example:
- Test with multi-line register content that has indentation
- Verify that
<C-R>applies auto-indent in contexts where it would occur - Verify that
<C-R><C-R>and<C-R><C-O>insert without auto-indent modification
The command-line mode tests in InsertRegisterLiterallyActionTest.kt (ex mode) include tests for special characters and literal insertion - similar comprehensive tests would strengthen this suite.
| } | ||
|
|
||
| @Test | ||
| fun `test insert named register with CTRL-R`() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good - this test verifies basic <C-R> functionality. However, consider adding a test that demonstrates the auto-indent behavior of <C-R> vs the literal behavior of <C-R><C-R> with multi-line or indented content.
Summary
<C-R><C-R>and<C-R><C-O>key combinations in insert mode:h i_ctrl-r_ctrl-oChanges
InsertRegisterLiterallyActionclass inInsertRegisterAction.ktInsertRegisterLiterallyActionTest.ktInsertRegisterTest.ktengine_commands.jsonupdated with new key mappingsImplementation Details
The new action follows the same pattern as the existing command-line mode implementation:
<C-R><C-R>and<C-R><C-O>key combinationsPutDataconfiguration as the regular<C-R>for insert modeTest Plan
References
🤖 Generated with Claude Code