NO-BREAK SPACE after quick auto-complete double brace PhpStorm - laravel

In Laravel's Blade Template, the use of double braces {{ }} is used quite a lot.
I have a small issue though. PhpStorm will auto complete {{ to the full {{}}
However, as most Laravel developers adds spaces like {{ route('home') }}, I quickly type {{ then add a space.
Normall this would add unicode spaces like %20 on each side of the cursor after auto completion {{ CURSOR }}
However, if I do it too quick, it adds the %A0 (NO-BREAK-SPACE) character instead and does not add the trailing space, causing the statements inside to fail. {{ CURSOR}}
Is there a way, to either fix this permanently - or to default the auto completion of double braces to add the spaces before and after the cursor by default, like it does when typing {! (this might be a plugin)
Edit:
I figured out that my keyboard (Norwegian) has a slight issue with phpstorm perhaps. I use Alt Gr+7 to write a open brace. If I do it too quick, Alt Gr + Space produces a no-break space. I'm trying to figure out now how to either disable that keybind or some other way of ignoring it.
Edit2
It was Ubuntu, see my answer

It appears this was not an issue in PhpStorm at all.
It was an issue with my Norwegian keyboards, Alt Gr + Space and Ubuntu
In ubuntu Alt Gr + Space produces the non-break space character
I disabled this keybind by typing this into my terminal:
setxkbmap -option "nbsp:none"

Related

Automatic close quotes on Xcode

Is there any way to have a second double quotes placed automatically, when I enter the first one in Xcode? There aren't any settings in Xcode regarding placing a second double quote automatically when entering the first one (like in VSCode eg).
Let the autocompletion work.
i.e.Type print then autocomplete to print(items: Any...) then press "
or ^"
take a look at this https://developer.apple.com/library/content/documentation/IDEs/Conceptual/xcode_help-command_shortcuts/TextCmdsByType/TextCmdsByType.html

Autoclose single and double quotes vscode

My vscode does not automatically close the single and double quotes. I've disabled all extensions, but the problem still persists.
vscodeVersion 1.15.0 (1.15.0)
MAC osx: Version 10.12.6 (16G29)
It's worth noting that vscode has a separate editor setting for auto closing quotes from that of brackets. If you have: "editor.autoClosingQuotes": "never" in your settings, then vscode will never close quotes. On the other hand, if you have "editor.autoClosingQuotes": "always", then it will always add the extra closing quote.
Change your keyboard language to US only instead of US International.
FYI: this is a bug/feature, in that the double quotes auto-close when the cursor has nothing to the right of it. However, when there is something to the right of the cursor, then your only get one quote.
<h1 className="|> <== the closing > on the h1 tag prevents the auto-close.
<h1 className="|" > <== the space to the right allows auto-close to work.
I had a similar issue and came across this link that describes it.

Is there an auto-close curly brackets plugin for the Geany IDE?

Geany is the closest thing I can find to the perfect web development IDE. However, I can't find a way to automatically close curly brackets ({).
For example, typing:
function test()
{
..and pressing RETURN should cause this to happen:
function test()
{
// cursor ends up here (indented by 1 tab)
}
Is there anything that can make Geany do that?
This is a native feature of Geany,
Go to Preferences, then Completions, down there you can choose which one you want to auto close.
Check here for screenshots
You make something else:
If you want, open https://plugins.geany.org/autoclose.html and see "autoclose" plugin. You can install with :
sudo apt-get install geany-plugins-autoclose
and It is all
That isn't full answer to your question, but may be helpful.
I have Geany not in english, I make translations of menu's fields on my own.
Geany has a feature: when you type special text and press Tab, the text is going to be replaced with another text.
It works by default for if, else, for, while, do, switch and try.
Configuration of this feature is in [Tools]/[Config files]/[snippets.conf].
After doing some changes, save file and click [Tools]/[Reload configuration].
I added two lines to section C++:
class=class %cursor%%block%;\n
struct=struct %cursor%%block%;\n
With block=\s{\n\t%cursor%\n}
It doesn't let you press { Enter or { Tab to get
{
//cursor
}
because {=anything is ignored, I don't know why.
What you can do? You can have some another text, replaced using {\n\t%cursor%\n}, or define keybinding inserting it.
Geany can have user defined snippets. It is possible to open snippet configuration file from menu.
Tools ->
Configuration files ->
snippets.conf
Go to the language block where you want to add that feature.
For example:
[C]
if=if (%cursor%)%block_cursor%
else=else%block_cursor%
for=for (i = 0; i < %cursor%; i++)%block_cursor%
while=while (%cursor%)%block_cursor%
do=do\n{\n\t%cursor%\n} while (%cursor%)\n%cursor%
switch=switch (%cursor%)%brace_open%case %cursor%:\n\t\t%cursor%\n\t\tbreak;\n\tdefault:\n\t\t%cursor%\n%brace_close%%cursor%
At first it can be thought that the problem can be fixed just with adding this line
{=%\n{\n\t%cursor%\n}%
But Geany does not accept that when snippet is one non alphabetic character.
It will work for any other alphabetic character like this
b=%\n{\n\t%cursor%\n}% or bl=%\n{\n\t%cursor%\n}%
However I dont think it is what you want. The real solution you can find from geanys menu.
Edit
->Preferences
->Editor
->Completions
Tick the Auto-close quotes and brackets then click on apply and save
The Auto-close doesn't work if we place brackets inside another pair of brackets. For example, the inner bracket doesn't auto-close.{{|}
However, we can use the following snippet to create a block.
{={\n\t%cursor%\n}
But in order to use this snippet, we first have to include '{' char in our wordchars set by changing the below line in snippets.conf file.
wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789{

.vimrc to behave like Textmate?

I am making the switch to VIM from Textmate and I wanted to know what should be included in my .vimrc to get the similar behavior for:
auto-close on brackets, paranthesis, etc.
auto tabbing after a bracket
when i open a bracket and select enter, the open bracket is on 1st line, the cursor on the 2nd line indented, and the closing bracket on the 3rd line
pressing <tab> on for will generate a common 'for' use
Thanks.
The first thing to be aware is that you can't turn Vim into TextMate. The second, is that you shouldn't even try.
Instead, focus your efforts on learning Vim, progressively, and grow/shrink your collection of settings and plugins as you need. Using Janus or some other "distro" will only occult Vim behind other people's arbitrary choices.
That said,
"auto-close on brackets, paranthesis, etc."
can be done in a "dumb" way by adding this line to your ~/.vimrc:
inoremap ( ()<Left>
inoremap is for mapping in insert mode (note the i)
( is the key you want to press, that's your trigger
()<Left> means input a pair of parenthesis then go back one character, between the parenthesis
If you need a "smarter" way, there are a many plugins to choose from.
You might want to try surround which was in and of itself a very compelling reason for me to switch from TextMate.
"when i open a bracket and select enter, the open bracket is on 1st line, the cursor on the 2nd line indented, and the closing bracket on the 3rd line"
can be done in many ways as well, for example:
inoremap <C-Return> <CR><CR><C-o>k<Tab>
inoremap, again
<C-Return> means Ctrl+Return, that's your trigger
<CR><CR> means 2 carriage returns to push the closing bracket 2 lines below
<C-o> to leave insert mode only for one command
k to go up one line
<Tab> to put the insertion cursor at the right place
Mappings in Vim can be just that: shortcuts for sequences of keypresses or more serious scripts.
"pressing <Tab> on for will generate a common 'for' use"
can be done with a dedicated plugin like SnipMate. There are others.
auto-close on brackets, paranthesis, etc.
There are a number of plugins for this functionality: autoclose, closepairs, simplepairs
auto tabbing after a bracket
By this, I believe you mean automatic indentation. This is a default Vim behavior when you're working on a supported filetype. If you're just starting on a file and haven't saved it, you can manually set the filetype with :set ft=<whatever filetype you want> and you'll get indentation and syntax highlighting.
when i open a bracket and select enter, the open bracket is on 1st line, the cursor on the 2nd line indented, and the closing bracket on the 3rd line
This will be taken care of with the above auto-close plugins.
pressing tab on for will generate a common 'for' use
These are called "snippets" in TextMate. Snipmate is a commonly used Vim plugin for snippets. Other people prefer xptemplate.
If you're moving from TextMate to Vim, I would try installing Janus and thoroughly reading the documentation.
Janus is a great starter distribution of plugins and mappings for Vim, gVim, and MacVim. It features sane defaults and aims to provide a minimal working environment using the most popular plug-ins and the most common mappings. It was developed and is maintained by Carl Lerche and former TextMate user Yehuda Katz.
My own personal experience/advice is that you can really drive yourself crazy trying to mimic every feature of your favorite editor exactly as it was. Each feature you're trying to replicate is probably just a quirk you became used to through muscle memory. You'll be much more productive if you just start "accepting" Vim, learning it, and re-train your muscle memory for it.

Customizing Xcode [fonts, code sense, and more]

How can I make code completion case-sensitive?
How can I make Ctrl-k kill the content of the line and the new line character?
How can I make backspace always delete only one character, no matter what it is? Right now, it deletes spaces in chunks equal to my indent level.
How to change the indentation style in file templates? I like to have the opening brace on its own line.
How can I make the font aliased?
I'm using Xcode 3.2.2.
EDIT: Issues 2, 4, and 5 are solved. 1 and 3 are still open.
EDIT2: ad.3. Yes, I set Xcode to use spaces, not tabs.
3.
Look in Preferences : Key Bindings : Text Key Bindings : Indent Friendly Delete Backwards
If the delete key is mapped to this entry change it to plain Delete Backwards.
2.
In that same preference area, you can see that there is no delete line option to map ^k to.
How can I make code completion case-sensitive?
I don't think that's possible.
How can I make Ctrl-k kill the content of the line and the new line character?
I can't answer that one, you might need to write a script to do it.
How can I make backspace always delete only one character, no matter what it is? Right now, it deletes spaces in chunks equal to my indent level.
Backspace always deletes one character. It sounds like your file has tab characters in it, each one of which takes up the space of 4 spaces by default. You can tell Xcode to use spaces instead by de-selecting Tab key inserts tab, not spaces in the Indentation preference panel.
How to change the indentation style in file templates? I like to have the opening brace on its own line.
You need to create custom file templates. You can find the Xcode templates here:
/Developer/Library/Xcode/Templates/File Templates
You need to copy the appropriate templates to this location:
~/Library/Application Support/Developer/Shared/Xcode/File Templates
You can then edit the template files to use whatever indents you like.
How can I make the font aliased?
You need to use a font that has aliased characters. Try Monaco at 9 or 10 points.

Resources