When using PyCharm tab only indents the line if I select it first. This is not the same with VSCode which adds an indent of, I think, 4 spaces each time I press the tab key. I believe this is a bug but I have tried everything I have found and nothing seems to work.
Things I have tried:
None of these have fixed the issue
It is not a bug, as the default behaviour is common on editors (also way before VS). It is not uncommon to make tables (e.g. on C header files, defining constants). VS took a different way. Note: in PyCharm (at least with KDE key bindings), if you select one or more lines, then Tab (and Shift-Tab) will indent/unindent the code.
But you can reproduce your desired behaviour: Go on settings/preferences, then Keymap menu. I recommend you to save current settings, and start a new custom setting (e.g. adding "Tab" to the name).
Then on the right of the right/bottom search field, look for actions with a key: press it, then press Tab. You see that there is an action "Tab", which links to Tab
. Right click, and remove the key. We need this, not to conflict with the new behaviour of Tab
(only this matter, we keep the other Tab
).
Now we should give Tab
the desired behaviour: On Keymap -> Editor Actions -> Indent Line or Selection (note: you can just look "Indent Line"). Here you select your new key to be Tab (you should press the +
for such special keys).
Now the settings seems similar to VS. I'm not using it much, so e.v. you should tweak other settings. Note, on my KDE keybindings, Shift+Tab is already set as Unindent
.