1 of 31

How to develop CRuby

easily with Vim

Tatsuhiro Ujihisa

2017-09-19

RubyKaigi 2017 (Lightning talk)

2 of 31

3 of 31

Target audience

  • People new to contribute to CRuby
    • but not necessarily familiar with C
  • Vim users

4 of 31

CRuby + Vim

Q & A

5 of 31

CRuby development support

  • Emacs
    • misc/*.el (8 files)
    • doc/contributing.rdoc
      • "Indent 4 spaces for C with tabs for eight-space indentation (emacs default)"
  • Vim

6 of 31

CRuby writing basics

  • Indentation
    • :set cindent (default)
    • :set tabstop=8 (default)
    • :set noexpandtab (default)
    • :set shiftwidth=4 (not default; it was 8)
    • :set softtabstop=4 (not default; it was 0)
  • Don't write ^ directly in your ~/.vimrc
    • `:set` depends on the option type
    • cindent, tabstop, shiftwidth, and softtabstop are `local to buffer`
  • Or
    • just install mrkn/vim-cruby and :set filetype=cruby

7 of 31

Jump from Ruby to C

  • Nontrivial
    • Method#source_location is only for Ruby
  • 1.method(:to_s).source_location #=> nil
  • Solution: create index (semi-manually)

8 of 31

Jump from Ruby to C

ruby-doc.org can

show (but how?)

9 of 31

Jump from Ruby to C

ruby-doc.org can

show (but how?)

10 of 31

Q. I want to see YARV ISeq quickly

11 of 31

Q. I want to see YARV ISeq quickly

12 of 31

Q. I want to see YARV ISeq quickly

"Most RubyKaigi speakers tend to see RubyVM::Iseq pretty frequently" - @joker1007

https://twitter.com/joker1007/status/910007895470698497

13 of 31

Q. I want to see YARV ISeq quickly

quicklearn.vim https://github.com/ujihisa/quicklearn

  • general purpose just-in-time iseq/bytecode viewer for Vim

14 of 31

Q. Who are you?

15 of 31

Tatsuhiro Ujihisa

  • Favourite Ruby features
    • Continuation
    • M17N
    • Range as an (immutable) object
  • Ruby: 11 years ago, Vim: 20 years ago
  • Vancouver, Canada�Tokyo, Japan
  • Recent focus: fish
  • VimConf co-organizer http://vimconf.vim-jp.org/2017/
  • Fablic, inc since 2017-01

16 of 31

Tatsuhiro Ujihisa

  • Favourite Ruby features
    • Continuation
    • M17N
    • Range as an (immutable) object
  • Ruby: 11 years ago, Vim: 20 years ago
  • Vancouver, Canada�Tokyo, Japan
  • Recent focus: fish
  • VimConf co-organizer http://vimconf.vim-jp.org/2017/
  • Fablic, inc since 2017-01

Range

xs[3..5]

case i

when 4..8

wow

end

[1, 2..3, 4]

{3..5 => 'yo'}

17 of 31

Tatsuhiro Ujihisa

  • Favourite Ruby features
    • Continuation
    • M17N
    • Range as an (immutable) object
  • Ruby: 11 years ago, Vim: 20 years ago
  • Vancouver, Canada�Tokyo, Japan
  • Recent focus: fish
  • VimConf co-organizer http://vimconf.vim-jp.org/2017/
  • Fablic, inc since 2017-01

18 of 31

Vancouver, BC, Canada

19 of 31

Tatsuhiro Ujihisa

  • Favourite Ruby features
    • Continuation
    • M17N
    • Range as an (immutable) object
  • Ruby: 11 years ago, Vim: 20 years ago
  • Vancouver, Canada�Tokyo, Japan
  • Recent focus: fish
  • VimConf co-organizer http://vimconf.vim-jp.org/2017/
  • Fablic, inc since 2017-01

VimConf

Annual international Vim Conference

VimConf 2017

  • Tokyo, Japan
  • 2017-11-04

20 of 31

Tatsuhiro Ujihisa

  • Favourite Ruby features
    • Continuation
    • M17N
    • Range as an (immutable) object
  • Ruby: 11 years ago, Vim: 20 years ago
  • Vancouver, Canada�Tokyo, Japan
  • Recent focus: fish
  • VimConf co-organizer http://vimconf.vim-jp.org/2017/
  • Fablic, inc since 2017-01

21 of 31

22 of 31

23 of 31

24 of 31

25 of 31

26 of 31

Asakusa, Tokyo, Japan

Since 2016-10

Asakusa, Tokyo, Japan

Since 2016-10

27 of 31

28 of 31

Tatsuhiro Ujihisa

  • Favourite Ruby features
    • Continuation
    • M17N
    • Range as an (immutable) object
  • Ruby: 11 years ago, Vim: 20 years ago
  • Vancouver, Canada�Tokyo, Japan
  • Recent focus: fish
  • VimConf co-organizer http://vimconf.vim-jp.org/2017/
  • Fablic, inc since 2017-01

29 of 31

30 of 31

We support Rubyists

  • ebisu.rb
  • fablic.vim
  • vital.vim committers meeting
  • VimConf sponsor

31 of 31

Links

My past Ruby talks

  • This year
  • In the past
    • RubyConf 2009 "Hacking parse.y"
    • RubyKaigi 2008, and RubyKaigi 2009 (well, both are about Vim)