Vim Ruby Config

Hello,

I’m new to vim. Someone please provide me their vimrc file which has all
these features at least: Completion, Syntax highlight, Line number, Auto
indentation and file browser.

Also, which plugins will be helpful working with Ruby?

Godspeed –

Junayeed Ahnaf N.

Twitter - @Nirjhor http://twitter.com/nirjhor

You can start here. GitHub - vim-ruby/vim-ruby: Vim/Ruby Configuration Files

On Mon, Oct 31, 2011 at 2:03 AM, Junayeed Ahnaf N. <

Okay I installed vim ruby and supertab but it still is not completing
codes . It completes after I use a method but not before it.

A regular IDE offer code completion before you finish using it once.

Godspeed –
Junayeed Ahnaf N.
Twitter - @Nirjhor

Coming over from AppleScript, one of the things I haven’t been able to
find is something like AppleScript’s Text Item Delimiters or Awk’s FS,
where you can define separators for text files. For example, if I have
something like this:

1 2

If I set FS to

, then I could capture 1, and 2.

While this isn’t a great example because there are many other ways to
capture this via regex. This becomes more useful with much more
convoluted things. I haven’t been able to find anything similar in Ruby,
which probably means I need to rethink how I capture blocks of text and
store them into arrays and hashes.

Wayne

On Mon, Oct 31, 2011 at 02:29, Junayeed Ahnaf N. <
[email protected]> wrote:

Okay I installed vim ruby and supertab but it still is not completing
codes . It completes after I use a method but not before it.

A regular IDE offer code completion before you finish using it once.

It’s not an IDE. If you’re looking for something in that vein,
RubyMinehttp://www.jetbrains.com/ruby/is probably the best out
there. The reason that it doesn’t auto-complete
until after you’ve defined it is because it doesn’t load the entirety of
your Ruby + Gems into memory before starting up. If it did, it would
perform like an IDE, too.

-Nick K.

If you are parsing HTML you could of course use AN HTML PARSING
LIBRARY!!!

Failing that you could use the split command from available from the
String class

mystring.split(//)

But I recommend a Nokogiri for parsing HTML and XML. See also

Spot on. I use RubyMine all the time. Hearing a lots of good thing about
vim I tried to shift. But alas! Only in vein.

Godspeed –
Junayeed Ahnaf N.
Twitter - @Nirjhor

On Oct 31, 2011, at 04:32 , Junayeed Ahnaf N. wrote:

Spot on. I use RubyMine all the time. Hearing a lots of good thing about vim I
tried to shift. But alas! Only in vein.

So load all the files in your project:

% vim lib/**/*.rb

or use a tagfile. Exuberant ctags is a great program.

Thanks everybody. It’s just a matter of rethinking things, but the
Justin you were spot on. The record separator was exactly what I was
thinking about (or something similar actually).

I figured out why my parsing of data wasn’t going so well. Maybe
somebody can point me to better documentation on why this happens.

If I do this:

myarray = somestring.split(’\n\n’)

My array ends up with a single item

If I do this:

myarray = somestring.split("\n\n")

my array ends up with the breaks exactly where I expected them and I end
up with multiple items in my array.

so, why is " not equal to ’ in this instance?

Thanks,
Wayne

Because that is how Ruby (and also Perl) work. Strings inside ’ are
litteral and strings inside " are interpolated.

This might sound a little rude but have you read any books on Ruby or
worked through any of the tutorials?

On Oct 31, 2011, at 4:17 PM, Peter H. wrote:

Because that is how Ruby (and also Perl) work. Strings inside ’ are
litteral and strings inside " are interpolated.

This might sound a little rude but have you read any books on Ruby or
worked through any of the tutorials?

Peter:

Yes on both accounts (and I don’t consider it rude that you
asked/suggested). However, this is the first time I’ve run into this
problem and I suspect that’s because most of the
books/tutorials/examples out there don’t go into details on this
particular subject. Coming from a language where you couldn’t
interchange single and double quotes in 99% of the situations, I was
simply caught off-guard. Thanks for your explanation.

Wayne

On 10/31/2011 03:40 AM, Wayne B. wrote:

Coming over from AppleScript, one of the things I haven’t been able to find is
something like AppleScript’s Text Item Delimiters or Awk’s FS, where you can
define separators for text files. For example, if I have something like this:

1 2

If I set FS to, then I could capture 1, and 2.

While this isn’t a great example because there are many other ways to capture
this via regex. This becomes more useful with much more convoluted things. I
haven’t been able to find anything similar in Ruby, which probably means I need to
rethink how I capture blocks of text and store them into arrays and hashes.

Wayne
I believe you are looking for $/

http://www.rubyholic.com/Languages/Ruby/QuickRef.html#19

Also, you can set the record separator when calling various methods like
gets():

http://rubydoc.info/stdlib/core/1.9.2/IO:gets

-Justin

I put my vim config on GitHub: http://github.com/samwho/vim-config

There’s probably more in there than you need. Feel free to pick and
choose
:slight_smile: it’s a tad messy, too. I started using pathogen half way through
(kind
of like a package manager for vim).

Recommended parts: vim-ruby, syntastic (check the vimrc file for
syntastic
setup), and rubycomplete.

As has been mentioned already, the autocomplete isn’t built to work like
an
IDE and will require exuberant ctags to run.

I hope this helps :slight_smile: