Syntax completion based on snippets for rails project in vim - ruby-on-rails

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.

Related

PascalScript: Looking for something like OnBeforeLineExec and OnAfterLineExec

I am writing a small IDE with Single Steps using the Debugdemo.
Now I need an Event before and after a line is executed.
I would like to disable my Editor while the current Line is executed.
I found the OnLine Event but did not find out in what cases it is fired or how I can use it.
Any hints are welcome.
Greetings Klaus
The OnLine event is meant to alter the interpretation of code.
It is not meant for debugging purposes.
If you want to do that use the BreakPoints in TPSScriptDebugger.
Put a breakpoint on the line and after the line.
Now you will get a signal before and after the line is executed.

Is there any editor or popular editor extension that automatically remove quotes/brackets?

There are too many text editors, which have the function, that if I just select a piece of the code and press the quote/bracket key, the selected code becomes wrapped into the type of the quotes/brackets I pressed. But do you know any or are you using any, which has also the function, that if I select the piece of the code wrapped into the quotes/brackets and press the same quote/bracket key or some key combination, that piece of code becomes unwrapped?
Also if you know any editor or popular editor extension that automatically remove all quotes/brackets from the code, please write it too. Everything would be helpful.
We are doing some research and this question is still unanswered. Please help us if you know anything about.
I create a simple Zeus (Windows) Lua script that does this for the quote case (i.e. the macro wraps any marked area in quotes).
In a similar fashion another script could be written for the brackets case.
Also as this simple script shows, this should be possible in any scriptable editor.
The script can be found here: http://www.zeusedit.com/zforum/viewtopic.php?t=7148
SynWrite editor (Windows) can do scripting for u. You can write Python plugin in 10min, and assign it a hotkey, so selection (or all text) will dequote, or what ever.
Finally, I've made it by writing my own extension to my favourite editor.

Turn off TextMate 2.0 snippets

Summary: I write Ruby and Ruby on Rails code using TextMate 2.0 (version 2.0-alpha.9515 currently) and I find I'm accidentally triggering the 'snippets' feature.
Sacrilegious though it might be, I currently don't want to use most of TextMate's advanced features - which means I also don't want to have to learn all about them. But I can't seem to avoid triggering the 'snippets' feature which inserts unwanted text into my code. I'd like to be able to turn the feature off entirely. Or failing that I'd like to be able to disable any snippet that's causing me problems - but in order to do that I'd like to be able to quickly find the relevant entry amongst all the many bundles.
To give an example, I happened to have some variables with names like 'serial_if'. If I hit 'tab' after typing the variable name, TextMate would insert the template for an if statement and I couldn't figure out how to stop it happening. I contacted TextMate's support people and was told that in theory the snippet that's firing could be anywhere. To quote: "We use scopes to determine what bundle items are active at a given time, so items from any bundle could be active and responding to the tab key." I did track the problem down with their help (it was in Ruby > Menu Actions > Declarations). But now I'm noticing that if I hit tab after a colon I get ':key => "value",' inserted. And of course since Ruby 1.9, it's common to put a colon at the end of a variable name in order to use a symbol as a hash key. I haven't found the relevant entry for that yet - and it's not ideal to have to make time to go looking for it.
Is there a way to stop all snippets firing in a way that doesn't involve nuking the feature forever? Or is there a way to quickly find which snippet just fired in order to kill it? Any tips appreciated.
To disable tab triggers (i.e. pressing tab and potentially have a snippet inserted) do:
Edit → Macros → Start Recording (⌥⌘M)
Press tab (⇥)
Edit → Macros → Stop Recording (⌥⌘M)
Edit → Macros → Save Macro… (⌃⌘M)
Select a bundle for where to save your macro
Set key equivalent to tab (⇥)
Press ⌘S to save the macro.
Now pressing tab (⇥) executes the macro (that always insert a tab) instead of TextMate’s default behavior.
If you wish to only disable the feature for ruby then set the macro’s scope selector to source.ruby.
As for how to find which items are inserted, use:
Bundles → Select Bundle Item… (⌃⌘T)
Enter if
Press option-return (⌥↩) to edit the item found

Does Texniccenter or any other tex editor auto-complete references in Latex?

I want to use a latex editor that has auto completion feature for existing references in a latex file. Do you know any good ones? I am trying to find this feature in texniccenter, but I guess it doesn't exist or I could't find it yet.
Update:
Ok, I found how to enable auto completion in Texniccenter. I needed first create a project. Then open the file in this project (or copy its text). Now Ctrl-Space inside a \ref{} tag completes the reference automatically.
Texlipse does this, also with Ctrl+Space.
Inlage includes such a function, too. New commands and new environments will also appear in the auto completion list. If you use extern BibTex files the \cite{} command will open a list with your articles and books from you .bib file.
Ok, I found it. I needed first create a project. Then open the file in this project (or copy its text). Now Ctrl-Space inside a \ref{} tag completes the reference automatically.
Kile has reference completion. If you type Ctrl+Space inside of a \ref{}, you get a list of all the references (that existed last time you compiled, of course).
LEd presents a click list of them when in a \ref{}
The RefTeX mode for Emacs will do what you're asking for: the shortcut C-c ) activates the "insert a \ref" mode (of course, you can customize which type of reference: fancyref, hyperref, etc) and pressing TAB will allow you to start typing and autocomplete by tabbing again after typing some characters.
It also figures out (or asks if it can't) what sort of ref you're inserting and shows a list of all the defined \labels in your document, selectable with the arrow keys or C-n / C-p.
Now we just need a Vi user to come along and tell us how to do it there...
Now texmaker does, not need any special key.

Pretty Print for (Informix-)4gl code

i'm searching for a pretty print program (script, code, whatever) for Informix-4GL sources.
Do you know any ? Than you, Peter.
Have you looked at the IIUG (International Informix User Group) software archive? There are two pretty printers there (of indeterminate quality).
The other place to look would be the Aubit4GL site - an open source variant of I4GL. Again, I'm not sure that they have a pretty-printer, but it might be something they have (though a casual check doesn't show one).
I don't know if anyone is reading this post anymore, but the easiest way to get some kind of nice "pretty print" of 4gl code is to view it in the Openedge Developer Studio, then use ctrl-I to set indention. You can adjust indention in the editor settings by saying the length of "tabs". (default is 4, I use 3)
Then do a ctrl-shift-f to make all command words uppercase.
Next, you can condense the code a few lines by moving all the "DO:" statements up a line next to the "THEN" statement with this regular expression search and replace.
ctrl-f:
search "\s*\n\s*DO[:]"
replace " DO:"
make sure you click the checkbox marked regular expressions.
At this point the code is nice and tidy.
Do a ctrl-a and ctrl-c to copy it to the clipboard.
paste it in Outlook as an email without sending. Print it in color.

Resources