Sublime 'alt+ numeric keys' work to switch between least 10 tabs opened
but same option doesn't work with keypad keys doesn't work.
does anybody have idea how to make it work?
thanks :)
Just add this to your User keybindings file:
{ "keys": ["alt+keypad1"], "command": "select_by_index", "args": { "index": 0 } },
{ "keys": ["alt+keypad2"], "command": "select_by_index", "args": { "index": 1 } },
{ "keys": ["alt+keypad3"], "command": "select_by_index", "args": { "index": 2 } },
{ "keys": ["alt+keypad4"], "command": "select_by_index", "args": { "index": 3 } },
{ "keys": ["alt+keypad5"], "command": "select_by_index", "args": { "index": 4 } },
{ "keys": ["alt+keypad6"], "command": "select_by_index", "args": { "index": 5 } },
{ "keys": ["alt+keypad7"], "command": "select_by_index", "args": { "index": 6 } },
{ "keys": ["alt+keypad8"], "command": "select_by_index", "args": { "index": 7 } },
{ "keys": ["alt+keypad9"], "command": "select_by_index", "args": { "index": 8 } },
{ "keys": ["alt+keypad0"], "command": "select_by_index", "args": { "index": 9 } },
open preferences keybinding and add this lines.
and now alt+keypad 0-9 keys work to swtich tabs
[{ "keys": ["alt+keypad1"], "command": "select_by_index", "args": { "index": 0 } },
{ "keys": ["alt+keypad2"], "command": "select_by_index", "args": { "index": 1 } },
{ "keys": ["alt+keypad3"], "command": "select_by_index", "args": { "index": 2 } },
{ "keys": ["alt+keypad4"], "command": "select_by_index", "args": { "index": 3 } },
{ "keys": ["alt+keypad5"], "command": "select_by_index", "args": { "index": 4 } },
{ "keys": ["alt+keypad6"], "command": "select_by_index", "args": { "index": 5 } },
{ "keys": ["alt+keypad7"], "command": "select_by_index", "args": { "index": 6 } },
{ "keys": ["alt+keypad8"], "command": "select_by_index", "args": { "index": 7 } },
{ "keys": ["alt+keypad9"], "command": "select_by_index", "args": { "index": 8 }}]
Related
When I look at the settings.json file, the keys ctrl+shift+NUMBER are supposed to jump to a certain console profile, but they don't see, to work. Looking at it through Visual Studio Code, the error message is 'Incorrect Type. Expected "object".
Key bindings in settings.json:
"keybindings": [
{
"command": "closePane",
"keys": [
"ctrl+shift+w"
]
},
{
"command": "copy",
"keys": [
"ctrl+shift+c"
]
},
{
"command": "duplicateTab",
"keys": [
"ctrl+shift+d"
]
},
{
"command": "newTab",
"keys": [
"ctrl+shift+t"
]
},
{
"command": "newTabProfile0",
"keys": [
"ctrl+shift+1"
]
},
{
"command": "newTabProfile1",
"keys": [
"ctrl+shift+2"
]
},
{
"command": "newTabProfile2",
"keys": [
"ctrl+shift+3"
]
},
{
"command": "newTabProfile3",
"keys": [
"ctrl+shift+4"
]
},
{
"command": "newTabProfile4",
"keys": [
"ctrl+shift+5"
]
},
{
"command": "newTabProfile5",
"keys": [
"ctrl+shift+6"
]
},
{
"command": "newTabProfile6",
"keys": [
"ctrl+shift+7"
]
},
{
"command": "newTabProfile7",
"keys": [
"ctrl+shift+8"
]
},
{
"command": "newTabProfile8",
"keys": [
"ctrl+shift+9"
]
},
Is there an issue with the way my settings.json file is structured?
Thanks
You need to structure your keybindings to open a new tab using the command structure:
{ "action": "newTab", "index": 0 }
The profiles are just an array and are accessed for keybindings by their index rather than their name. So you can access the first 9 profiles to open in a new tab like this:
{ "command": { "action": "newTab", "index": 0 }, "keys": "ctrl+shift+1" },
{ "command": { "action": "newTab", "index": 1 }, "keys": "ctrl+shift+2" },
{ "command": { "action": "newTab", "index": 2 }, "keys": "ctrl+shift+3" },
{ "command": { "action": "newTab", "index": 3 }, "keys": "ctrl+shift+4" },
{ "command": { "action": "newTab", "index": 4 }, "keys": "ctrl+shift+5" },
{ "command": { "action": "newTab", "index": 5 }, "keys": "ctrl+shift+6" },
{ "command": { "action": "newTab", "index": 6 }, "keys": "ctrl+shift+7" },
{ "command": { "action": "newTab", "index": 7 }, "keys": "ctrl+shift+8" },
{ "command": { "action": "newTab", "index": 8 }, "keys": "ctrl+shift+9" }
I'm using Sublime Text 3, and I am trying to not use arrows for anything. However I can't seem to scroll through different results of autocomplete or Ctrl+P without the arrows.
Any suggestions? Thanks!
You probably want something like this in your keymaps file:
// navigation with tab in autocomplete popup
{ "keys": ["tab"], "command": "move", "args": {"by": "lines", "forward": true}, "context": [{ "key": "auto_complete_visible" }] },
{ "keys": ["shift+tab"], "command": "move", "args": {"by": "lines", "forward": false}, "context": [{ "key": "auto_complete_visible" }] },
// navigation with tab in overlay
{ "keys": ["tab"], "command": "move", "args": {"by": "lines", "forward": true}, "context": [{ "key": "overlay_visible", "operator": "equal", "operand": true } ] },
{ "keys": ["shift+tab"], "command": "move", "args": {"by": "lines", "forward": false}, "context": [{ "key": "overlay_visible", "operator": "equal", "operand": true } ] },
Does anyone know this shortcut? I'm looking for it online, but I can't seem to find it
To move it is CTRLSHIFT1 to move to Group 0, CTRLSHIFT2 to Group 1, and so on - that's on Linux, Windows, and OSX.
Text buffers can also be moved to their neighbouring groups:
Linux, Windows:
CTRLk + CTRLSHIFTLEFT
CTRLk + CTRLSHIFTRIGHT
OSX
SUPERk + SUPERSHIFTLEFT
SUPERk + SUPERSHIFTRIGHT
Here's the whole group section of my Default (Linux).sublime-keymap - the Windows keys are all exactly the same, while the OSX keys are the same in the top section but differ in the bottom section, below where I have placed an explanatory comment.
// The keys BELOW are for Linux, Windows, and OSX.
{ "keys": ["ctrl+1"], "command": "focus_group", "args": { "group": 0 } },
{ "keys": ["ctrl+2"], "command": "focus_group", "args": { "group": 1 } },
{ "keys": ["ctrl+3"], "command": "focus_group", "args": { "group": 2 } },
{ "keys": ["ctrl+4"], "command": "focus_group", "args": { "group": 3 } },
{ "keys": ["ctrl+5"], "command": "focus_group", "args": { "group": 4 } },
{ "keys": ["ctrl+6"], "command": "focus_group", "args": { "group": 5 } },
{ "keys": ["ctrl+7"], "command": "focus_group", "args": { "group": 6 } },
{ "keys": ["ctrl+8"], "command": "focus_group", "args": { "group": 7 } },
{ "keys": ["ctrl+9"], "command": "focus_group", "args": { "group": 8 } },
{ "keys": ["ctrl+shift+1"], "command": "move_to_group", "args": { "group": 0 } },
{ "keys": ["ctrl+shift+2"], "command": "move_to_group", "args": { "group": 1 } },
{ "keys": ["ctrl+shift+3"], "command": "move_to_group", "args": { "group": 2 } },
{ "keys": ["ctrl+shift+4"], "command": "move_to_group", "args": { "group": 3 } },
{ "keys": ["ctrl+shift+5"], "command": "move_to_group", "args": { "group": 4 } },
{ "keys": ["ctrl+shift+6"], "command": "move_to_group", "args": { "group": 5 } },
{ "keys": ["ctrl+shift+7"], "command": "move_to_group", "args": { "group": 6 } },
{ "keys": ["ctrl+shift+8"], "command": "move_to_group", "args": { "group": 7 } },
{ "keys": ["ctrl+shift+9"], "command": "move_to_group", "args": { "group": 8 } },
{ "keys": ["ctrl+0"], "command": "focus_side_bar" },
// The keys BELOW are for Linux and Windows only.
//
// The OSX keys all use 'super' instead of 'ctrl'.
//
// e.g. In the top command use: ["super+k", "super+up"]
// e.g. In the bottom command use: ["super+k", "super+shift+right"]
{ "keys": ["ctrl+k", "ctrl+up"], "command": "new_pane" },
{ "keys": ["ctrl+k", "ctrl+shift+up"], "command": "new_pane", "args": {"move": false} },
{ "keys": ["ctrl+k", "ctrl+down"], "command": "close_pane" },
{ "keys": ["ctrl+k", "ctrl+left"], "command": "focus_neighboring_group", "args": {"forward": false} },
{ "keys": ["ctrl+k", "ctrl+right"], "command": "focus_neighboring_group" },
{ "keys": ["ctrl+k", "ctrl+shift+left"], "command": "move_to_neighboring_group", "args": {"forward": false} },
{ "keys": ["ctrl+k", "ctrl+shift+right"], "command": "move_to_neighboring_group" },
Hope this helps.
If you mean rearranging the tabs within the same group, there's a good plugin called MoveTab
My keybindings Sublime Text --> Preferences --> Key Bindings (User) -->
{
"keys": ["super+alt+shift+["],
"command": "move_tab",
"args": { "position": "-1" }
},
{
"keys": ["super+alt+shift+]"],
"command": "move_tab",
"args": { "position": "+1" }
}
Allows CMD+Shift+Option+[ and CMD+Shift+Option+]
If you have Package Control you can install via CMD+Shift+P --> Install Package --> MoveTab
import sublime, sublime_plugin
class DualViewMoveTo(sublime_plugin.WindowCommand):
def run(self):
self.window.run_command('set_layout', { "cols": [0.0, 0.5, 1.0], "rows": [0.0, 1.0], "cells": [[0, 0, 1, 1], [1, 0, 2, 1]] })
self.window.run_command('focus_group', { "group": 0 })
self.window.run_command('move_to_group', { "group": 1 })
There's an excellent plugin offered by Sublime Text itself called Origami, it allows you to create new panes(Columns), delete panes, move and clone views(Tabs) from pane to pane. You can easily shift tabs between a split view using this plugin. Also if you just reorder the tabs in a single pane then Sublime Text offers another good plugin called MoveTab.
My problem is that I would like to be able to use a visual selection without being in vintage mode. Here are my key bindings:
[
{ "keys": ["ctrl+k"], "command": "move", "args": {"by": "lines", "forward": false} }
, { "keys": ["ctrl+j"], "command": "move", "args": {"by": "lines", "forward": true} }
, {"keys":["ctrl+h"], "command": "move", "args": {"by": "characters", "forward": false}}
, {"keys":["ctrl+l"], "command": "move", "args": {"by": "characters", "forward": true}}
, {"keys":["ctrl+e"], "command": "move", "args": {"by": "characters", "forward": true}}
,{ "keys": ["ctrl+e"], "command": "move_to", "args": {"to": "eol", "extend": false} }
,{ "keys": ["ctrl+a"], "command": "move_to", "args": {"to": "bol", "extend": false} }
, {"keys": ["ctrl+y"], "command": "copy"}
, {"keys": ["alt+y"], "command": "paste"}
, { "keys": ["ctrl+v"], "command": "enter_visual_mode"}
]
As you can see I have vi-like commands except with ctrl modifier. I want it this way. I would like ctrl+v to enter visual mode. I saw in the Vintage mode default key bindings file, the command was defined like I have it defined. Obviously "enter_visual_mode" is a command defined somewhere else in Vintage mode, but I don't know how to include that into my default editor. If anyone could give some guidance on setting this up it would be appreciated!
You will need to use a plugin to support the behavior you want. I don't know of one that is fully flushed out, but I know this was a start to define different keyboard modes (like visual). Take a look at https://github.com/KonTrax/MultiBind. Untested but add the following to your key binding file should work.
// Toggle "visual" layout
{ "keys": ["ctrl+v"],
"command": "multibind_toggle",
"args" : { "layout": "visual" }
},
// Show current layout in statusbar
{ "keys": ["ctrl+shift+\\"],
"command": "multibind_show",
"args" : { }
},
{ "keys": ["ctrl+k"], "command": "move", "args": {"by": "lines", "forward": false, "extend": true}, "context": [{ "key": "multibind.visual" }]},
{ "keys": ["ctrl+j"], "command": "move", "args": {"by": "lines", "forward": true, "extend": true}, "context": [{ "key": "multibind.visual" }] },
{"keys":["ctrl+h"], "command": "move", "args": {"by": "characters", "forward": false, "extend": true}, "context": [{ "key": "multibind.visual" }]},
{"keys":["ctrl+l"], "command": "move", "args": {"by": "characters", "forward": true, "extend": true}, "context": [{ "key": "multibind.visual" }]},
{"keys":["ctrl+e"], "command": "move", "args": {"by": "characters", "forward": true, "extend": true}, "context": [{ "key": "multibind.visual" }]},
{ "keys": ["ctrl+e"], "command": "move_to", "args": {"to": "eol", "extend": true}, "context": [{ "key": "multibind.visual" }]},
{ "keys": ["ctrl+a"], "command": "move_to", "args": {"to": "bol", "extend": true}, "context": [{ "key": "multibind.visual" }] }
You have ctrl+e defined twice, so I'm not sure which behavior you want.
Is it possible to increase the number of recent projects that appear in the Projects -> Recent Projects menu in Sublime Text 2? I have searched through the settings and I haven't found anything.
Edit this file:
~/Library/Application Support/Sublime Text 2/Packages/Default/Main.sublime-menu
At around line 715 you'll see this:
"caption": "Recent Projects",
"mnemonic": "R",
"children":
[
{ "command": "open_recent_project", "args": {"index": 0 } },
{ "command": "open_recent_project", "args": {"index": 1 } },
{ "command": "open_recent_project", "args": {"index": 2 } },
{ "command": "open_recent_project", "args": {"index": 3 } },
{ "command": "open_recent_project", "args": {"index": 4 } },
{ "command": "open_recent_project", "args": {"index": 5 } },
{ "command": "open_recent_project", "args": {"index": 6 } },
{ "command": "open_recent_project", "args": {"index": 7 } },
{ "command": "open_recent_project", "args": {"index": 8 } },
{ "command": "open_recent_project", "args": {"index": 9 } },
{ "caption": "-" },
{ "command": "clear_recent_projects", "caption": "Clear Items" }
]
Add additional lines of
{ "command": "open_recent_project", "args": {"index": n } },
I.E.
"caption": "Recent Projects",
"mnemonic": "R",
"children":
[
{ "command": "open_recent_project", "args": {"index": 0 } },
{ "command": "open_recent_project", "args": {"index": 1 } },
{ "command": "open_recent_project", "args": {"index": 2 } },
{ "command": "open_recent_project", "args": {"index": 3 } },
{ "command": "open_recent_project", "args": {"index": 4 } },
{ "command": "open_recent_project", "args": {"index": 5 } },
{ "command": "open_recent_project", "args": {"index": 6 } },
{ "command": "open_recent_project", "args": {"index": 7 } },
{ "command": "open_recent_project", "args": {"index": 8 } },
{ "command": "open_recent_project", "args": {"index": 9 } },
{ "command": "open_recent_project", "args": {"index": 10 } },
{ "caption": "-" },
{ "command": "clear_recent_projects", "caption": "Clear Items" }
]
Now you have 11 recent projects
For sublime text 3 I would recommend (based on https://stackoverflow.com/a/34512015/3061838) to add a new file Main.sublime-menu to your %APPDATA%\Sublime Text 3\Packages\User folder with the following content
[
{
"caption": "Project",
"id": "project",
"mnemonic": "P",
"children":
[
{
"caption": "Open Recent More",
"children":
[
{ "command": "open_recent_project_or_workspace", "args": {"index": 0 } },
{ "command": "open_recent_project_or_workspace", "args": {"index": 1 } },
{ "command": "open_recent_project_or_workspace", "args": {"index": 2 } },
{ "command": "open_recent_project_or_workspace", "args": {"index": 3 } },
{ "command": "open_recent_project_or_workspace", "args": {"index": 4 } },
{ "command": "open_recent_project_or_workspace", "args": {"index": 5 } },
{ "command": "open_recent_project_or_workspace", "args": {"index": 6 } },
{ "command": "open_recent_project_or_workspace", "args": {"index": 7 } },
{ "command": "open_recent_project_or_workspace", "args": {"index": 8 } },
{ "command": "open_recent_project_or_workspace", "args": {"index": 9 } },
{ "command": "open_recent_project_or_workspace", "args": {"index": 10 } },
{ "command": "open_recent_project_or_workspace", "args": {"index": 11 } },
{ "command": "open_recent_project_or_workspace", "args": {"index": 12 } },
{ "command": "open_recent_project_or_workspace", "args": {"index": 13 } },
{ "command": "open_recent_project_or_workspace", "args": {"index": 14 } },
{ "command": "open_recent_project_or_workspace", "args": {"index": 15 } },
{ "caption": "-" },
{ "command": "clear_recent_projects_and_workspaces", "caption": "Clear Items" }
]
},
]
},]
The advantage of this solution is that it will survive Sublime Text updates. The disadvantage is that you will have 2 open-recent menus.
You may choose to remove the lines with index 0-7 since they are present in the original menu.