Compare commits

..

1 commit

Author SHA1 Message Date
lohhiiccc
f4900cf102 docs: enhance README.md and singlechar.txt 2025-08-21 19:55:24 +02:00
2 changed files with 26 additions and 28 deletions

View file

@ -40,10 +40,7 @@ git clone https://tpope.io/vim/repeat.git
## Usage ## Usage
By default, the plugin provides four mappings: By default, the plugin provides four mappings:
> [optional param] > [optional param] (param)
> (param)
> `[count]<bind>(char)`
- `[count]<Leader>i(char)` - Insert a character at the cursor position - `[count]<Leader>i(char)` - Insert a character at the cursor position
- `[count]<Leader>a(char)` - Insert a character after the cursor position - `[count]<Leader>a(char)` - Insert a character after the cursor position
@ -69,13 +66,13 @@ You can customize the plugin by setting these variables in your vimrc:
```vim ```vim
" Change the mappings (before loading the plugin) " Change the mappings (before loading the plugin)
let g:singlechar_map_insert_at = '<Leader>i' " Default let g:singlechar_map_insert_at = '<Leader>i' " Default
let g:singlechar_map_insert_after = '<Leader>a' " Default let g:singlechar_map_insert_after = '<Leader>a' " Default
let g:singlechar_map_insert_begin = '<Leader>I' " Default let g:singlechar_map_insert_begin = '<Leader>I' " Default
let g:singlechar_map_insert_end = '<Leader>A' " Default let g:singlechar_map_insert_end = '<Leader>A' " Default
" Set the static cursor (no cursor move during singlechar actions) " Set the static cursor (no cursor move during singlechar actions)
let g:singlechar_static_cursor = 1 let g:singlechar_static_cursor = 1 " Deafault = 0
" Change the prompt message " Change the prompt message
let g:singlechar_prompt = 'Press the character to insert - Press Esc to cancel...' " Default let g:singlechar_prompt = 'Press the character to insert - Press Esc to cancel...' " Default
@ -83,11 +80,11 @@ let g:singlechar_prompt = 'Press the character to insert - Press Esc to cancel..
" Disable default mappings (if you want to create your own) " Disable default mappings (if you want to create your own)
let g:singlechar_no_mappings = 1 let g:singlechar_no_mappings = 1
" Show warning if more than one character is entered (default: enabled) " Show warning if more than one character is entered
let g:singlechar_keylen_warning = 1 let g:singlechar_keylen_warning = 1 " Default
" Customize the warning message (default: 'Only the first character will be taken: {char}') " Customize the warning message
let g:singlechar_warning_message = 'Only the first character will be taken: {char}' let g:singlechar_warning_message = 'Only the first character will be taken: {char}' " Default
``` ```
@ -95,13 +92,12 @@ let g:singlechar_warning_message = 'Only the first character will be taken: {cha
The plugin provides these commands: The plugin provides these commands:
> [optional param] > [optional param] (param)
> (param)
- `:InsertCharAt (count) [char]` - Insert a character at the cursor position - `:InsertCharAt (count) [char]` - Insert a character at the cursor position
- `:InsertCharAfter (count) [char]` - Insert a character after the cursor position - `:InsertCharAfter (count) [char]` - Insert a character after the cursor position
- `:InsertCharBegin (count) [char]` - Insert a character at the beginning of the line - `:InsertCharBegin (count) [char]` - Insert a character at the beginning of the line
- `:InsertCharEnd (count) [char]` - Insert a character at the end of the line - `:InsertCharEnd (count) [char]` - Insert a character at the end of the line
## License ## License

View file

