Feature: vim smart semicolon?
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 15.2k
- Forks
- 1.5k
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 6
Description
Is your feature request related to a problem? Please describe.
I have worked with semicolon languages (C#, Typescript) more lately... this often requires the input of a line ending semicolon from inside brackets and strings. vims source is full of examples. Lets take:
keys = ['A'];
keys = ['A|']
which looks like so before, | = cursor.
Now you need to move 2 right/EOL and enter ";". I don't know a really good way to automate this "chore", see alternatives.
Describe the solution you'd like
A smart semicolon, built inside vim (meaning: working with repeat), where we can press ";" in the setting above and have it entered at EOL.
A basic solution could be a setting: vim.smartSemicolonFiletypes = ".cs,.ts"
which would always enter ";" at EOL for a given filetype (with some option to put it back to the orig place).
Describe alternatives you've considered
You can do a mapping like so, but that screws up repeat.
inoremap ; <c-o>$;
Since we can't map <c-;> (#5152 ), I don't see an intuitive way to have a normal ; and an EOL ; in insert mode.
There are extensions for smart semicolon, I tried two and did not get them to work. And if, I am sure they don't cooperate with repeat.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no files or tests; start by reviewing the existing insert-mode mapping and repeat behavior, using the inoremap ; <c-o>$; example and the related #5152 constraint. Define the behavior for configured filetypes and how the original insertion position is handled, with repeat compatibility as the completion criterion.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vscode
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100