[Feature] Implement Select mode

Open
#239 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript
Domain
frontend

Research direction

Start by reviewing the existing API and how vim-visual and vim-insert modes are represented in this CodeMirror Vim integration. Trace how a visual selection is preserved when changing modes, then determine where a global select-mode command belongs for CodeMirror-based editors. Done means the command switches to insert-like behavior while retaining the current selection and keeps select-mode shortcuts separate from visual-mode bindings.

Written by the indexing model from the issue text.

Description

Description

Implement a command that allows one to switch between vim-visual to vim-insert while keeping the current selection.
Vim originally has a select mode, described at https://vimhelp.org/visual.txt.html#Select. It keeps the current selection mode when switching but for this use case, just being able to switch is enough.

Explanation

Currently in overleaf and obsidian, you can select text and invoke some action upon that text.
For example given the following string in obsidian

|Some important text here|

(where | represents the bounds of the selection)
You can press * to convert it to

*|Some important text here|*

(select mode = vim-insert while having something selected)

The only problem here is that selecting with vim visual mode is much easier than doing it with arrow keys or with the mouse.
And these shortcuts are only available in select mode. I want to keep them only available in select mode as they would otherwise conflict with the visual-mode keybindings.

This can be already implemented with the current api, but as probably most codemirror-based editors will have some selection-based commands, it would make more sense to implement this on a global level.

video for better example:

https://github.com/user-attachments/assets/e3823b2d-6dcc-45c5-a3f7-50fca1e9898a

Dominant language
JavaScript
Stars
470
Forks
53
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

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.

More from replit/codemirror-vim

All issues in replit/codemirror-vim

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.