@ -27,13 +27,12 @@ INTRODUCTION *singlechar-introducti
vim-singlechar is a minimalist Vim plugin designed to optimize the workflow of vim-singlechar is a minimalist Vim plugin designed to optimize the workflow of
inserting single characters during editing. It eliminates the need to enter insert inserting single characters during editing. It eliminates the need to enter insert
mode for simple edits like adding punctuation, which helps maintain the flow of mode for simple edits like adding punctuation, which helps maintain the flow of
normal mode operations. Now supports Unicode. normal mode operations. It also supports Unicode.
=============================================================================== ===============================================================================
REQUIREMENTS *singlechar-requirements* REQUIREMENTS *singlechar-requirements*
- Vim 9.0 or newer - Vim 9.0 or newer
- Vim compiled with `+eval` feature
- [vim-repeat](https://github.com/tpope/vim-repeat/) (optional, for dot-repeat support) - [vim-repeat](https://github.com/tpope/vim-repeat/) (optional, for dot-repeat support)
=============================================================================== ===============================================================================
@ -43,7 +42,6 @@ Manual installation: >
git clone https://github.com/lohhiiccc/vim-singlechar.git git clone https://github.com/lohhiiccc/vim-singlechar.git
mkdir -p ~/.vim/pack/plugins/start/ mkdir -p ~/.vim/pack/plugins/start/
cp -r vim-singlechar ~/.vim/pack/plugins/start/ cp -r vim-singlechar ~/.vim/pack/plugins/start/
<
To enable dot-repeat (`.`) for character insertions, install vim-repeat: > To enable dot-repeat (`.`) for character insertions, install vim-repeat: >
mkdir -p ~/.vim/pack/tpope/start mkdir -p ~/.vim/pack/tpope/start
@ -56,9 +54,12 @@ USAGE *singlechar-usage
The plugin provides a simple way to insert characters while staying in normal mode: The plugin provides a simple way to insert characters while staying in normal mode:
1. Press the mapping (`<Leader>i` for inserting at cursor position, `<Leader>a` for after) 1. Press the mapping (`<Leader>i` for inserting at cursor position, `<Leader>a` for after,
`<Leader>I` for inserting at the first non-whitespace character,
`<Leader>A` for inserting at the end of the line)
2. When prompted, press the character you want to insert 2. When prompted, press the character you want to insert
3. The character is inserted and you remain in normal mode 3. The character is inserted and you remain in normal mode
4. If g:singlechar_static_cursor is set to 1, your cursor will not be moved
To cancel, press `<Esc>` when prompted for the character. To cancel, press `<Esc>` when prompted for the character.
@ -79,10 +80,10 @@ COMMANDS *singlechar-commands
The plugin provides two commands: The plugin provides two commands:
`:InsertCharAt [count] [char]` - Insert a character at the cursor position `:InsertCharAt [count] [char]` - Insert a character at the cursor position
`:InsertCharAfter [count] [char]` - Insert a character after the cursor position `:InsertCharAfter [count] [char]` - Insert a character after the cursor position
`:InsertCharBegin [count] [char]` - Insert a character at the beginning of the line `:InsertCharBegin [count] [char]` - Insert a character at the beginning of the line
`:InsertCharEnd [count] [char]` - Insert a character at the end of the line `:InsertCharEnd [count] [char]` - Insert a character at the end of the line
The optional count parameter specifies how many times to insert the character. The optional count parameter specifies how many times to insert the character.
@ -91,20 +92,20 @@ MAPPINGS *singlechar-mappings
By default, the plugin defines these mappings: By default, the plugin defines these mappings:
`[count]<Leader>i` - Map to `:InsertCharAt [count]` `[count]<Leader>i` - Map to `:InsertCharAt [count]`
`[count]<Leader>a` - Map to `:InsertCharAfter [count]` `[count]<Leader>a` - Map to `:InsertCharAfter [count]`
`[count]<Leader>I` - Map to `:InsertCharBegin [count]` `[count]<Leader>I` - Map to `:InsertCharBegin [count]`
`[count]<Leader>A` - Map to `:InsertCharEnd [count]` `[count]<Leader>A` - Map to `:InsertCharEnd [count]`
=============================================================================== ===============================================================================
CONFIGURATION *singlechar-configuration* CONFIGURATION *singlechar-configuration*
Customizing mappings: > Customizing mappings: >
" Must be set before the plugin is loaded " Must be set before the plugin is loaded
let g:singlechar_map_insert_at = '<Leader>i' " Default let g:singlechar_map_insert_at = '<Leader>i' " Default
let g:singlechar_map_insert_after = '<Leader>a' " Default let g:singlechar_map_insert_after = '<Leader>a' " Default
let g:singlechar_map_insert_begin = '<Leader>I' " Default let g:singlechar_map_insert_begin = '<Leader>I' " Default
let g:singlechar_map_insert_end = '<Leader>A' " Default let g:singlechar_map_insert_end = '<Leader>A' " Default
< <
Disabling default mappings: > Disabling default mappings: >
" Disable default mappings " Disable default mappings
@ -126,7 +127,7 @@ Changing the prompt message: >
Show warning if more than one character is entered (default: enabled): > Show warning if more than one character is entered (default: enabled): >
let g:singlechar_keylen_warning = 1 let g:singlechar_keylen_warning = 1
< <
Customize the warning message (default: 'Only the first character will be taken: {char}'): > Customize the warning message: >
let g:singlechar_warning_message = 'Only the first character will be taken: {char}' let g:singlechar_warning_message = 'Only the first character will be taken: {char}'
< <
=============================================================================== ===============================================================================
@ -150,6 +151,7 @@ Dot-repeat: >
TIPS & TRICKS *singlechar-tips* TIPS & TRICKS *singlechar-tips*
- The plugin works well with Vim's macro recording feature - The plugin works well with Vim's macro recording feature
- `<Leader>A` is very useful for adding forgotten semicolons
- For fast repetitive edits, use dot-repeat (`.`) if vim-repeat is installed - For fast repetitive edits, use dot-repeat (`.`) if vim-repeat is installed
=============================================================================== ===============================================================================