The documentation for the commands api for Chrome Extensions says:
Certain Chrome shortcuts (e.g. window management) always take priority over Extension Command shortcuts and can not be overwritten.
But I can't seem, to find a reference for which shortcuts specifically cannot be overwritten.
Starting from command_service.cc: OnExtensionWillBeInstalled calls UpdateKeybindings, which calls AssignKeybindings, which iterates over commands returned by:
GetNamedCommands
GetBrowserActionCommand
GetPageActionCommand
GetActionCommand
For each command, AddKeybindingPref is called with certain parameters, but only if CanAutoAssign returns true:
It returns false if the user had already modified the key binding.
It returns true if it is a media key:
If ⏯️/⏹️/⏮️/⏭️ without any modifier.
If the command is global (works when Chrome window is not active), it returns true if it is a named command, and either the extension has kCommandsAccessibility permission, or the key is (Ctrl/⌘)+Alt+(0...9)
If it is not a global command, then it returns the result of IsChromeAccelerator.
IsChromeAccelerator has two definitions:
For cocoa, keyEventWithType is queried for a matching key event.
For aura, list returned from GetAcceleratorList is checked for a match, which is populated from:
kAcceleratorMap,
and if kUIDebugTools feature is enabled: kUIDebugAcceleratorMap
Here is the list from kAcceleratorMap:
F7 (if not ChromeOS-Ash)
F12
ESC
If not macOS:
Ctrl+D
Ctrl+Shift+D
Ctrl+W
Ctrl+Shift+W
Ctrl+F
Ctrl+Shift+A
Ctrl+G
Ctrl+Shift+G
Ctrl+L
Ctrl+O
Ctrl+P
Ctrl+R
Ctrl+Shift+R
Ctrl+S
Ctrl+Tab
Ctrl+Shift+Tab
Ctrl+Page Up
Ctrl+Page Down
(Ctrl/⌘)+(0...9)
(Ctrl/⌘)+Shift+B
(Ctrl/⌘)++
(Ctrl/⌘)+-
(Ctrl/⌘)+0
F1
F3
Shift+F3
Ctrl+F4
Alt+F4
F5
Ctrl+F5
Shift+F5
F6
Shift+F6
F10
F11
(Ctrl/⌘)+Shift+M
Alt+Shift+I
(Ctrl/⌘)+Shift+N
(Ctrl/⌘)+T
(Ctrl/⌘)+Shift+T
(Ctrl/⌘)+N
Alt+←
Alt+→
Ctrl+Shift+P
Ctrl+Shift+I
Ctrl+Shift+J
Ctrl+Shift+C
Alt+Shift+B
Alt+Shift+A
Alt+D
Ctrl+E
Ctrl+K
Alt+Shift+T
Alt+Home
Alt+E
Alt+F
Ctrl+Shift+O
Ctrl+J
Ctrl+H
Ctrl+U
If Linux or ChromeOS-Lacros:
Ctrl+Shift+Page Up
Ctrl+Shift+Page Down
Alt+(0...9)
Browser: Favorites
If Linux or ChromeOS:
Browser: Back
Browser: Forward
Browser: Home
Browser: Refresh
Ctrl+Browser: Refresh
Ctrl+Shift+Browser: Refresh
If ChromeOS-Ash:
Ctrl+Shift+Browser: Back
Ctrl+OEM: 2
Ctrl+Shift+OEM: 2
Browser: Favorites
Browser: Stop
Launcher/Search+ESC
If not macOS or ChromeOS-Ash:
Shift+ESC
Menu
Browser: Search
Ctrl+Shift+Delete
Ctrl+Shift++
Ctrl+Shift+-
Ctrl+Space
Debug keys added from kUIDebugAcceleratorMap:
Ctrl+Alt+Shift+T
Ctrl+Alt+Shift+V
Ctrl+Alt+Shift+M
Related
I want to be able to turn certain extensions on and off with a keyboard shortcut. But didn't found out how to do keybindings for extension activation
Specifically I wanna do this for VSCodeVim. So that I can use it more often and become more used to using Vi
To toggle Vim mode in Vscode do the following:
Use 'CTRl+Shift+P' to open vscode command palette
type 'vim toggle', you will see 'Vim: Toggle Vim Mode' option
select it and press enter to toggle vim mode.
To add keybinding (shortcut) for toggling :
open command palette using 'Ctrl+shift+p'
type 'shortcuts'
select 'Preferences: Open Keyboard Shortcuts' and press enter
search 'toggleVim'
click on 'Keybinding' column
press the buttons you want for the shortcut and press enter
Not every extension can be disabled by this method, But all extensions can be disabled or enabled for a particular workspace.
I have a new installation of Visual Studio Code (default configuration, with vim keymap). I want to use the command "add selection to find next match". I think this is equivalent to how multicursors work in sublime text and vim (with an extension), or Atom (find and replace: select next).
When I try to run the command directly by using Ctrl D it does not work, taking me to the last line in the file. This might be some kind of conflict that might be easy to solve.
More interestingly, when I run the command from the command palette Ctrl Shift P.
The first time selects the word I am at (well done!)
The second time selects the next occurrence of that word, but loses the selection, moving the two cursors right after the two first occurrences of the word.
The third time and next times nothing happens, the selection was lost in the previous time.
How to get the awesome normal behaviour that other editors have?
PD: I have now confirmed that this behavior is not present without the vim keymap, may they be compatible somehow?
Ctl + D is a default Vim keybind that scrolls the window down in the buffer. This is expected behavior for the Vim extension, and you should disable the mapping if you wish to use it to run the VSCode command "Add Selection To Find Next Match".
To do this, open the extension's setting by clicking File > Preferences > Extensions. From there, choose the Vim extension and select the option to Configure Extension Settings. There will be an option called Handle Keys, where you can enter JSON data to send certain key combos back to VSCode (and there's another option to turn off all Ctl + Letter combos, called Use Ctrl Keys). You can find some examples of such data on the extension's Marketplace page. Below is the snippet of code that I added to my settings.json file to get Ctl + D back.
"vim.handleKeys": {
"<C-d>": false
}
From my testing, it looks like changing this setting also fixes the behavior when using the Command Palette. It might be a bug, but who cares when you are most likely just going to use Ctl + D anyway. :)
I'm on a mac terminal using the auto-pairs plugin. I'm trying to use the feature to wrap some text in parentheses. The manual says to use <M-e> but I do not know what this corresponds to on my keyboard. I've tried just about everything but nothing works. Google turns up nothing.
In Terminal.app…
open the Preferences window,
choose the Profiles tab,
choose your current profile,
under Keyboard, check "Use 'Option' key…".
In iTerm.app…
open the Preferences window,
choose the Profiles tab,
choose your current profile,
under Keys, choose which option key you want to use as Meta and check +Esc.
In your vimrc, add the line below to make it understand <M-e>:
set <M-e>=^[e
The ^[ is a literal <Esc> that you insert by typing <C-v> then <Esc>.
I think "M" normally refers to either "Mod" (alt) or "Meta" (the apple key in your case). So it would either be alt-e or apple-e
I am using putty to connect a remote host and editing via vim. I meet a trouble when I try to paste something to vim. That's, I copy something to clipboard in my local host and want to paste it to the vim in the remote host. How to do that?
ps: I am using putty! So, I open a vim window via putty. The very need is that I want to copy something in my local host and paste it to the vim editor opened by putty. That's all. Thanks!
Try with Ctrl + Shift + V or with middle click with a 3 button mouse
EDIT
What about? Shift + Ins
Source : https://superuser.com/questions/180043/paste-the-windows-clipboard-into-my-putty-session-using-only-the-keyboard
You can insert text from your host’s clipboard by pressing the right mouse button (default setting) or by pressing Shift + Ins. Note that this has the same effect as entering every character manually. So if you are using auto indentation in vim, this will very likely screw up your code.
To fix that, you can do the following:
Before pasting into vim, enable paste mode by entering :set paste.
Press i to enter insert mode. The status bar should say -- INSERT (paste) -- now.
Press the right mouse button to paste in your stuff. The auto indentation of vim should not happen.
If this puts you into the -- (insert) VISUAL -- mode, exit out of it using Esc (putting you into the paste insert mode again), and try pasting it again while holding Shift using your right mouse button.
Press Esc to leave insert mode, and disable paste mode using :set nopaste again.
You can change which mouse button is used to paste in PuTTY in the Window/Selection configuration page.
In Windows Subsystem for Linux it appears that you have to:
i = to enter -- INSERT -- mode
Shift-right-mouse-click = to paste
If you just right-mouse-click (i.e. without shift) then annoyingly all that happens is that the mode changes to -- (insert) VISUAL -- i.e. it doesn't paste anything.
To clarify the other answers, there are a couple ways to do this, depending on if Vim is running with mouse support. Lets assume its via some sort of terminal/Putty:
When not using mouse in remote Vim, right clicking will paste from local clipboard via Putty into remote Vim.
With mouse enabled in remote Vim, Shift + Ins will paste from local clipboard via putty into remote vim.
Ctrl + Shift + v will paste from local clipboard via native/*nixish/xterm into remote vim.
With mouse enabled in remote Vim, middle clicking will paste from remote clipboard into remote Vim.
Copy&Paste between Windows&PuTTY:
To copy from Windows and paste into PuTTY, highlight the text in Windows, press "Ctrl-C," select the PuTTY window, and press the right mouse button to paste. To copy from PuTTy and paste into Windows, highlight the information in PuTTY and press "Ctrl-V" in the Windows application to paste it.
Copy&Past between two vim in separate PuTTY:
highlight the information in the source PuTTY, and then press the right mouse button in the target PuTTY to paste.
qnamebuf plugin description says:
<S-F4> opens an explorer from the current working directory showing all files which are not in a hidden directory (one that starts with '.')
I'm not very good with Vim, but I imagine S-F4 is a capital S followed by F4. However, when I press S, I find myself in insert mode, and pressing F4 after this, just adds an F4 in the window. What should I do to make the command work? I am running gVim under Windows.
The S stands for Shift. So try pressing Shift-F4.