How to remove tab indent from several lines in IDLE? - indentation

If you want to indent several lines in Python IDLE you just mark the lines and hit Tab. But what if you want to remove the indent from several lines? Shift+Tab does not work for that in IDLE.

If you're using IDLE, you can use Ctrl+] to indent and Ctrl+[ to unindent.

If you're using IDLE, and the Norwegian keyboard makes Ctrl-[ a problem, you can change the key.
Go Options->Configure IDLE.
Click the Keys tab.
If necessary, click Save as New Custom Key Set.
With your custom key set, find "dedent-region" in the list.
Click Get New Keys for Selection.
etc
I tried putting in shift-Tab and that worked nicely.

Depends on your editor.
Have you tried Shift+Tab?

in pythonwin,
SHIFT + TAB works

For IDLE, select the lines, then open the "Format" menu. (Between "Edit" and "Run" if you're having trouble finding it.) This will also give you the keyboard shortcut, for me it turned out that dedent shortcut was "Ctrl+["

Shift-Tab
Ctrl-Tab
< key
depends on your editor.

In Jupyter Notebook,
SHIFT+ TAB(to move left) and TAB(to move right) movement is perfectly working.

By default, IDLE has it on Shift-Left Bracket. However, if you want, you can customise it to be Shift-Tab by clicking Options --> Configure IDLE --> Keys --> Use a Custom Key Set --> dedent-region --> Get New Keys for Selection
Then you can choose whatever combination you want. (Don't forget to click apply otherwise all the settings would not get affected.)

Related

How to get spaces instead of tabs in eclipse

After doing a little research, I found out that eclipse hides its settings in multiple levels. So, I think, I got all the levels covered here.
Here I have set eclipse to insert spaces instead of tabs. And eclipse even acknowledges there that I have indeed set it up to insert 4 spaces instead of a tab (See the text under Tabulators: it says, "The current indentation size is 4, using spaces").
Then for the general text editor, I have also set it up to insert spaces instead of the tabs.
And eclipse couldn't have gotten things more wrong even if it had tried!
Unfortunately, despite all those settings, when I press tab, eclipse inserts 2 spaces. Then, I press tab again, and it inserts 2 spaces. Why 2 spaces? Are there still more hidden settings somewhere?
Anyways, this broken system works a bit, until I have one level more of indentation, for example, for a for-loop or an if-block. If I press, tab again, instead of adding 2 more spaces, it converts the 6 spaces into a tab.
And a tab which is not even 4 spaces wide, but instead a tab which looks like a 6- or 8-spaces wide tab.
Ctrl + I also adds tabs, not spaces.
The formatter is also setup as #Neuron suggested in his answer.
So, where else is eclipse hiding more settings?
I fixed it by going to..
Window ⟶ Preferences ⟶ C/C++ ⟶ Code Style ⟶ Formatter
There you need to edit the currently set profile. Click "Edit..." (top right-ish). Now go to Indentation (already open) ⟶ General Settings ⟶ Tab Policy and change this from "Tabs only" to "Spaces only".
If you still have the default profile, give your profile a new name.
Why is this so weird and convoluted? I don't know.

How to turn on indent structure lines in VS2017?

I accidently turned them off somehow. But I cannot find a hotkey or setting to turn them on again.
It's in Tools + Options, Text Editor, last checkbox.

How can I put QTableWidgetItem into edit mode?

I am taking an existing UI component that we have based on QTableWidget and placing two of them inside QTabWidget pages. I want to allow the user to enter data into the table in the first tab and then when they press a button to move to the second tab and have the first cell in edit mode.
I am using the editItem method of QTableWidget to edit a given QTableWidgetItem. The trouble is that something is occurring to stop the edit (or maybe it never starts in the first place).
If I call editItem a second time then it fails, but if I click on the cell then it will enter the edit mode with the cell highlighted and the cursor blinking. I was just wondering if there is a way to do this programmatically that I may have missed?
One option would be to simulate a tab key press and then shift-tab but I have not been able to do this. I can simulate the tab but if I try to add the shift modifier then it jut produces a normal tab.
This is my tab code that works:
QApplication::postEvent(tableWidget, new QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier));
This is my shift-tab code that doesn't work:
QApplication::postEvent(tableWidget, new QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier));
Any suggestions would be appreciated.
It looks like shift-tab is actually reported as Qt::Key_Backtab rather than Qt::Key_Tab with the shift modifier as I had expected...
I think this will do the job for us but would welcome any better solutions.

