VSCodeVim / VSCodeVim/Vim

Explain how or add ability to remap "c :"

Open
#7,970 0 comments 0 reactions 0 assignees View on GitHub

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'm trying to create a macro c: that works like ci" but instead of changing the "text in quotes" it changes the text between : and;.

.someClass {
  margin-top: 1000rem;
  //         ^------^ this area
}

Describe the solution you'd like

I'm not sure the best way to do this.

Describe alternatives you've considered

I've tried using "vim.normalModeKeyBindings" and "vim.operatorPendingModeKeyBindings" but either I couldn't figure out the correct sequence in "before" to do it, so such a setting seems to have no effect

	"vim.normalModeKeyBindings": [
		{
			"before": ["c", ":"],
			"after": ["F", ":", "f", ":", "l", "c", "t", ";", " "]
		}
	]

I also tried setting a keybinding as noted in the readme

	{
		"key": "c shift+;",
		"command": "vim.remap",
		"when": "inputFocus && vim.mode == 'Normal'",
		"args": {
			"after": ["F", ":", "f", ":", "l", "c", "t", ";", " "]
		}
	}

Which works but completely breaks other sequences starting with c such as ciw.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the README remap example and the vim.normalModeKeyBindings and vim.operatorPendingModeKeyBindings settings described in the issue. Determine how a c: mapping can coexist with sequences such as ciw, then verify that the requested change or explanation supports changing text between : and ; without breaking existing c mappings.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.