Feature/begin end #3

Merged
lohhiiccc merged 6 commits from feature/begin-end into main 2025-08-21 15:26:13 +00:00
lohhiiccc commented 2025-08-21 15:23:25 +00:00 (Migrated from github.com)

This pull request adds new functionality and improves configurability for the vim-singlechar plugin. Most notably, it introduces new commands and mappings to insert characters at the beginning and end of a line, and adds an option to keep the cursor static after insertion. Documentation and configuration options have been updated to reflect these changes.

New features and functionality

  • Added new commands :InsertCharBegin and :InsertCharEnd for inserting characters at the beginning and end of the line, respectively. Corresponding mappings [count]<Leader>I and [count]<Leader>A have also been added. [1] [2] [3] [4] [5] [6]
  • Introduced the g:singlechar_static_cursor option, allowing users to keep the cursor at its original position after insertion. [1] [2] [3] [4]

Documentation and configuration updates

  • Updated documentation (README.md and doc/singlechar.txt) to include the new commands, mappings, and configuration options. [1] [2] [3] [4] [5] [6] [7]
  • Added configuration options for the new mappings (g:singlechar_map_insert_begin, g:singlechar_map_insert_end) in the plugin setup. [1] [2]

Codebase improvements

  • Refactored insertion logic to use a new helper function GetInsertCommand for determining the correct Vim insert command, and DoSingleChar for handling insertion and cursor positioning. [1] [2]
  • Updated plugin initialization to set sensible defaults for new options and mappings.

Minor updates

  • Updated the license link and last change date in documentation. [1] [2]
This pull request adds new functionality and improves configurability for the `vim-singlechar` plugin. Most notably, it introduces new commands and mappings to insert characters at the beginning and end of a line, and adds an option to keep the cursor static after insertion. Documentation and configuration options have been updated to reflect these changes. ### New features and functionality * Added new commands `:InsertCharBegin` and `:InsertCharEnd` for inserting characters at the beginning and end of the line, respectively. Corresponding mappings `[count]<Leader>I` and `[count]<Leader>A` have also been added. [[1]](diffhunk://#diff-4a58eccd238093bbbbb0ad525d91c47b7da452db1b1a12cc682962ef1f08714fR74-L72) [[2]](diffhunk://#diff-7ecf286a65a62ff3716162098c9f142a2ece2f58768579b1fe7529e4f001a4f9R40-R64) [[3]](diffhunk://#diff-e0fe54db06837563528336cff6510d2c38d7437e1eb254a9f443f189cba6936dL82-R85) [[4]](diffhunk://#diff-e0fe54db06837563528336cff6510d2c38d7437e1eb254a9f443f189cba6936dL92-R97) [[5]](diffhunk://#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5L42-R51) [[6]](diffhunk://#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5L87-R108) * Introduced the `g:singlechar_static_cursor` option, allowing users to keep the cursor at its original position after insertion. [[1]](diffhunk://#diff-7ecf286a65a62ff3716162098c9f142a2ece2f58768579b1fe7529e4f001a4f9R40-R64) [[2]](diffhunk://#diff-4a58eccd238093bbbbb0ad525d91c47b7da452db1b1a12cc682962ef1f08714fR33-R58) [[3]](diffhunk://#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R74-R78) [[4]](diffhunk://#diff-e0fe54db06837563528336cff6510d2c38d7437e1eb254a9f443f189cba6936dR116-R122) ### Documentation and configuration updates * Updated documentation (`README.md` and `doc/singlechar.txt`) to include the new commands, mappings, and configuration options. [[1]](diffhunk://#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5L42-R51) [[2]](diffhunk://#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R74-R78) [[3]](diffhunk://#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5L87-R108) [[4]](diffhunk://#diff-e0fe54db06837563528336cff6510d2c38d7437e1eb254a9f443f189cba6936dL82-R85) [[5]](diffhunk://#diff-e0fe54db06837563528336cff6510d2c38d7437e1eb254a9f443f189cba6936dL92-R97) [[6]](diffhunk://#diff-e0fe54db06837563528336cff6510d2c38d7437e1eb254a9f443f189cba6936dR106-R107) [[7]](diffhunk://#diff-e0fe54db06837563528336cff6510d2c38d7437e1eb254a9f443f189cba6936dR116-R122) * Added configuration options for the new mappings (`g:singlechar_map_insert_begin`, `g:singlechar_map_insert_end`) in the plugin setup. [[1]](diffhunk://#diff-4a58eccd238093bbbbb0ad525d91c47b7da452db1b1a12cc682962ef1f08714fR33-R58) [[2]](diffhunk://#diff-e0fe54db06837563528336cff6510d2c38d7437e1eb254a9f443f189cba6936dR106-R107) ### Codebase improvements * Refactored insertion logic to use a new helper function `GetInsertCommand` for determining the correct Vim insert command, and `DoSingleChar` for handling insertion and cursor positioning. [[1]](diffhunk://#diff-7ecf286a65a62ff3716162098c9f142a2ece2f58768579b1fe7529e4f001a4f9L22-R25) [[2]](diffhunk://#diff-7ecf286a65a62ff3716162098c9f142a2ece2f58768579b1fe7529e4f001a4f9R40-R64) * Updated plugin initialization to set sensible defaults for new options and mappings. ### Minor updates * Updated the license link and last change date in documentation. [[1]](diffhunk://#diff-e0fe54db06837563528336cff6510d2c38d7437e1eb254a9f443f189cba6936dL9-R9) [[2]](diffhunk://#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5L87-R108)
copilot-pull-request-reviewer[bot] (Migrated from github.com) reviewed 2025-08-21 15:24:19 +00:00
copilot-pull-request-reviewer[bot] (Migrated from github.com) left a comment

