VsVim keyboard shortcut to switch between files/tabs? - visual-studio

I recently installed VsVim.
It's great, but I find myself constantly reaching for the mouse in order to switch between files.
Is there a built in solution? I cannot find a list of VsVim shortcuts anywhere.

Found the answer here: Tab/Window group movement: (Ctrl-W)(Ctrl-L), etc
Use gt or gT to go back and forth between tabs.

Also note that Ctrl+Tab works for cycling through tabs.
It seems to be implemented as a MRU-to-LRU tab stack, meaning that hitting Ctrl+Tab once will take you to the most recently used prior tab, and hitting Ctrl+Tab again will take you right back where you were.
There's a pop-up that displays the available tabs as long as Ctrl is held down, allowing you to choose a tab from the list.
Basically this is similar to classic MDI window tabbing.
I don't think this is part of VsVim, but rather a pass-through to Visual Studio.

Also as an addition to these ways of swapping windows I also use
ALT W then you can use the number keys to select a tab. this is kept in most recently used order, so selecting 2 will always go to the previous tab you were in.
The other thing you can use is marks. m<capital letter> will set a mark that jumps across files ( lowercase marks work within a file ). To jump to a mark use `< mark letter >

First if you are talking about tabs gt and gT work for Going to next/prev Tab.
This question is pretty old, so the <C-w> shortcuts might not have been implemented yet, but even in Vim I never did like those shortcuts. As I substitute I added some leader bindings using the standard hjkl navigation keys. My leader is mapped to spacebar, so these are really easy to use. I also rebind tab navigation to [b and ]b, which are buffer navigation bindings in one of Tim Pope's Vim addons:
let mapleader="\<Space>"
" Window control/navigation leader mappings
nmap <leader>h <C-w>h
nmap <leader>j <C-w>j
nmap <leader>k <C-w>k
nmap <leader>l <C-w>l
nmap <leader>c <C-w>c
" Tab cycling
nmap [b gT
nmap ]b gt

Related

Keyboard shortcut to select editor tab by number in XCode

Is there a way to select a tab by ordinal number - like in browsers? In particular something like Control-1/Control-2 or Alt-1/Alt-2 to select one of the two tabs presently displayed.
Note that even the command-{ and command-} are not working for me.
Therefore even the less preferable approach of cycling through the tabs - as shown in a couple of questions such as this one https://apple.stackexchange.com/questions/85461/programmer-new-to-apple-how-to-efficiently-switch-between-files-in-xcode - do not work. So presently there is no way to switch tabs except by physically clicking on them.
A quite acceptable alternative would be a keyboard driven quick-list like Command-E in JetBrains IDE's (intellij, pycharm, AppCode, etc)
This is not an answer to your real question, which is a great idea — the answer is no, there isn't. (File an enhancement with Apple...!)
However: The keyboard shortcut for toggling to the next tab is Control-Tab, which I find quite easy to remember.
Also note that all keyboard shortcuts are user-configurable.

Switch between two opened editors

I have two editors opened, one on the left and one on the right. How to switch between them? I tried Ctrl + 1/2/3 but doesn't work.
It works, using the 1, 2 keys above the letters (not the keypad). Events in the keyboard shortcuts panel are under workbench.action.focusFirstEditorGroup and so on.
You can also bind commands such as workbench.action.navigateRight and so on to move focus between panels.
Ctrl+Shift+P show all commands, search Preference: Open Keyboard Shortcuts and open it, then you can search the action or shortcuts.
for this problem,searchfocusFirstEditorgroup,you can see the shortcut,change as you like.then searchfoucusSecondEditorGroup and so on.

Is there a way to make alt-f and alt-b jump word forward and backward instead of printing ƒ and ∫ on Mac?

I understand that Mac has some Emacs keybindings enabled by default (e.g. Ctrl+A move to beginning of line etc.). If I open TextEdit for example I can navigate like in Emacs.
But when I try Alt+F or Alt+b for move to next word or last word it does not work. It prints out ƒ and ∫ instead.
Is there a way to jump words instead?
I think that I did not tinker with the keybindings and I use the US layout on a german keyboard.
If you want to re-enable them for the terminal
Terminal -> Preferences -> Keyboard
Check 'Use Option as Meta key'
my iTerm2 version is 3.1.6, profile -> keys -> set Esc+
Maybe one of these helps? (I don't use OSX myself, so I can't test anything).
http://blog.sensible.io/2012/10/19/mac-os-x-emacs-style-keybindings-everywhere.html
http://aufflick.com/blog/2006/01/10/emacs-keybindings-everywhere
Summary from first URL:
Create file ~/Library/Keybindings/DefaultKeyBinding.dict with the following content and restart all apps.
{
"~d" = "deleteWordForward:";
"^w" = "deleteWordBackward:";
"~f" = "moveWordForward:";
"~b" = "moveWordBackward:";
}
I'm a little confused if you're talking about the keys (within different apps on OS X) or specifically Emacs. On OS X the standard keys you would use to jump between words is:
option/alt + Left Arrow or Right Arrow
If it's specific to Emacs for OS X:
For Terminal.app, starting from Snow Leopard: Go to Preferences > Settings > Keyboard > Use option as meta key.
For iTerm: Go to Manage Profiles > Keyboard profiles > (your profile) > Option Key as…
If you want to use Option key for both international characters and
Meta key in Emacs, see info below for iTerm 0.10.x patch and/or binary.
Alt-b and Alt-f for navigating by word also works for your shell now.
UPDATE: The link the original website providing the patch is no longer online, however I was able to retrieve the cached information from the archive.org:
OSX + terminal + Meta key + national characters
Quite a mix, right? If you’re user of one of those keyboard layouts that have hidden some non-ISO1 characters under Option-key shortcuts and you use command line – read on, I might have a treat for you.
As it stands today, if you’re OSX user, and would like to use your Option (Alt) keys for both national characters and Meta-* shortcuts, you’re in for an unpleasant surprise – you can’t. It’s one or the other: both iTerm and Terminal.app allow you to flip between Option keys role, but neither of them allows you to use Option for both. Under Linux, it’s customary to use left Alt for Meta-* and right Alt for any national characters you might require. Same goes for Windows. Of course you can just train yourself in using ESC key in a prefix manner, but that’s avoiding the real problem.
Getting annoyed by this state of things, and faced with some Emacs usage, I decided to take advantage of the fact that iTerm is opensource software, and see if I can make a tiny change, to cater for my needs. Surely enough, after ~25 minutes I got a trivial patch: just changed the mask that iTerm uses for detecting that Option key is pressed down. It took few hours and 5 chapters of Cocoa book, to turn that into fully-fledged option in Keyboard Profiles section of iTerm. This was my first foray into lands of Objective C; while I came back victorious, I don’t see myself writing anything bigger in Objective C in nearest future.
Here’s the meat: ( https://sourceforge.net/p/iterm/patches/44/ )
“right Option is Normal” patch;
full patch allows you to pick which keys should be treated as Meta (both, only left, only right);
The patches were made against 0.10.x branch, at revision
1871.
Once you have the binary, launch it and go to Bookmarks > Manage profiles > Keyboard profiles. If you select a keyboard profile, you should see a new dropdown at the bottom of the keybindings list.
The options should be pretty much self-explanatory. The configuration shown above is the one I’m using — this way I get all Meta-* shortcuts with my left Option key, and all Polish characters with right Option key. Which is the way it Should Be™ :)
I haven’t heard from iTerm authors yet, so I have no idea whether this patch is going to merged upstream or not. I’ve been using my patched version for almost week and a half now, and nothing major exploded. Yes, iTerm is slower to redraw the screen on larger terminals (say, 130×80), but there are certain features (like 256 colors support) that make up for that.
more info: http://www.emacswiki.org/emacs/EmacsForMacOS
On iTerm2 3.0.15, go to:
Preferences -> Default -> Keys tab ->"Left option() key acts as:"
and change the value to:
+Esc
Solved this at the OS level as follows,
⟶ System preferences
⟶ Keyboard
⟶ Input Sources Tab
⟶ + at bottom left
⟶ Others in the left panel
⟶ add and select Unicode Hex Input from right panel
 ✓  Mac no longer prints anything on alt+letter|number
 ✓  enter unicode characters via alt+[code]
 ✅ the OS does not grab alt key shortcuts!
You should use KeyRemap4MacBook. In the Emacs Mode section, you will find numerous options to use the Option key as Meta including Option+BF to Option+Left/Right.
However, if you're a hardcore Dvorak user like myself who wants to use key bindings such as M-b and M-f using the original Dvorak layout, there's a problem. You can only "move backward/forward one word" in QWERTY layout. I use version 8.4.0 so I don't know about the latest version for Mavericks.
I use BetterTouchTool. Works like this:
Basically remaps Option-F and Option-B to Option-Right and Option Left, and I turned this on for any apps that I want the shortcut in, e.g., Firefox, Obsidian, Slack. Works great!
For Hyper you can fix the option key by setting the following configuration to your ~/.hyper.js file:
module.exports = {
config: {
modifierKeys: { altIsMeta: true }
}
}
source

How do I move through intellisense suggestions with a keyboard shortcut?

When I write something like Console. I get suggestions like Console.Write and Console.WriteLine. I don't want to use the arrow keys, they are too far away, how do create a shortcut for that? I would prefer something like shift+o for moving up and shift+k for moving down.
Try TouchCursor, it lets you use the home keys as cursor key
TouchCursor
You can always remap the keyboard shortcuts to do what you want. See my answer here: https://stackoverflow.com/a/18744507/958809
I don't if there is an alternative for navigating one by one but you can use the first letters of every word to quickly find what you are looking for.
Typing Console.wl will quickly bring up Console.WriteLine. It's available by ReSharper I think.
You don't even have to type the first letters by the order. Typing avl can bring up SomeMethodWithAVeryLongName.
I don't know solutions within Visual Studio and ReSharper.
But maybe a remapping of keyboard keys can help, i.e. remap Caps Look key to Arrow Down key. See http://www.askdrtech.com/solutions/post/How-to-change-keyboard-mapping.aspx for explanation.
I think your problem is just this: Ctrl + Alt + Space
In VS Code, go to File > Preferences > Keyboard Shortcuts
Search for suggest select in the search bar
the ones you want to change are selectNextSuggestion and selectPrevSuggestion. I mapped mine to TAB and shift + TAB, respectively, to free my arrow keys.
There's plenty of cool stuff you can customize for Intelisense. Check the documentation page: https://code.visualstudio.com/docs/editor/intellisense

Strange visual studio 2008 behavior when pressing keys

Every once in a while I'll do something that causes strang behavior when pressing certain keys.
1)The single quote key (') will not type a character unless I press it twice, in which case it will print two backwards single quote characters (``).
2)The ` (backwards single quote?) key types a # character.
3)The angle bracket keys (< and >) type a single quote (') and a period (.).
4)Shift + any A-Z character types the character and brings the code completion window up.
I'm sure there's other symptomps, and they only want I've found to stop it is to restart Visual studio. This behavior does not appear in any other apps. Anybody experience this?
I started getting this on my computer (not in Visual Studio, but everywhere else). I had default input language set to "English(New Zealand) - United States-International", whatever that is supposed to mean. Changed it to English-US. Disabled the "Language Bar"
"Control Panel >> Regional Settings >> Languages, click on Advanced, look at Installed Services. See if you have multiple choices - if you have an "International" option, remove it and I believe the problem will go away. It did for me.
AFAIK, this happened when I installed XP-SP3.
You probably have an alternate input language set up (try typing ` a when this happens and you'll get à). I think the default hotkey to switch between input languages is Ctrl+Shift, so you're probably hitting it by accident occasionally. Use the language settings control panel to turn off the hotkey or remove the unwanted keyboard configuration.
I have a laptop/keyboard which can be used for French-Canadian. Alternative key-meanings are printed on some keys (in green) ... and they match the keys you mentioned, i.e.:
alt of ' is ``
alt of ` is #
alt of < and > are ' and .
I have an edition of Vista installed that knows about French-Canadian. On the right-hand end of the O/S Taskbar, near the clock, there's a keyboard icon. It's usually set to "US but if I set it to "Canadian French" then I get the key mappings you describe.
Something similar (i.e. changing the language-specific interpretation of the keyboard) must be happening on your machine too. You say it's in Visual Studio, but for me I find it in my O/S.
If you have multiple languages on your machine, then you probably triggered this behavior by pressing ctrl+shift, which causes windows to switch the system language for the active window.
You can either press it again, or better yet, disable the language bar and all other secondary languages.
Like others have said, you can press ctrl-shift to "loop" through the settings.

Resources