Compare commits
No commits in common. "chore/style" and "main" have entirely different histories.
chore/styl
...
main
2 changed files with 28 additions and 26 deletions
30
README.md
30
README.md
|
|
@ -40,7 +40,10 @@ git clone https://tpope.io/vim/repeat.git
|
|||
## Usage
|
||||
|
||||
By default, the plugin provides four mappings:
|
||||
> [optional param] (param)
|
||||
> [optional param]
|
||||
> (param)
|
||||
|
||||
> `[count]<bind>(char)`
|
||||
|
||||
- `[count]<Leader>i(char)` - Insert a character at the cursor position
|
||||
- `[count]<Leader>a(char)` - Insert a character after the cursor position
|
||||
|
|
@ -66,13 +69,13 @@ You can customize the plugin by setting these variables in your vimrc:
|
|||
|
||||
```vim
|
||||
" Change the mappings (before loading the plugin)
|
||||
let g:singlechar_map_insert_at = '<Leader>i' " Default
|
||||
let g:singlechar_map_insert_after = '<Leader>a' " Default
|
||||
let g:singlechar_map_insert_begin = '<Leader>I' " Default
|
||||
let g:singlechar_map_insert_end = '<Leader>A' " Default
|
||||
let g:singlechar_map_insert_at = '<Leader>i' " Default
|
||||
let g:singlechar_map_insert_after = '<Leader>a' " Default
|
||||
let g:singlechar_map_insert_begin = '<Leader>I' " Default
|
||||
let g:singlechar_map_insert_end = '<Leader>A' " Default
|
||||
|
||||
" Set the static cursor (no cursor move during singlechar actions)
|
||||
let g:singlechar_static_cursor = 1 " Deafault = 0
|
||||
let g:singlechar_static_cursor = 1
|
||||
|
||||
" Change the prompt message
|
||||
let g:singlechar_prompt = 'Press the character to insert - Press Esc to cancel...' " Default
|
||||
|
|
@ -80,11 +83,11 @@ let g:singlechar_prompt = 'Press the character to insert - Press Esc to cancel..
|
|||
" Disable default mappings (if you want to create your own)
|
||||
let g:singlechar_no_mappings = 1
|
||||
|
||||
" Show warning if more than one character is entered
|
||||
let g:singlechar_keylen_warning = 1 " Default
|
||||
" Show warning if more than one character is entered (default: enabled)
|
||||
let g:singlechar_keylen_warning = 1
|
||||
|
||||
" Customize the warning message
|
||||
let g:singlechar_warning_message = 'Only the first character will be taken: {char}' " Default
|
||||
" Customize the warning message (default: 'Only the first character will be taken: {char}')
|
||||
let g:singlechar_warning_message = 'Only the first character will be taken: {char}'
|
||||
|
||||
```
|
||||
|
||||
|
|
@ -92,12 +95,13 @@ let g:singlechar_warning_message = 'Only the first character will be taken: {cha
|
|||
|
||||
The plugin provides these commands:
|
||||
|
||||
> [optional param] (param)
|
||||
> [optional 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
|
||||
- `: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
|
||||
|
||||
|
|
|
|||
|
|
@ -27,12 +27,13 @@ INTRODUCTION *singlechar-introducti
|
|||
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
|
||||
mode for simple edits like adding punctuation, which helps maintain the flow of
|
||||
normal mode operations. It also supports Unicode.
|
||||
normal mode operations. Now supports Unicode.
|
||||
|
||||
===============================================================================
|
||||
REQUIREMENTS *singlechar-requirements*
|
||||
|
||||
- Vim 9.0 or newer
|
||||
- Vim compiled with `+eval` feature
|
||||
- [vim-repeat](https://github.com/tpope/vim-repeat/) (optional, for dot-repeat support)
|
||||
|
||||
===============================================================================
|
||||
|
|
@ -42,6 +43,7 @@ Manual installation: >
|
|||
git clone https://github.com/lohhiiccc/vim-singlechar.git
|
||||
mkdir -p ~/.vim/pack/plugins/start/
|
||||
cp -r vim-singlechar ~/.vim/pack/plugins/start/
|
||||
<
|
||||
|
||||
To enable dot-repeat (`.`) for character insertions, install vim-repeat: >
|
||||
mkdir -p ~/.vim/pack/tpope/start
|
||||
|
|
@ -54,12 +56,9 @@ USAGE *singlechar-usage
|
|||
|
||||
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,
|
||||
`<Leader>I` for inserting at the first non-whitespace character,
|
||||
`<Leader>A` for inserting at the end of the line)
|
||||
1. Press the mapping (`<Leader>i` for inserting at cursor position, `<Leader>a` for after)
|
||||
2. When prompted, press the character you want to insert
|
||||
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.
|
||||
|
||||
|
|
@ -80,10 +79,10 @@ COMMANDS *singlechar-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
|
||||
`: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.
|
||||
|
||||
|
|
@ -92,20 +91,20 @@ MAPPINGS *singlechar-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>I` - Map to `:InsertCharBegin [count]`
|
||||
`[count]<Leader>A` - Map to `:InsertCharEnd [count]`
|
||||
`[count]<Leader>A` - Map to `:InsertCharEnd [count]`
|
||||
|
||||
===============================================================================
|
||||
CONFIGURATION *singlechar-configuration*
|
||||
|
||||
Customizing mappings: >
|
||||
" 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_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: >
|
||||
" Disable default mappings
|
||||
|
|
@ -127,7 +126,7 @@ Changing the prompt message: >
|
|||
Show warning if more than one character is entered (default: enabled): >
|
||||
let g:singlechar_keylen_warning = 1
|
||||
<
|
||||
Customize the warning message: >
|
||||
Customize the warning message (default: 'Only the first character will be taken: {char}'): >
|
||||
let g:singlechar_warning_message = 'Only the first character will be taken: {char}'
|
||||
<
|
||||
===============================================================================
|
||||
|
|
@ -151,7 +150,6 @@ Dot-repeat: >
|
|||
TIPS & TRICKS *singlechar-tips*
|
||||
|
||||
- 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
|
||||
|
||||
===============================================================================
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue