Use hard tabs instead of spaces in BlueJ - tabs

In BlueJ, if a file is using hard tabs BlueJ will automatically convert the entire file to use spaces instead of hard tabs. I'm looking for a way to tell BlueJ not to convert hard tabs into spaces.

According to Replacing Tabs with Spaces (posted by Michael Kölling, developer of BlueJ), tabs are converted to spaces under the default settings the first time you enter a tab.
If your preference is set to use spaces (i.e. the TAB key is bound to
the 'indent' function, not to the 'insert-tab' function) -- this is the
default -- then the first hit of a TAB key in a newly opened file will
replace all TABs in that file with spaces.
In other words, if you get a file that contains TABs, editing this file
with the BlueJ standard settings should remove TABs from that file. (I
did not want to change the TABs on file-open, because I did not like
the idea of the file changing on disc if you do not actively edit it.)
To change this setting so that you can enter an actual TAB character, go to Options > Key Bindings, then select Edit Functions from the Categories drop down list. There are two changes you'll have to make.
Scroll down to indent. By default it should be set to the Tab key. This setting is what's inserting soft spaces by default. Click on Tab under Key Bindings, then click the 'Delete Key' button.
Scroll down to insert-tab. Delete the existing key binding and add the Tab key here so that pressing that key will insert a TAB character.
Here's what the screen looks like with the default settings.
There you can see that the Tab key is set to the 'indent' function, which inserts soft spaces. Making the changes above will prevent that from happening.

Related

Return key is not handled in cell editor

I'm studying mxGraph examples and have the following problem. When I double-click a cell and edit in-place its content, I assume that pressing Return key should end editing and set the cell's content to the newly typed. But instead pressing the Return key works as usually in editors: it moves the caret to the new line.
Why I assume that Return should stop editing? Because comments say so (e.g. in userobject.html):
// Stops editing on enter key, handles escape
new mxKeyHandler(graph);
And also because there would be no convenient way to end cell editing apart from clicking with the mouse somewhere outside the cell. (By the way, Escape key is handled OK: it also ends editing, but without updating the cell content.)
This behaviour is observed in all browsers I tried: Firefox 60 on Linux, Firefox 52 and IE 11 on Windows.
Why this problem exist and how can it be solved?
Have you tried graph.enterStopsCellEditing = true? See https://jgraph.github.io/mxgraph/docs/js-api/files/view/mxGraph-js.html#mxGraph.enterStopsCellEditing

Sublime Text 3 - Hitting tab doesn't add space, instead makes text lower case

If I were to type the following:
TEST
Then hit TAB, the code would now look like this:
test
I don't know what happened, but tab is not indenting anymore and changes the text on the current line to lowercase.
Any idea how to restore the TAB function?
One possible reason for this in the general case is that you have installed a third party package that's stolen the Tab key binding in order to perform it's own action, which in this case would be turning the prior word lower case.
This will be the case if this behaviour holds true for any word that you happen to press Tab after. In that case the solution would be to find the package that's doing this and disable or reconfigure it.
In your case I think the more likely cause for this is that in the file you're currently editing the word TEST appears, and you have the following setting turned on:
// When enabled, pressing tab will insert the best matching completion.
// When disabled, tab will only trigger snippets or insert a tab.
// Shift+tab can be used to insert an explicit tab when tab_completion is
// enabled.
"tab_completion": true,
When the setting is set to true (which is the default), pressing Tab will attempt to perform a tab completion, which considers not only snippets and completions but also words in the current buffer as well.
In that case, if you were to enter the word test and press Tab at a point where the word TEST also appears in the buffer, it's considered a potential completion and will become the replacement.
If this is the problem you would see similar behaviour by just entering t and pressing Tab, which would cycle through all of the T words in the buffer as possible completions.
Assuming this is what's happening to you, one of the following should fix the problem for you:
Set tab_completion to false in your preferences; this will disable the feature entirely everywhere
Set tab_completion to false only in the settings of the specific file type that you're having the problem in; that would leave the feature enabled in the general case but stop it from occurring in the files that you don't want it to occur in.
Use Shift+Tab instead; that key sequence will do what Tab normally does and insert a tab character even if Tab would try to do a completion.
For #3 to work, make sure that you have this setting set as follows:
// By default, shift+tab will only unindent if the selection spans
// multiple lines. When pressing shift+tab at other times, it'll insert a
// tab character - this allows tabs to be inserted when tab_completion is
// enabled. Set this to true to make shift+tab always unindent, instead of
// inserting tabs.
"shift_tab_unindent": false,
The default for this value is false, in which case as the comment mentions the binding will perform a tab unless you have multiple lines selected in which case it unindents instead.

