Disable VSCode keybindings when switching keyboards - visual-studio-code

I have a lot of custom keybindings when attaching my non-English Windows-Keyboard to my English Mac.
When working directly with the Mac, I have to disable some of the bindings by commenting out a big section in the keybindings.json.
How can I automate this settings switch?
I know that keybindings use a when clause, but I did not find a way to check which keyboard is active or if I am on battery or not, or any other difference in the two setups.

You can use the extension Extra Context.
You can set (or toggle) a context variable to select a bunch of keybindings.
You can use multi-command to combine several set-on set-off for variables to select a particular keyboard.

Related

Use PC shortcuts on Macs

The keybindings are really strange for VS code on Mac. Some keys are the same as PC (eg. Ctrl+left/right for next/prev word) while others are different (Command+P instead of Ctrl+P to open command palette).
I want to use PC shortcuts because I hate Macs.
I already have a Karabiner setup which globally adjusts my modifier keys (so that Ctrl acts as Command for example). I can also add exceptions for specific programs (eg. just VS code). However, I suspect just telling Karabiner to swap Ctrl and Command in VS Code will not work, since now I will have to press Command+left/right for next/prev word which I don't want to do.
Is there a way to just tell VS code to use PC shortcuts everywhere? PyCharm for example has this option. Alternatively, would I have to go through the gull bindings list and remap 100s of bindings for Mac? I could potentially do this with some scripting, but surely there's a better way?

Folder View Focus Disable Automatic Search

I would like to change the automatic find that happens when the Explorer Folder View is in focus:
Steps to reproduce (provided you have default bindings):
Open a workspace with files
Focus on the folders view
Start typing anything
This is to find files based on what you type (notice the find query in the top right) and the arrow keys skip to them. I would like to remap this feature to something like Ctrl+F (with a 'when expression', if possible) that way I can use other shortcuts for things like adding a new file. If this can not be remapped, I'm ok with disabling it, provided that's allowed.
I used to have the atom keymap extension that changed this but I removed it so I would be forced to learn all the default shortcuts so when I go into work I wouldn't be phased no matter what device I am on
I was looking through the atom keymap repo and found a comment on the main js file about 'new explorer filtration'. Interesting to see documentation being useful :p Anyways, I noticed they added a context setting so I changed the following user setting:
workbench.list.automaticKeyboardNavigation = false
Controls whether keyboard navigation in lists and trees is automatically triggered simply by typing. If set to false, keyboard navigation is only triggered when executing the list.toggleKeyboardNavigation command, for which you can assign a keyboard shortcut
We need either better setting id naming conventions or better ways to find settings, especially now that the list has grown substantially. I would have never guessed this would be the name of the setting, or list.toggleKeyboardNavigation being a trigger, since you aren't actually navigating

Eclipse shortcut to switch between editor groups

I can use Ctrl-F6 or Ctrl-Shift-PgUp/Down to switch between files in the editor.
This works well if there is only one editor visible.
But when i have arranged the editor in two halfs, some files are left, some files are right. This is called "split window", like this example https://codeyarns.com/2010/01/04/how-to-split-window-in-eclipse/
I do not mean the split editor, where the same file is shown in two halfs.
How can I toggle between the left/right side (or however they are arranged), always to the already visible file?
This is one of the benefits of the Emacs+ Eclipse plugin. When this is installed, the "other-window" function will be available, which does exactly what you're looking for.
Note that using the Emacs+ plugin does not require you to know anything about Emacs or Elisp. It simply provides a large catalog of functions that are similar in spirit to what Emacs provides.
You could use the "Emacs+" keyboard scheme, which is consistent with typical Emacs bindings, but I don't use it, as I prefer to integrate Emacs+ with Eclipse, not the other way around. I like to choose a "prefix sequence" that I use to group many functions that I like to use. For instance, I use "Ctrl+;" (ctrl-semicolon) as that prefix. I bound "other-window to "ctrl+; o". You can use whatever scheme you like. Despite my goal to use my own bindings, there are some functions that are awkward if you don't use the binding from the Emacs+ scheme, like binding "ctrl+s" to the incremental regexp search function.

How do you find out which mode changed a keybinding in emacs?

I found out when I use gud-gdb, it overrides one of my keybindings. I would like to check which mode changed the keybinding (I know it's probably gud-gdb, but I would still like to know how to check this). I know about C-h k, but is it possible to check which mode set a keybinding?
I use C-h+m, which runs describe-mode. That lists all the keybinds associated with each mode that is currently active. The keybinding that is getting clobbered will likely be there.
In general, when assigning keys (either as a user or as a mode author) it's best to follow the Emacs key binding conventions.

Autocompletion from the keyboard in Emacs CEDET/semantic

Looking a the different methods for completion in CEDET semantic (fresh version from the Bazaar repository), I see I have the following options (keyboard bindings as suggested by Alex Ott in his config file)
C-c ? (semantic-ia-complete-symbol)
C-return (semantic-ia-complete-symbol-menu)
C-c , l (semantic-analyze-possible-completions)
However, none of them seem to give me the option to choose between the possible completions conveniently using the keyboard.
For example, (semantic-ia-complete-symbol-menu) opens a menu where I can choose between the different options, but as far as I can tell it requires me to use the mouse (I tried C-n, C-p, M-n, M-p to navigate the menu with no success).
On the other hand (semantic-ia-complete-symbol) opens another buffer with the options. I can also use the mouse to choose the desired autocompletion, but I would like to use the keyboard instead.
Also, in previous versions of CEDET, there was a variable (semantic-complete-inline-analyzer-displayor-class) that allowed me to choose between several options for autocompletion (e.g. (semantic-displayor-ghost), or a more elegant overlay as a tooltip), but this variable does not seem to exist anymore.
In case it matters, I work mostly with C++ files.
Update:
The only method that seems to allow me to cycle through autocompletions is C-c , space (semantic-complete-analyze-inline), where I can use TAB to autocomplete, but it doesn't show a menu of possible autocompletions that I can choose from.
In new versions of CEDET it's recommended to use auto-complete or similar packages. You can add ac-semantic to ac-sources, and then auto-complete will use Semantic as source of data for completions. The new version of Emacs/CEDET articles, mentions this setup & shows necessary code. Please try it