Forum: Ruby Vim 7 insert-mode mappings

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Daniel S. (Guest)
on 2006-05-15 19:42
(Received via mailing list)
I've just started using Vim (yes, it's heresy...), and I'm absolutely
loving it -- but there are of course still things I haven't picked up
yet.

One of those things is insert-mode mappings, as described at RubyGarden
[1]. In the section "Customising" there's a guide on how to add such,
namely this:

   imap <S-CR>    <CR><CR>end<Esc>-cc

which should be inserted into ftplugin/ruby_structure.vim.

  1)  ruby_structure.vim didn't already exist, so I created it.
      Should it already have existed?

  2)  Nothing happens after I've added the snippet above to
      ruby_structure.vim. Do I need to do more?


Daniel




  [1]  <http://www.rubygarden.com/ruby/ruby?VimRubySupport>
Reid T. (Guest)
on 2006-05-15 20:07
(Received via mailing list)
Daniel S. wrote:
> which should be inserted into ftplugin/ruby_structure.vim.
>
>
>
>  [1]  <http://www.rubygarden.com/ruby/ruby?VimRubySupport>
>
while in insert mode, type

begin<shift-enter>



i.e. after keypressing the 'n' in begin, press && hold the shift key and
press enter
Daniel S. (Guest)
on 2006-05-15 20:23
(Received via mailing list)
Reid T. wrote:
> while in insert mode, type
>
> begin<shift-enter>
>
> i.e. after keypressing the 'n' in begin, press && hold the shift key and
> press enter

It doesn't work -- it only indents the next line (which it has done all
along). I want it to add the `end' keyword after that line.


Daniel
Reid T. (Guest)
on 2006-05-15 21:55
(Received via mailing list)
Daniel S. wrote:
>
>
> Daniel
>
works for me

when you open a .rb file and enter
:imap

what does vim report?
Daniel S. (Guest)
on 2006-05-16 00:33
(Received via mailing list)
Reid T. wrote:
> when you open a .rb file and enter
> :imap
>
> what does vim report?

Here's what I get:

   i  <S-CR>        <CR><CR>end<Esc>-cc


Daniel
Wink Saville (Guest)
on 2006-05-16 09:06
(Received via mailing list)
Daniel S. wrote:
>
> Daniel
>

Note: I'm having the same problem with vim70, I added ruby_structure.vim
but it won't add the "end" also the in my system its adds tabstops I was
expecting two spaces for indenting?

Cheers,

Wink
Daniel S. (Guest)
on 2006-05-16 12:51
(Received via mailing list)
Wink Saville wrote:
> Note: I'm having the same problem with vim70, I added ruby_structure.vim
> but it won't add the "end"

Ahh, so I'm not the only one. Well, that's good to know.

> also the in my system its adds tabstops I was
> expecting two spaces for indenting?

I'm not experiencing that problem. Have you checked your ~/.vimrc file?


Daniel
Jim Marshall (Guest)
on 2006-05-18 00:56
(Received via mailing list)
On 5/15/06, Daniel S. <removed_email_address@domain.invalid> wrote:
>
> It doesn't work -- it only indents the next line (which it has done all
> along). I want it to add the `end' keyword after that line.


If you are running console-mode Vim (within an Xterm, say, or at the
text-mode Linux VT), then Vim is probably not seeing the shift modifier
applied to the CR. Try gvim (graphical Vim) and see if it works there if
this is the case; it really should. Unfortunately, I don't know if it's
possible to get console-mode Vim to see the shift if that's the problem.
Jeff R. (Guest)
on 2006-05-18 13:27
(Received via mailing list)
This is the case for me.  It works in gvim, but not in regular vim...
Daniel S. (Guest)
on 2006-05-18 16:09
(Received via mailing list)
Jim Marshall wrote:
> On 5/15/06, Daniel S. <removed_email_address@domain.invalid> wrote:
>>
>> It doesn't work -- it only indents the next line (which it has done all
>> along). I want it to add the `end' keyword after that line.
> If you are running console-mode Vim (within an Xterm, say, or at the
> text-mode Linux VT), then Vim is probably not seeing the shift modifier
> applied to the CR. Try gvim (graphical Vim) and see if it works there if
> this is the case; it really should. Unfortunately, I don't know if it's
> possible to get console-mode Vim to see the shift if that's the problem.

Yes, that seems to be the problem.

Does anyone have a solution to this?


Daniel
This topic is locked and can not be replied to.