question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Remapping `d` to always delete to black-hole

See original GitHub issue

I used to have the following in my .vimrc:

" Redirect all delete-operations to black-hole
" Use 'm' ("move") for all cut-operations
nnoremap d "_d
nnoremap m d

What would be the VSCodeVim equivalent? I can’t seem to make it work, I already tried the following:

    "vim.otherModesKeyBindings": [
        { "before": ["d"], "after": ["\"", "_", "d"] }
    ],
    "vim.otherModesKeyBindingsNonRecursive": [
        { "before": ["m"], "after": ["d"] },
        { "before": ["m", "m"], "after": ["d", "d"] }
    ]

This makes the bindings for m work, but breaks d

  • Extension (VsCodeVim) version: v0.12.0
  • VSCode version: 1.23.1
  • OS version: Mac OS 10.13.4

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

14reactions
shawnaxsomcommented, Sep 29, 2018

PR is up! I found that our remapper has other issues mentioned in the PR. I don’t think any of those are regressions, so I think we can move forward with this solution.

When the PR is merged, the following vscode setting should allow e.g. dd and dw to become "_dd and "_dw, which work correctly now with our remapper.

{
     "vim.normalModeKeyBindingsNonRecursive": [
        {
            "before": ["d"],
            "after": [ "\"", "_", "d" ]
        }
    ]
}
2reactions
snidecommented, Sep 29, 2018

Hey @shawnaxsom. Thank you for jumping on this. I’m one of those rare designers who fell in love with Vim because of how custom i could make it. As primarily a designer this patch was not something I could have contributed myself and it’s great to see this plugin being so well maintained.

I just wanted to say thanks. I do some open source work myself and know it can sometimes be rough dealing with issues. Know that your work helps me be more productive in the editor I prefer and I appreciate the contribution.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cut and copy : Blackhole and default register assignment
First off, I think your first mapping is unnecessary. Since the second d is in operator mode, it does not get remapped to...
Read more >
Not cut the text, just delete. Config. : r/vim - Reddit
Does anyone have a vim config to delete text but NOT cut it? ie. ... remap the d command to delete to the...
Read more >
In Vim is there a way to delete without putting text in the register?
To delete something without saving it in a register, you can use the "black hole register": "_d. Of course you could also use...
Read more >
BS to the Black Hole - Latest Posts - Why, Scott, WHY?!?
Sometimes, I want to delete text without worrying about blowing away the unnamed register. This can be done by prefixing a normal or...
Read more >
Vector Remap Language (VRL)
Parse the raw string into JSON; Reformat the time into a UNIX timestamp; Remove the username field; Convert the message to lowercase. This...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found