Comments (12)
Answered #166 (comment)
from amvim-for-vscode.
VSCode's API only allows copy selections to system clipboard now.
I can let y
to make a selection then copy to clipboard, but this will make selections "blink".
Instead, I'd recommend you create a custom map to call the built-in copy command.
This can be done by:
- Open command palette.
- Search for
Preferences: Open Keyboard Shortcuts
. - Create a new map with your favorite key and command
editor.action.clipboardCopyAction
.
from amvim-for-vscode.
Is the selections blinking just a UI effect? Maybe we can get the VSCode guys to add a user setting to turn it off?
from amvim-for-vscode.
Instead of turn the effect off, it would be better if they let extensions access system clipboard.
from amvim-for-vscode.
Vim uses the +
register to do this. "+y
and "+p
to copy and paste.
If we support that, we'll need to have some notion of registers, which doesn't exist right now.
from amvim-for-vscode.
Cross-referencing another clipboard issue: #166
from amvim-for-vscode.
it would be better if they let extensions access system clipboard
I guess VS Code has this ability, since VSCodeVim has this option to use the system clipboard...
Not sure exactly where it is in the codebase, but there are a few references that appear with a search:
https://github.com/VSCodeVim/Vim/search?q=system+clipboard&unscoped_q=system+clipboard
from amvim-for-vscode.
So I've found some keybindings that seem to work here! 🥳
// Yank (copy) to system clipboard in VISUAL and VISUAL_LINE modes
{
"key": "y",
"command": "editor.action.clipboardCopyAction",
"when": "editorTextFocus && amVim.mode == 'VISUAL' && !inDebugRepl &&!suggestWidgetMultipleSuggestions && !suggestWidgetVisible"
},
{
"key": "y",
"command": "editor.action.clipboardCopyAction",
"when": "editorTextFocus && amVim.mode == 'VISUAL LINE' && !inDebugRepl &&!suggestWidgetMultipleSuggestions && !suggestWidgetVisible"
},
{
"key": "y y",
"command": "editor.action.clipboardCopyAction",
"when": "editorTextFocus && amVim.mode == 'NORMAL' && !inDebugRepl &&!suggestWidgetMultipleSuggestions && !suggestWidgetVisible"
},
// Delete (cut) to system clipboard in VISUAL modes
{
"key": "d",
"command": "editor.action.clipboardCopyAction",
"when": "editorTextFocus && amVim.mode == 'VISUAL' && !inDebugRepl &&!suggestWidgetMultipleSuggestions && !suggestWidgetVisible"
},
Caveats
- The active selection from the
VISUAL
modes stays with the yank keybindings
I'm also uncertain why I don't need to match for VISUAL LINE
mode with the d
keybinding - it just works in both modes. Maybe more mode bugginess?
There is one more binding that I originally wrote to paste from system clipboard in NORMAL
mode, but it pastes even in INSERT
mode 😳 (I guess there's some issue with the modes):
// Paste from system clipboard only in NORMAL mode (not working - pastes also in INSERT mode)
{
"key": "p",
"command": "editor.action.clipboardPasteAction",
"when": "editorTextFocus && amVim.mode == 'NORMAL' && !inDebugRepl &&!suggestWidgetMultipleSuggestions && !suggestWidgetVisible"
},
@aioutecism can you comment on why the mode check is not working here? I tried looking through the code, but I'm really lost there...
from amvim-for-vscode.
I can let y to make a selection then copy to clipboard, but this will make selections "blink".
@aioutecism Also - would you consider adding this and an option for turning on this mode? I think there must be also a way to do it without the blinking (VSCodeVim achieves this somehow), but even with the blinking, it would be better than no copy to system clipboard (and also better than my hotkeys workaround).
from amvim-for-vscode.
Asked in #166 (#166 (comment)) about having some instructions about how to add this feature (as well as paste from system clipboard):
from amvim-for-vscode.
My first shot at a pull request up at #260.
from amvim-for-vscode.
Done in master
(#260 was merged)! Will be released soon.
#272 contains documentation of the option.
from amvim-for-vscode.
Related Issues (20)
- release 1.32.0 and publish to extension marketplace HOT 2
- OpenVSX marketplace? HOT 10
- Multi-selection pasting is broken for multi-cursor
- Demo GIF in README
- release 1.33.0 and publish to extension marketplace HOT 2
- release 1.34.0 and publish to extension marketplace HOT 5
- Vgg does not work HOT 5
- Add the macro feature in amVim it's the most wanted feature right now!!!! HOT 1
- apply powerline theme HOT 1
- Is this project still active? HOT 2
- `o` Motion Cursor Position Incorrect HOT 22
- yy on line without trailing newline should insert a newline on p
- switching to visual mode and going down puts the cursor one to the right of where it should be
- Add Horizontal split HOT 1
- :set filetype could open language selector
- Some commands are (sometimes) broken in VS Code 1.75.0+ HOT 9
- Cannot switch out Normal mode in long file HOT 5
- feature request: distinct VScode mode to ignore amVim commands HOT 1
- Gets locked in 'shift' mode HOT 2
- Remapping jump to next section HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amvim-for-vscode.