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 Nirjhor

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

You can start here. https://github.com/vim-ruby/vim-ruby

···

On Mon, Oct 31, 2011 at 2:03 AM, Junayeed Ahnaf Nirjhor < zombiegenerator@aol.com> wrote:

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 Nirjhor

Twitter - @Nirjhor <http://twitter.com/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:

<td>1</td>
<td>2</td>

If I set FS to <td>, then I could capture 1</td>, and 2</td>.

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

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 Nirjhor
Twitter - @Nirjhor

···

-----Original Message-----
From: Russell [mailto:rbakerjax@gmail.com]
Sent: Monday, October 31, 2011 12:42 PM
To: ruby-talk ML
Subject: Re: Vim Ruby Config

You can start here. https://github.com/vim-ruby/vim-ruby

On Mon, Oct 31, 2011 at 2:03 AM, Junayeed Ahnaf Nirjhor < > zombiegenerator@aol.com> wrote:

> 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 Nirjhor
>
> Twitter - @Nirjhor <http://twitter.com/nirjhor>
>
>
>
>

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(/<td>/)

But I recommend a Nokogiri for parsing HTML and XML. See also
http://weblogs.asp.net/alex_papadimoulis/archive/2005/05/25/408925.aspx

···

On 31 October 2011 10:40, Wayne Brissette <waynefb@earthlink.net> 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:

<td>1</td>
<td>2</td>

If I set FS to <td>, then I could capture 1</td>, and 2</td>.

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

···

On 10/31/2011 03:40 AM, Wayne Brissette 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:

<td>1</td>
<td>2</td>

If I set FS to<td>, then I could capture 1</td>, and 2</td>.

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

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,
RubyMine<http://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 Klauer

···

On Mon, Oct 31, 2011 at 02:29, Junayeed Ahnaf Nirjhor < zombiegenerator@aol.com> wrote:

> -----Original Message-----
> From: Russell [mailto:rbakerjax@gmail.com]
> Sent: Monday, October 31, 2011 12:42 PM
> To: ruby-talk ML
> Subject: Re: Vim Ruby Config
>
> You can start here. https://github.com/vim-ruby/vim-ruby
>
> On Mon, Oct 31, 2011 at 2:03 AM, Junayeed Ahnaf Nirjhor < > > zombiegenerator@aol.com> wrote:
>
> > 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 Nirjhor
> >
> > Twitter - @Nirjhor <http://twitter.com/nirjhor>
> >
> >
> >
> >

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

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 Nirjhor
Twitter - @Nirjhor

···

-----Original Message-----
From: Nick Klauer [mailto:klauer@gmail.com]
Sent: Monday, October 31, 2011 5:17 PM
To: ruby-talk ML
Subject: Re: Vim Ruby Config

On Mon, Oct 31, 2011 at 02:29, Junayeed Ahnaf Nirjhor < > zombiegenerator@aol.com> 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,
RubyMine<http://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 Klauer

> > -----Original Message-----
> > From: Russell [mailto:rbakerjax@gmail.com]
> > Sent: Monday, October 31, 2011 12:42 PM
> > To: ruby-talk ML
> > Subject: Re: Vim Ruby Config
> >
> > You can start here. https://github.com/vim-ruby/vim-ruby
> >
> > On Mon, Oct 31, 2011 at 2:03 AM, Junayeed Ahnaf Nirjhor < > > > zombiegenerator@aol.com> wrote:
> >
> > > 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 Nirjhor
> > >
> > > Twitter - @Nirjhor <http://twitter.com/nirjhor>
> > >
> > >
> > >
> > >
>
>
>

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 31 October 2011 21:12, Wayne Brissette <waynefb@earthlink.net> wrote:

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

So load all the files in your project:

% vim lib/**/*.rb

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

···

On Oct 31, 2011, at 04:32 , Junayeed Ahnaf Nirjhor 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.

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 Oct 31, 2011, at 4:17 PM, Peter Hickman 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?

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:

···

On 31 Oct 2011 20:19, "Ryan Davis" <ryand-ruby@zenspider.com> wrote:

On Oct 31, 2011, at 04:32 , Junayeed Ahnaf Nirjhor 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.