Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
393 views
in Technique[技术] by (71.8m points)

VS code VIM extension copy and paste

Is there a normal way to copy and paste in vs code using vim extension?

I've tried mapping VIM register commands to the shortcut commands I'm used to (ctrl + c for copying and ctrl + v for pasting), but the results are pretty weird and I'm not sure how to do this correctly.

While using vim the key bindings were quite simple, vimrc file:

map <C-c> "+y
map <C-v> "+p

Now I try to migrate those to vs-code by editting json.settings file:

{
    "vim.visualModeKeyBindings": [
        {
            "before": ["<C-c>"],
            "after": [""", "+", "y"]
        },
        {
            "before": ["<C-v>"], 
            "after":  [""", "+", "p"]
        },
    ], }

I want this to operate both in visual mode and in normal mode (for pasting), and be able to copy and paste from clipboard using these shortcuts.

How to do this correctly? Is there another way to do this?

question from:https://stackoverflow.com/questions/58306002/vs-code-vim-extension-copy-and-paste

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Vim - extension config flag

Paste the following inside your VS Code's settings.json file:

"vim.useSystemClipboard": true

Access VSCode settings.json file:

  1. Press Ctrl + , (or go to File > Preferences > Settings)
  2. Click the icon: "file with arrow" in the top right corner

VSCode access settings json file


Settings found in VSCodeVim/Vim repository quick-example


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...