Is there any way to remove the mark from gutter. You can set mark with command/shortcut "keys": ["ctrl+k", "ctrl+space"], "command": "set_mark", but I cant find command to remove it. Is there any way to remove it.
Clearing the mark is available from the Edit menu -> Mark -> Clear Mark, which executes:
command: clear_bookmarks {"name": "mark"}
(as can be seen with sublime.log_commands() in the ST console, or by viewing the main menu file in the Default package)
This is bound to Ctrl+K Ctrl+G by default.
Related
Is there any way to exclude folded code from search. When I search for text and that text appears to be in folded part of the code Sublime always unfolds that code snippet and its annoying. I could not find any settings regarding it.
You can make use of Sublime Text's "Find In Selection" feature - select all the unfolded regions, then open the find panel and perform your search with "in selection" toggled on.
Here is a plugin to do this:
import sublime
import sublime_plugin
class FindInUnfoldedTextCommand(sublime_plugin.TextCommand):
def run(self, edit):
folded_regions = self.view.folded_regions()
self.view.sel().clear()
self.view.sel().add_all(folded_regions)
self.view.run_command('invert_selection')
self.view.window().run_command('show_panel', { "panel": "find", "reverse": False, "in_selection": True })
To set this up:
from the Tools menu -> Developer -> New Plugin...
select the template plugin code and replace it with the above
save it, in the folder ST recommends (Packages/User/) with a name like find_in_unfolded_text.py - the filename isn't important, just the extension is.
Open the ST console (View menu -> Show Console)
Type/paste view.run_command('find_in_unfolded_text') Enter
Enter your search string
Violia! The folded text is ignored.
As an alternative to steps 4 and 5, you can add this new command to the menu, to the command palette, or create a keybinding for it.
whenever I select code and then do Cmd + c (copy) it then goes by itself to normal mode in vim. So:
How do I stop VS code from doing that?
Why is it doing that?
My default keybinding for copy paste has (go to command pellet type keybinding go to default keybindings):
{ "key": "cmd+c", "command": "execCopy" },
probably this: { "key": "cmd+c", "command": "extension.vim_cmd+c",
"when": "editorTextFocus && vim.active && vim.overrideCopy && vim.use<D-c> && !inDebugRepl" }, except it doesn't let me edit the file!?!?!
I feel the answers are longer than need.
Follow these steps:
Command palette Cmd+shift+P
Type Open Keyboard Shortcuts (not the Json one)
Nice looking file in vscode comes up like pinocchio said (see attached image)
Search cmd+c
Go the the row that has in it's column extension.vim_cmd+c
Click it and then hit backspace (or right click select remove).
Done.
For sake of context see Snippet:
without seeing your exact extension configuration and system info, it's hard to say with certainty, but you may have an extension conflicting with or overriding the default behavior.
open the command palette and type keybindings and choose the command to edit keybindings. you can search for cmd+c to see if anything else is using it, and in what context. alternatively, you can do this directly from your keybindings.json file.
also, for the sake of diagnostic, you can always launch vs code with no extensions enabled just to see if it is indeed an extension problem. if so, you can selectively enable extensions, and when you find the right one, you can look within its internal settings
As Tedskovsky suggested, go to the json file that has the keybinding. Find the last one that maps cmd+c to something. Then remove it. Though, that file can only be opened in read mode so you will need open:
Preferences: Open Keyboard Shortcuts `Cmd+K Cmd+S`
NOT THE JSON ONE (at least not in vscode):
So the first one (not the second one).
That opens a nice looking window that allows you to edit the keyboard settings. Probably the last one in that list I assume. I went to the uneditable one and found the last one and removed it (and yes as Tedskovsky suggested, it was added by the vim extension).
The name of it was:
{ "key": "cmd+c", "command": "extension.vim_cmd+c", "when": "editorTextFocus && vim.active && vim.overrideCopy && vim.use<D-c> && !inDebugRepl" },
search is somewhere in your default editable file to remove it (click and select remove).
Don't select the json file for the keyboard bindings if you want to change it.
Go to settings.json and add this:
"vim.handleKeys":{
"<C-c>": false
}
I can see opened files in 1st group (created via split editor) using command "show editors in first group", in 2nd group "show editors in second group" and I can also see all opened files including all groups "show all editors".
Bu, how to see the files opened only in the currently focused group?
VS Code has added this now. Go to File-->Preferences-->Keyboard Shortcuts.
2. Scroll down PAST the keys that have assignments to the unassigned keys. It's under "Show Editors in Active Group"
3. Since it has no assignment, click on the '+' symbol to give it an assignment.
The existed answer https://stackoverflow.com/a/53537818/7860292 is right.
And it is also okay to directly type edt active in the FilePicker ~
And shortcut configs like following would be easy to toggle in active group or in all groups:
{
"key": "ctrl+oem_period",
"command": "workbench.action.quickOpen"
},
{
"key": "ctrl+oem_period",
"command": "workbench.action.showEditorsInActiveGroup",
"when": "inFilesPicker && inQuickOpen",
},
However, I do not find anything like show editors in first group as said in question, are those deprecated ? ...
Going to Tools > New Snippet everytime I need to create a new Sublime Snippet is starting to become cumbersome. Is there a way to create a shortcut in which I can jump to the new snippet page by pressing Command + i?
Preferences -> Key Bindings - User, then add the below line:
{ "keys": ["ctrl+g"], "command": "new_snippet" }
You can replace the ctrl+g combination with anything of course.
BUT be aware: it might happen that the keyboard layout doesn't send the exact keys that the command is bound to.
To investigate this open the console at View -> Show Console or with CTRL+, and type sublime.log_input(True). Now click in the document and give your key combination a try - if the appropriate output doesn't appear in the console, you better specify another combination.
Finally, if sublime.log_input(True) bothers your coding or debugging process, you can easily disable it by clicking again in the console and using the UP arrow to get the command you typed the last type, change True to False, then hit Enter.
open the command palette, find a item named "Preferences: Key Bindings - User", open it and add this:
{ "keys": ["ctrl+y"], "command": "show_overlay", "args": {"overlay": "command_palette", "text": "Snippet: "}}
You can change the "ctrl+y" for anything you like to be the shortcut.
I'm happy with the indentation defaults, but sometimes I want to paste text that preserves the tabs and I don't want to grab the mouse, go to the lower corner, uncheck Indent Using Spaces, paste the text, and check Indent Using Spaces again.
Is there a way to do this from the command menu (cmd+shift+p) or by using an extension?
What about defining a keyboard shortcut to toggle the translate_tabs_to_spaces setting?
Untested, but the stock keyboard binding file has this, which you copy and modify to your preferences in Sublime Text -> Preferences -> Key Bindings - User:
{"keys": ["f7"], "command": "toggle_setting", "args": {"setting": "translate_tabs_to_spaces"} },