Visual Studio go to bookmark only inside current file

Is it possible to go to the next/prev bookmark only inside the current file? I'm using VS 2010 and I find it extremly annoying that it jumps always across all files when I want to navigate inside the current file only.
Yes. Go to "customize" (right click on the toolbox area, choose customize) ->commands->keyboard, choose edit.NextBookmarkInDocument and associate it with a shortcut.
In addition, you can add it as a button in the text editor toolbar. Go to to text editor toolbar, press the little mark on the bottom-right,and choose the appropriate button to add.
Set bookmarks to stay in one file in Visual Studio 2019
In the Search box at the very top menu, put in ‘customize’ and hit Enter’.
A complex box comes up, but I simply clicked on a button at the bottom labelled ‘Keyboard’, which is where keyboard shortcuts can be set up.
That brings up another huge box. In the left hand pane is Environment and under that is Keyboard. I guess that the way I went in is why this was expanded and already selected, so there must be other ways to get to the same place.
In a right hand pane is now a huge list of commands that can have shortcuts attached!
The ones to scroll to (enlarge the box or the scroll bar is a joke. A slight move scrolls dozens of lines!) are Edit.NextBookmarkInDocument and Edit.PreviousBookmarkInDocument. (similar commands without ‘inDocument on the end are what f2/ shift f2 do by default and jumps between files rather than staying in the same document.)
When you select a command you can then just click on the field labelled ‘Press shortcut keys’ and then press the keys you want to be the shortcut for that command.
I assigned Edit.NextBookmarkInDocument to f2, which then replaces the old f2 that jumps from file to file, and shift f2 for Edit.PreviousBookmarkInDocument. You have to press the ‘Assign’ button to make VS remember the change. After this, bookmark jumps stay in the same file. I guess you could choose any shortcut you fancy, and it does at least show you if that shortcut is assigned and what it is assigned to.
There are some features which I have not explored, like when I use f2 it shows it is assigned to ‘Rename’ but it seems to not effect that function at all when you reassign and just takes it away from the jump between files command version. Maybe someone would like to delve deeper, but what I did worked without any side effects and renames outside of VS still worked with f2 so I have no idea what it was going on about.

Tab and Enter key do not work anymore in the webstorm editor while typing

Ever since I upgraded my webstorm IDE to v8.0.4 the enter/return and tab key has no effect in the code editor.
Could there maybe any settings I have somehow changed that these keys does not work?
I have just found out that this odd behavior is only in the main index.html file not in my partial html files ???!!!
I had the same problem in one particular project, and other keystrokes also didn't work, including "(".
Selecting File > Invalidate Caches / Restart fixed it.
For me it wasn't invalidating caches or removing plugins. There is actually an "editor action" in the keymap settings called "Enter". Apparently I removed the key (enter) mapped to that by accident.
Just experienced the same issue but clearing the Invalidate Cache wasn't working for me.
I found that I had downloaded "Bootstrap 3 live templates/ snippets" plugin just prior. This for some reason rendered by editor unable to take enter/return keys as well as the tab key.
After removing the plugin the editor went back to working normally. I would suggest going over recently downloaded plugins and seeing if one of them might be causing the issues.
For anyone else struggling to figure out why this is happening, this happened to me on my MacBook pro due to having the ABC Keyboard configured in System Preferences > Keyboard instead of ABC Extended
In my case, Enabling ECMAScript 6 was the problem, I simply choose ECMAScript 5.1 again and everything now is working as it should!
change it from File->Settings->Languages & Frameworks->JavaScript and change the JavaScript language version to ECMAScript 5.1
Still very weird bug though
you have to map "Enter" to "Enter"!
setting > keymap >
search for enter
in "Editor Actions" right click on Enter and select Add key shortcut
press enter key
press ok and exit settings.
In the latest version of Tabnine on WebStorm or PhpStorm:
Find the keymap "Accept Inline Completion" and remove Tab
Invalidate Cache didnt work for me as well. To be precise, the issue is related to newly added plugin. Fixed this issue by removing the plugin that is added recently.
I had the same problem. It is a, plugin issue. The quickest solution is, after starting Webstorm, press the return key. The PluginException will appear in the bottom of the IDE. Click it and you will see the 'disable' option for that specific plugin.
Regards
Same thing happened to me. I had to check the Event Log which gave me the option to disable the plugin.