VSCodeVim / VSCodeVim/Vim

Placing marker does not work when creating mapping (but works in regular vim)

Open
#9,131 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

Describe the bug
I want to be able to press [ to create a new blank line above the current line (with my cursor remaining its current place). Also want to be able to create a new blank line below the current cursor line (cursor should not change positions).

This is my .vimrc file.

map [ mcO<Esc>`c
map ] mco<Esc>`c


map f /

map U <C-r>

This works in Vim terminal. When I click [ a new line is created above, and remains in normal mode. ] creates a new line below.

But in VSCode with this vim extension, creating a new line below works as expected but creating a new line above does not: what happens is that a new line is created but the cursor moves to the line above.

To Reproduce
Steps to reproduce the behavior:

  1. Copy paste my .vimrc file
  2. try to create a new line above and below the current line with the cursor moved to somewhere in the middle of the current line

Expected behavior
The cursor should remain in it's current place as a new line is created above and below the current line. It can create a new line below the cursor no problem, but when creating a new line above, the cursor moves to the line above.

Environment (please complete the following information):

  • Extension (VsCodeVim) version:
  • VSCode version: 1.27.3
  • OS: Mac Monterey

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

Reproduce the behavior with the supplied .vimrc mappings in VS Code 1.27.3, placing the cursor in the middle of a line and testing [ and ]. Compare the result with terminal Vim. Done means both mappings create a blank line while leaving the cursor in its original position and preserving normal mode.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.