I've searched all over this site, and since I don't know what this particular function is called, I'm not sure how to find the answer, so apologies if this is a repeat.
I'm a new Ruby On Rails dev using Komodo IDE. When I type something such as
def full_title
it auto-inserts a bunch of crap until the text looks like:
def fulll_title(args)
#code
end
How do I either get rid of the (args) and (#code) or make use of them? Having to manually delete that junk is getting really, really old. I'm fine with either solution as long as there IS a solution. I don't even know what that particular feature is called, so I'm having a really hard time Googling/finding the answer on my own
Komodo IDE calls this feature code intelligence, and here are a few unrelated questions on controlling it:
Komodo Edit disable autocomple
Calltips/Docstring while viewing function list?
Komodo Edit macro to replace a specific word in current document with clipboard content; is it possible?
Related
I started using Vim to do my editing in Ruby on Rails, so I installed the Rails.vim plugin. I really like this plugin, but I have a few issues with it:
I have to type :Econtroller Controller to edit a controller. The same for models (:Emodel Model), etc. If I had a controller named people, it would be much easier to type :ec People and press enter. This would save me 9 characters, not counting every time I have to hit the shift key to capitalize the E!
I don't feel that I should have to capitalize the class name when opening the file as described in bullet #1. For example, if I do want to edit the People controller, I have to press the shift key before I even start to type the name of the class. Then, I type fast enough that I regularly hold down shift too long and People becomes PEople, then Rails.vim RENAMES the file to PEople!
If you have any solutions or suggestions, please let me know. Thank you for your help!
You can use :cabbrev to make exactly the shortcut you're asking for:
:cabbrev ec Econtroller
This way, when typing ec<space>, this will expand to Econtroller<space> anywhere on the command line. See :help abbreviations for more details.
As for capitalization, I don't actually think you need to capitalize the controller. At least on my installation of rails.vim, :Econtroller users works just fine to get me to the UsersController. Maybe you should update your rails.vim plugin?
I came over this issue a few times now.
When I write javadocs there are times when I would have quite a lot of links. However, with respect to the javadoc style guide, I avoid to always use #link for multiple mentioned references but just use #code. Nice thing: Eclipse also gives me auto-completion with the #code tag.
Bad thing: When I now rename the reference - e.g. a method - all #link references will be updated, but the #code references will not.
What I am search for: Either a possibility for #link without highlighting the link or something like #code which will be updated by Eclipse when I do some refactoring.
Any hints on that?
Thanks,
Erik
you could use
{#linkplain ClassName}
this will be updated on refactoring changes, but it will displayed in the normal text font and not displayed in a code-font.
I've got MMM-mode set up to edit .html.erb files, but indentation does not work in the ruby sections, and all the different electric behaviours of ruby-mode do the wrong thing. I've changed this sub-mode from ruby-moode to fundamental-mode, and it works much better.
I want to still use ruby-mode's font-locking though, is this possible/easy? Any hints on where to start.
Elisp is comfortable to me, but I don't have too much time right now to dig too deeply myself. Hopefully someone will have a snippet?
I see you haven't yet found an answer. Dunno whether it will be better for this, but you might consider using MuMaMo instead of MMM.
To answer the question, you would define a major mode deriving from fundamental-mode, and in its body just copy the font-lock-related lines from the ruby-mode definition body, the ones setting font-lock- variables and also syntax-propertize-function. Naturally , you need to (require 'ruby-mode) somewhere.
But for .html.erb files I can now recommend using mmm-erb, which was not available when this question was asked.
I've been learning Ruby/Rails with vim. Tim Pope's rails.vim seems like a really good tool to traverse files with, but I keep getting these pesky "E345 can't find file in path" errors. I'm not vim expert yet, so the solution isn't obvious. Additionally, I've tried this and it doesn't apply to my problem.
As an example of the problem. I have a method format_name defined in app/helpers/application_helper.rb and it is used in app/helpers/messages_helper.rb. Within the latter file I put my cursor over the usage of format_name and then hit gf and I get that error. Similar disfunction with commands like ]f and [f
However, it works sometimes. I was able to gf from user to the app/models/user.rb
Ideas?
I think that is a limitation of rails.vim. It does not support “finding” bare methods. Supporting something like that would require one of the following:
an exhaustive search of all the source files for each “find” request
(which could be expensive with large projects),
“dumb” indexing of method names
(e.g. Exuberant Ctags and gControl-]; see :help g_CTRL-]), or
smart enough parsing of the code to make a good guess where the method might be defined
(which is hard to do properly).
If you know where the method is, you can extend many of the navigation commands with a method name:
:Rhelper application#format_name
But, you do not have to type all of that in. Assuming the cursor is on format_name you can probably just type:RhTabspaceappTab#Control-R Control-W (see :help c_CTRL-R_CTRL-W).
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.