Auto open/close brackets in Geany - editor

I started using Geany to programm in PHP. I noticed that, when I'm writting a condition for example (or any type of loop), when I hit the tab key right after the if or while instruction, the code finishes writing itself automatically. But the brackets don't go where I want the to go.
Here is an example to explain myself :
So this is the default behavior when I hit the tab key :
if ()
{
}
As you can see, the first bracket goes right underneath the if instruction.
But I want it to be like this :
if () {
}
How could I configure that ?

You can configure this via snippets.conf. Go to Tools->Configuration Files->snippets.conf.
There are plenty possibilities to adjust configuration it's a good point to have a look into documentation.
However, if I understood you correct the snippets should look something like:
#....
[PHP]
if=if (%cursor%) {\n %block_cursor% \n\t}
#....

Related

Neovim Telescope Read File Into Current File?

Jumping on this lua-neovim bandwagon...Need help with Telescope, please.
In my old setup; I'd grab basic templates from my documents like:
<leader>gt :-1read ~/Documents/templates/
And then I just use vim's normal tab completion to get where I need to go, but with telescope's fuzzy search and preview window, this will go to the next level!
I can open my templates like this
lua require('telescope.builtin').find_files{ cwd = '~/Documents/templates/' }
I've tried several combos with :read and various brackets, to make it read the contents into the current file to no avail (just learning Lua now, so mostly just crash and bang methods)
I found this in the docs with vague mention to reading files
previewers.buffer_previewer_maker({filepath}, {bufnr}, {opts}) previewers.buffer_previewer_maker()
But I'm obviously missing something.
Ideally I'd want key combo in the mappings, that way I can open normally, or read it (bonus points if it inserts at the cursor) - along with the miriad of options already available.
mappings = {
i = {
["<C-n>"] = actions.cycle_history_next,
["<C-p>"] = actions.cycle_history_prev,
...
["<C-r>"] = actions.READ_FILE_INTO_BUFFER,
...
Anyways, I've spent way too long on this, and I'm sure one of you Lua/Neovim Geniuses will have the solution!
Thanks!

Intellij IDEA custom dart format. How to make dot operator on the same line

I am trying to configure dart to let the operator . appear on the same line.
I am not having any success on configuring it to do that.
It currently looks like this
I would like colors.removeLast() and colors.length to be each on one line.
So it should be like
do
{
colors.removeLast();
}
while(colors.length > 0);
Any suggestions on how I can make that happen ? Which settings do i need to change ?
Increase line length. The function call is being placed on the new line as the line cannot be longer than 20 (or so) symbols. Increasing this value will prevent IntelliJ IDEA to find ways to fit the text.
See the difference:

Syntax completion based on snippets for rails project in vim

I wonder if exists some plugin which offers syntax completion based on rails snippets (from snipmate).
Example:
Being on specs, I provide shou, press hotkey and I got list of possible completions (like for Ctrl-p). Selecting anything from list, will insert a snippet.
Does something like this exists?
You can hit <C-r><Tab> in insert mode to pop up a list of available snippets, hit <Enter> to select the right one and hit <Tab> to expand the snippet. But the menu doesn't provide a description.
This is not specific to SnipMate, but you might also find Vim's line completion feature useful here. While in insert mode, Ctl-xCtl-l will offer possible completions for the whole line. So if you already have something like the following in your open buffers:
it { should belong_to(:user) }
it { should validate_presence_of(:title) }
and you start typing
it {Ctl-xCtl-l
... you will get a list of possible full line completions to match.

Typo3 : using typoscript to modify the base-url

I am trying out TYPO3's introduction package. For that I am using Xampp on my computer.
I have installed it in a subdirectory, but since it uses "real-url", I need to modify the generated links, so that instead of http://localhost/about-typo3/ I get http://localhost/subfolder/about-typo3/
I believe it must be done via "typo-script", and from what I have read on the Internet, this line should do the job :
config.baseURL = http://localhost/subfolder/
But I don't know where I should put it. I have tried different locations, but with no apparent effect.
So what I would like to know is : am I on the good path for what I need to do, and if yes, what should I try now ?
This is a bug in the 4.6 Introduction Package. 4.7 will ship with a correct version, so you might just want to go ahead and try the Introduction Package from 4.7RC2 (Preview Releases).
For now, just choose Template in the module menu on the left. Then use the dropdown to select Constant Editor. Now choose the page HOME in the pagetree on the middle.
Now use the second dropdown to select CONFIG. There modify the topmost setting Absolute URI prefix. Input your full domain without the last slash (/). That means copy your current URL from the browser and strip /typo3/backend.php. Now save with the little save icon in the top toolbar.
This will also invalidate all caches for you (because you changed the topmost template). No need to install extra extensions or to do this manually.
Alternative you can fix the actual bug. Go to template module and select the folder TypoScript Templates / page_configuration. Now select Info/Modify instead of Constant Editor and directly above the table page.config. The click the pencil left of Setup. Find the line absRefPrefix = {$config.absRefPrefix}/. This should be around line 62 (4.7RC2). Remove the last slash (/) from that line and save. Because you are not on the topmost template, you need to clear the cache. On the topright of your screen, you can find the yellow flash icon. Click it and select Clear all caches (red flash). Now go to you website again.
A general note about (config.)baseURL. This is more a hack, because it just tells the browser to behave as if the website would be at another place. The correct way is to create correct links in first place. You should use (config.)absRefPrefix instead. To make this work in auto mode, it must be completely empty (config.absRefPrefix =).
Do not use baseURL any more. The next Introduction Package will not have this setting.
Yet another note: If you use the config.absRefPrefix, you have to include the last slash (/). The only reason why you do not have to do so above (in the constants), is because it is hardcoded in the template and thus also preventing the automatic detection to work.
If you are using different hosts, you can use typoscript conditions in your root template:
# Default:
config.baseURL = http://www.example.com/
[globalString = ENV:HTTP_HOST=sub1.example.com]
config.baseURL = http://sub1.example.com/
[global]
[globalString = ENV:HTTP_HOST=sub2.example.com]
config.baseURL = http://sub2.example.com/
[global]
if you are using introduction package. there is Constant for set the base url
Go to 'Template' and 'Constant Editor.. you can find 'Domain name for Base URL [config.domain]' .. for setting base url
also you can put the
config.baseURL = http://localhost/subfolder/
on 'Info Modify' Setup field
hope will help you .. sorry for my bad english

Problems with Netbeans re: Rails erb/rhtml intellisense?

I've been using Netbeans for Rails and like it a lot, considering how little I paid for it. But something that bothers me is that when I'm editing an RHTML or ERB file, it doesn't do the code autocomplete - or at least not reliably. Sometimes it shows the appropriate variables and methods that are available on an object after you type the dot operator. Sometimes it ignores the instance variables. Is there a solution for this? (Please don't say RadRails).
Oh and one more thing in case anyone has solved this: considering how often I have to type <% when I'm in a Rails template, I wish there was some hotkey for autotyping the tag . . . ? I always have to stop and look down at my keyboard to find the < and % keys before I can type the tag so it's not as trivial as it might sound.
I believe you're looking for something like this:
http://ruby.netbeans.org/codetemplates-rhtml.html
Type in one of the triggers, then hit the tab key to expand it to the code as given.
Also, you might want to explore using HAML. It's much easier on the hands.

Resources