When I create a new class="" the cursor starts outside the quotes in PhpStorm. How can I get it to go between the quotes so I can continue typing?

When I type in class="" it autofills and puts the cursor after the closing quote.
This means I need to delete a quote to enter the class name or click between them. Both of which ruin my workflow.
Is there a way to put the cursor inbetween the quotes in settings? And if there is, is there a way to jump out of the quotes and keep adding to my markup?
In Sublime Text it puts the cursor in the class and then tab takes you outside of it. I'm sure PhpStorm can do the same.
Instead of typing the whole class="" thing by yourself -- just let IDE autocompletion to do the job for you.
Just two characters (cl) is enough to make class entry first in the list (unless you have used some other similarly named attributes/properties recently that would temporarily bring them higher than class):
Completing with Enter will have the text inserted into current position with caret located in the right place class="[CARET_HERE]".
Completing with Tab does the same but replaces the text that is currently under caret (useful when changing class/image name/function/etc completely).
If standard code completion is not good enough for some reason or you do not like automatic completion popop (and prefer invoking it manually only when needed) -- you will be interested in Live Templates functionality that allows creating some abbreviation and expanding it into the final snippet with minimal key presses (e.g. cl[Tab] into class="|")
IDE also has options to:
insert quotes ("" or '') after typing = in XML/HTML attributes.
Settings/Preferences | Editor | General | Smart Keys --> Add quotes for attribute value on typing '=' and attribute completion
insert pair quotes (closing one) when entering opening one -- works in different contexts/languages. It will "eat" the closing quote preventing you from typing too many.
Settings/Preferences | Editor | General | Smart Keys --> Insert pair quote
In Sublime Text it puts the cursor in the class and then tab takes you outside of it. I'm sure PhpStorm can do the same.
If I understood you correctly (sorry, never used Sublime myself) -- No... and may not have it for quite some time (devs say that the way how IDE works somehow conflicts with proposed Tab or Esc behaviour).
Better explanation/arguments from both sides can be found in actual ticket: https://youtrack.jetbrains.com/issue/IDEABKL-6984

How do I prevent Sublime Text 3 from auto-indenting a line as a one off

When I'm editing HTML or CSS in Sublime Text 3 the lines auto-indent when I hit the [ENTER] key, which generally is very useful.
On occasion I find myself wanting to paste a line of markup which is already indented, and this results in double indentation.
Is there some other key combination along with the [ENTER] key that prevents the next line from auto-indenting and instead returns the curson to the very beginning of the line? Please note I don't want to turn off auto-indent on a global basis.
You can do it in various steps, using various keybindings, so you can simply record a macro and do it in one simple custom keybinding (tools > record macro).
Steps:
Press [Enter] to move to a new line.
Press [shift+home] to select until the beginning of line (spaces or tabs used to indent).
Press [backspace] to remove the selected indentation charaters
You're done. Stop recording and save the macro, then use a custom keybinding to do it in a single step.
I found in Windows that CTRL + SHIFT + V (rather than just CTRL + V) does a "paste and indent" whereby the indentation is corrected as necessary.
It's also possible to switch the default paste for paste as indent as per these instructions: https://gist.github.com/twosixcode/1988097

Option highlighting all strings matching actual selection in PhpStorm?

Is there an option highlighting all strings matching the actual selection in PhpStorm (like in SublimeText) ?
You can use Ctrl + Shift + F7 for this in PhpStorm.
This will highlight all usages of selected text.
Using built-in functionality: select text and hit Ctrl + F that will bring "Find in page" functionality: it will highlight all matches of selected text in this document. But it's not always convenient as you have to hit extra keys and have "find in page" bar open...
You can install and use BrowseWordAtCaret plugin that will automatically highlight word under caret in whole document (regardless of it's nature -- variable or just plain text) + you can easily navigate between all matches.
P.S.
You have mentioned that "I'm used to regularly change the name of an object property, an array key or a parameter name at multiple places in same document."
Consider using Refactor | Rename for variables/class members/etc -- it works across multiple files.