When I highlight a block of code in Sublime Text 3 and press the Tab key, it doesn't indent the whole block like it used to. Instead, it deletes the highlighted code.
Anybody know how to fix this?
When I highlight a block of code in Sublime Text 3 and press the Tab key, it doesn't indent the whole block like it used to. Instead, it deletes the highlighted code.
Anybody know how to fix this?
I have found that this happens when I've missed the "purchase this software" dialogue and have not dismissed it.
Alt-tab (or Cmd-tab on Mac) to check if there is a dialog window waiting for a response and dismiss it. This will resolve the issue.
As others have mentioned restarting Sublime will also resolve this issue because it is essentially dismissing the dialogue.
For anyone else who comes here from google, read this first:
SublimeText 2 (works for 3 as well) suddenly started doing this to me today without changing any settings. All I had to do was restart the program and it fixed itself.
This is the default behavior for Sublime Text. If you select multiple lines it will indent but if you select single line (selection does not contain a \n
), it will run insert_best_completion
command and delete the selection.
In your user .sublime-keymap
add the following:
{ "keys": ["tab"], "command": "indent", "context":
[
{ "key": "text", "operator": "regex_contains", "operand": "." }
]
},
This will make your tab key always indent. Not sure if it will conflict with auto-completion if you have it set up on Tab key.
Same goes for unindenting with shift+tab:
{ "keys": ["shift+tab"], "command": "unindent", "context":
[
{ "key": "text", "operator": "regex_contains", "operand": "." }
]
},
Similar to the answer by Dom above, it also happens when the upgrade message for sublime appears and is not in focus. I've also found that if you open Sublime enable another monitor then the upgrade message appears off screen too.
The only fix seems to be restarting sublime. This also re-centers the dialog box.
This was happening to me too, and it was due to the fact that my selected text appeared to be a block, but was actually a single line of wrapped text. By default ST3 will replace a single selected line with a tab
character.
For me, it's more convenient to un/indent selections, whether they are multiple lines or not, so I added the following to my User-specific sublime-keymap file.
{ "keys": ["tab"], "command": "indent", "context":
[
{ "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true },
]
}
I figured out the issue when I click "tab" and check status bar in the bottom which should tell you why it happens.
After I found the related package, I just
It works well now.
same thing happened to me. Just go to preferences->key bindings then in the user (right) keybindings add this:
[
{ "keys": ["tab"], "command": "indent" },
{ "keys": ["shift+tab"], "command": "unindent" },
]
Then restart sublime and it should work fine!
Note: this does break the tab completing things but copying the tab defaults will fix this. Also if you use enter it works fine as well. Good luck!
You can check below points that can cause this issue
It's because of the "Do you want to purchase/update" popup/alert window. Click on sublim text in your OS task bar if you don't see it then close it. Other frequent issue with that : scroll disabled.