In my Sublime Text 3, the shortcut Ctrl+A moves cursor to the front of line as expected. However, Ctrl + E does not move cursor to the end of line. Then, I find out that this works: Command+RightArrowKey on Mac.
Anyone knows why Ctrl+E does not work as expected in the official shortcut documentation? What command shall I configure in the keybinding map?
My User key binding is very simple.
[
{ "keys": ["shift+space"], "command": "move", "args": {"by": "characters", "forward": true} },
]
When keys don't do what you expect in ST3 it's a good idea to install FindKeyConflicts
Install it through Package Manager and it'll help you work out why things aren't doing what you thought they should
The shortcuts listed are specific to the platform and the version of the Sublime Text. Here is the list of all the shortcuts, there is also a comparison chart here. Further, if you are getting started with Sublime Text3 this link might prove helpful.
Related
I'd like to customize some of the Sublime Text 3 keybindings to mimic IntelliJ IDEA. One of them is opening a file from the current project, also known as Goto Anything in Sublime jargaon. I followed the instructions in this answer to find out that the default key binding for "Goto Anything" is ⌘ + p on a Mac, like so:
{ "keys": ["super+p"], "command": "show_overlay", "args": {"overlay": "goto", "show_files": true} }
I added a new keybinding as follows:
[
{ "keys": ["shift+shift"], "command": "show_overlay", "args": {"overlay": "goto", "show_files": true} }
]
It, however, doesn't work; pressing shift twice in rapid succession does precisely nothing. When I open the console, I see the following message:
Unable to open /Users/me/Library/Application Support/Sublime Text
3/Packages/Default/Default (OSX).sublime-keymap
According to this ticket, this message is harmless but misleading, and is just an indication that Sublime is opening a file.
What's wrong then?
OP here; I found this post in Sublime blog.
ST doesn't support using only modifier keys in a keybinding.
I use Debian and I switched from Vim to Visual Studio Code, when I noticed, that there is a Vim movement extension for VS Code from vscodevim. While I was using Vim, I mapped my Caps lock key to the ESC key. In Vim it works perfectly, but VS Code is not reacting on a Caps lock input.
I hope there is a solution. If there are any questions feel free to ask.
This is how I changed my keyboard layout:
I navigated to /etc/default/
and edited the keyboard file. This is how it looks now
# KEYBOARD CONFIGURATION FILE
# Consult the keyboard(5) manual page.
XKBMODEL="pc105"
XKBLAYOUT="de"
XKBVARIANT=""
XKBOPTIONS="caps:escape"
BACKSPACE="guess"
The Caps lock key works also in other programs e.x. "Synaptic Package Manager"
Late answer, but may be useful for someone:
Switched CAPS and ESC in Ubuntu over the keyboard preferences section. Worked in almost all applications, but not in Visual Studio Code.
So I modified VS Code settings:
{
"keyboard.dispatch": "keyCode"
}
and it worked.
For those who have the same problems on Linux:
If in your system wide config, Caps Lock is Esc, Esc is Caps Lock ( ['caps:swapescape'] ),
disable the key mapping in your system. Make it default.
In VSCode, press ctrl+shift+p and select Preferences: Open Keyboard Sortcuts
search for the vim_escape
double click on it and press original Caps Lock and save it.
Edit your keymap config in your system.
That is it.
There is no problem. Keys are working as expected.
Enlighten by an answer from this question.
In Visual Studio Code, how to toggle between vim-emulation and no-vim-emulation when the vscodevim extension is installed?
Another solution is
Click the "Gear icon" -> Keyboard Shortcuts->type "esc" or "Escape" ->
find extension.vim_escape -> edit by click the pencil icon or right click choose change keybinding
->type you desired key and ENTER
Set the Caps-lock to act as Esc in your settings
Post this in your keybindings json for vscode (Ctrl-K Ctrl-S -> open the JSON from the icon on the top right corner):
{
"key": "capslock",
"command": "extension.vim_escape",
"when": "editorTextFocus && vim.active && !inDebugRepl"
},
If you are looking for a system wide tool, you might be interested in keyd https://github.com/rvaiya/keyd. You can avoid this setup. The readme has an example on how setup caps lock as both ctrl and esc.
Ubuntu solution
First make sure you swaped escape with capslock like: source
gsettings set org.gnome.desktop.input-sources xkb-options "['caps:swapescape']"
Then inside VSCode press ctrl+shift+p search for Preferences: Open keyboard Shortcuts (JSON) (it will open keybindings.json) and paste:
{
"key": "capslock",
"command": "extension.vim_escape",
"when": "editorTextFocus && vim.active && !inDebugRepl"
},
{
"key": "escape",
"command": "-extension.vim_escape",
"when": "editorTextFocus && vim.active && !inDebugRepl"
}
Reload VSCode and you are good to go.
Windows solution
Install AutoHotkey
Go to AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\
Create a file caps_to_esc.ahk and insert code:
#IfWinActive ahk_exe Code.exe
Capslock::Esc
Esc::Capslock
#IfWinActive
Save, run the file and you are good to go.
How do I set up a keyboard shortcut to show/hide tabs and the status bar in Sublime Text 3?
At the moment I have to go View->Show/Hide Tabs. I'm using OSX. I have for instance
{ "keys": ["shift+space"], "command": "move", "args":
{"by": "characters", "forward": true},
in my key bindings user file which I set up (thanks to this answer!) to move the cursor one space forwards by pressing shift and space, and ideally I'm looking for something similar to show/hide tabs and the status bar.
In the ST console, enter sublime.log_commands(True). Then execute the command through the menu as normal. The command being executed (with arguments if applicable) will be displayed in the ST console. You can use the information there to create a key binding to the appropriate command.
I have installed the Filter Lines plugin (Windows OS) but I can't figure out if it is possible to have a keyboard combination for the Edit > Code Folding > Fold With String as I cannot find the default keyboard combination ctrl+k ctrl+s in the Key Bindings - Default?
If this is not possible, can anyone then refer to another filter plugin, which (ideally) realtime filters the text, so I can edit all the lines in one go?
I want keyboard shortcuts for the Code Folding lines:
Just look at the plugin source and you will know what command to run as shortcut. If the name of the command class is FoldToLinesCommand, the command name in the shortcut files will be fold_to_lines.
Another solution is to open Sublime console, and enter
sublime.log_commands(True)
this will log all the commands in the console. After, you just have to run the command you want as a shortcut, look at the console output and write it in your key bindings files.
Do not forget to disable command logging when you are done to avoid useless output.
As alternative to extra plugins, I'm currently using Sublime's own folding shortcuts. Note that when making a selection, of a word or line for example, you will only fold the selected string.
The ctrlshift[ shortcut may be used to fold a code block.
Ofcourse, unfolding can be done with the related ctrlshift] shortcut.
These shortcuts are defined in the Default Sublime keymap, as fold and unfold, as following.
{ "keys": ["ctrl+shift+["], "command": "fold" },
{ "keys": ["ctrl+shift+]"], "command": "unfold" },
Hope this helps you out.
I'm trying to mimic the functionality I set in Sublime Text that allows me to move the cursor much like 'j' or 'k' in VI. In the Windows world I guess it would be similar to a pgup/pgdn, however I'd like to just go up/down one line not one page.
Here's my bindings in Sublime Text that I'd like to mimic:
[
{"keys": ["ctrl+i"], "command": "move", "args": {"by": "lines", "forward": false}},
{ "keys": ["ctrl+k"], "command": "move", "args": {"by": "lines", "forward": true}}
]
Edit: As Logarr pointed out, the easier way to phrase this is I want to mimic the Up/Down arrow keys using ctrl+i and ctrl+k
There are already Vim extensions for Visual Studio. There is the free VsVim extension that works in Visual Studio 2010+ and ViEmu which works in Visual Studio 2003+ plus a few other applications.
If you just want to remap the up and down keys, then you can change the keyboard mapping. From Tools->Options find the Keyboard section. From there you can change the key bindings for Edit.LineDown and Edit.LineUp. You may want to select the Text Editor for the "Use new shortcut in:" setting so these changes only affect the text editor.
This would have been trivial if Microsoft hadn't ripped the macro functionality out of Visual Studio.
You could install AutoHotKey and write a simple script. This would have the advantage that you could apply these keymappings to any applications you like as well as Visual Studio.