Pull Request Overview

This PR adds new functionality to the vim-singlechar plugin, introducing commands and mappings for inserting characters at the beginning and end of lines, along with a new static cursor option.

  • Added new commands InsertCharBegin and InsertCharEnd with corresponding <Leader>I and <Leader>A mappings
  • Introduced g:singlechar_static_cursor option to keep cursor position after insertion
  • Updated documentation to reflect the new features and configuration options

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
plugin/singlechar.vim Added new configuration variables, commands, and mappings for begin/end insertion
autoload/singlechar.vim Refactored insertion logic with helper functions and added static cursor support
doc/singlechar.txt Updated documentation with new commands, mappings, and configuration options
README.md Updated usage examples and configuration documentation

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

## Pull Request Overview This PR adds new functionality to the vim-singlechar plugin, introducing commands and mappings for inserting characters at the beginning and end of lines, along with a new static cursor option. - Added new commands `InsertCharBegin` and `InsertCharEnd` with corresponding `<Leader>I` and `<Leader>A` mappings - Introduced `g:singlechar_static_cursor` option to keep cursor position after insertion - Updated documentation to reflect the new features and configuration options ### Reviewed Changes Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments. | File | Description | | ---- | ----------- | | plugin/singlechar.vim | Added new configuration variables, commands, and mappings for begin/end insertion | | autoload/singlechar.vim | Refactored insertion logic with helper functions and added static cursor support | | doc/singlechar.txt | Updated documentation with new commands, mappings, and configuration options | | README.md | Updated usage examples and configuration documentation | --- <sub>**Tip:** Customize your code reviews with copilot-instructions.md. <a href="/lohhiiccc/vim-singlechar/new/main/.github?filename=copilot-instructions.md" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">Create the file</a> or <a href="https://docs.github.com/en/copilot/customizing-copilot/adding-repository-custom-instructions-for-github-copilot" class="Link--inTextBlock" target="_blank" rel="noopener noreferrer">learn how to get started</a>.</sub>
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-08-21 15:24:19 +00:00

[nitpick] Consider using boolean comparison instead of numeric comparison for better readability: if resetCursor

    if resetCursor
[nitpick] Consider using boolean comparison instead of numeric comparison for better readability: `if resetCursor` ```suggestion if resetCursor ```
@ -30,15 +30,32 @@ if !exists('g:singlechar_map_insert_after')
g:singlechar_map_insert_after = '<Leader>a'
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-08-21 15:24:18 +00:00

The comment 'Toggle off static cursor' is misleading. This variable enables/disables the static cursor feature, not toggles it off.

# Enable/disable static cursor feature
The comment 'Toggle off static cursor' is misleading. This variable enables/disables the static cursor feature, not toggles it off. ```suggestion # Enable/disable static cursor feature ```
copilot-pull-request-reviewer[bot] (Migrated from github.com) commented 2025-08-21 15:24:18 +00:00

Spelling error: 'warnign' should be 'warning'.

# toggle warning
Spelling error: 'warnign' should be 'warning'. ```suggestion # toggle warning ```
Sign in to join this conversation.
No description provided.