ALT Linux Sisyphus discussions
 help / color / mirror / Atom feed
From: Alexander Bokovoy <a.bokovoy@sam-solutions.net>
To: sisyphus@altlinux.ru
Subject: Re: [sisyphus] vim+ruby
Date: Fri, 2 Nov 2001 11:57:43 +0200
Message-ID: <20011102115743.C8602@pc152.belcaf.minsk.by> (raw)
In-Reply-To: <20011102033830.GA9229@reks.ftc.ru>

[-- Attachment #1: Type: text/plain, Size: 972 bytes --]

On Fri, Nov 02, 2001 at 09:38:30AM +0600, Eugeny Korekin wrote:
> Может быть можно было бы собирать vim, который с --features=huge еще и с
> поддержкой ruby по умолчанию, раз уж ruby есть в sisyphus? Чем ruby хуже
> perl и python? %)
:-) Ничем не хуже. Особенно, если учесть, что интенсивность проникновения
Ruby в Сизиф скоро усилится (сюрприз :).

2Sergei Aranovsky: было бы очень хорошо его туда добавить, в виде
--enable-rubyinterp, тогда можно будет внутри VIM скрипты писать на Ruby
для самого редактора. Дополнительно, было бы хорошо добавить в runtimepath
http://vim.sourceforge.net/scripts/script.php?script_id=119
и http://users.erols.com/astronaut/vim/syntax/vim.vim.gz
а также приаттаченный скрит, для более полноценной поддержки встроенных
языков и выравнивания программ на них.
-- 
/ Alexander Bokovoy
$ cat /proc/identity >~/.signature
  `Senior software developer and analyst for SaM-Solutions Ltd.`
---
Xerox your lunch and file it under "sex offenders"!

[-- Attachment #2: ruby-state --]
[-- Type: text/plain, Size: 4610 bytes --]

>From ruby-talk-admin@ruby-lang.org  Sat Oct 27 11:18:47 2001
Return-Path: <ruby-talk-admin@ruby-lang.org>
Delivered-To: ab@localhost.belcaf.minsk.by
Received: from localhost (localhost.localdomain [127.0.0.1])
	by pc152.belcaf.minsk.by (Postfix) with ESMTP id 7D1A61CB
	for <ab@localhost>; Sat, 27 Oct 2001 11:18:47 +0300 (EEST)
Received: from 217.21.35.41 [217.21.35.41]
	by localhost with IMAP (fetchmail-5.9.0)
	for ab@localhost (single-drop); Sat, 27 Oct 2001 11:18:47 +0300 (EEST)
Received: from helium.ruby-lang.org ([210.251.121.214]) by
          mail.belcaf.minsk.by (Netscape Messaging Server 4.15) with ESMTP
          id GLUV1S00.MAW for <a.bokovoy@sam-solutions.net>; Sat, 27 Oct
          2001 11:17:52 +0300 
Received: from helium.ruby-lang.org (localhost [127.0.0.1])
	by helium.ruby-lang.org (Postfix) with ESMTP
	id B0B543C94; Sat, 27 Oct 2001 17:17:35 +0900 (JST)
Received: from mail.whidbey.net (mailout.whidbey.net [209.166.64.124])
	by helium.ruby-lang.org (Postfix) with SMTP id 7BFAA3B6F
	for <ruby-talk@ruby-lang.org>; Sat, 27 Oct 2001 17:17:34 +0900 (JST)
Received: (qmail 21431 invoked from network); 27 Oct 2001 08:17:33 -0000
Received: from unknown (HELO there) (208.31.145.234)
  by mail2.whidbey.net with SMTP; 27 Oct 2001 08:17:33 -0000
Date: Sat, 27 Oct 2001 17:17:35 +0900
Posted: Sat, 27 Oct 2001 01:20:26 -0700
From: Ned Konz <ned@bike-nomad.com>
Reply-To: ruby-talk@ruby-lang.org
Subject: [ruby-talk:23609] Re: ANN: RuEdit - introspective Ruby editor
To: ruby-talk@ruby-lang.org (ruby-talk ML)
Message-Id: <20011027081734.7BFAA3B6F@helium.ruby-lang.org>
In-Reply-To: <9r7old$opq$1@wanadoo.fr>
References: <63604d2.0110190851.76343af@posting.google.com> <20011023.140232.238962600.7016@zipworld.com.au> <9r7old$opq$1@wanadoo.fr>
X-ML-Name: ruby-talk
X-Mail-Count: 23609
X-MLServer: fml [fml 3.0pl#17]; post only (anyone can post)
X-ML-Info: If you have a question, send e-mail with the body
	"help" (without quotes) to the address ruby-talk-ctl@ruby-lang.org;
	help=<mailto:ruby-talk-ctl@ruby-lang.org?body=help>
X-Mailer: KMail [version 1.3.1]
X-Image-URL: http://bike-nomad.com/nedicon.jpg
Mime-Version: 1.0
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 8bit
Precedence: bulk
Status: RO
Content-Length: 2321
Lines: 78

On Wednesday 24 October 2001 06:12 pm, Benoit Cerrina wrote:
> > One thing I'm thinking about is something that would allow a keystroke to
> > open up myri (not sure whether it's still called that ... the GUI someone
> > wrote to sit on top of the interactive reference) to the right entry for
> > the function or class my cursor's on.
>
> Don't know how myri works but I'd say its probably easier to do it without
> ruby.
> I believe doing something with another scripting language than vim's own
> is really usefull only when the something either:
>     needs data structures
>     is computationaly intensive
> none of this apply there.
> Benoit

Well, here's my first usage of Ruby inside of Vim. It implements a state 
machine that pulls out some but not all lines from one buffer into another, 
then reformats them so that adjacent blocks have single blank lines between 
them.

It was really annoying (and slow) to do in Vim because you have to explicitly 
switch between the buffers for every line.

I did use the Vim reformatting command, though, because it's faster and 
simpler for this task.

" Ruby function embedded in a Vim macro
function! OtlMakeText()
ruby <<EOF
  origBuffer = $curbuf
  lastLeader = nil
  lastWasBlank = true
  lastIndent = 0
  VIM::command("new")   # make a new window and switch to it
  newLine = 0

  (1 .. origBuffer.length).each { |n|
    line = origBuffer[n]
    indent = 0
    line.sub!(/^\t*/) { |tabs| indent = tabs.length; "" }
    if line =~ /^[|* 0-9-]/
      leader = line[0,1]
      line.sub!(/^\| /, "")
      if ((lastLeader \
          && leader != " " \
          && leader != lastLeader) \
            || indent != lastIndent)
        $curbuf.append(newLine, "")
        newLine = newLine+1
        lastWasBlank = true
      end
    else
      leader = nil
      line = ""
    end

    isBlank = (line == "")
    unless isBlank && lastWasBlank
      $curbuf.append(newLine, line)
      newLine = newLine+1
    end

    lastWasBlank = isBlank
    lastLeader = leader
    lastIndent = indent
  }

  VIM::command("set tw=80")     # set textwidth
  VIM::command("normal 1GgqG")  # re-format buffer
  VIM::command("wincmd p")      # return to last window
EOF
endfunction

-- 
Ned Konz
currently: Stanwood, WA
email:     ned@bike-nomad.com
homepage:  http://bike-nomad.com


  parent reply	other threads:[~2001-11-02  9:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-02  3:38 Eugeny Korekin
2001-11-02  8:10 ` Sir Raorn
2001-11-02  8:23   ` [sisyphus] vim+ruby Mikhail Zabaluev
2001-11-02  9:57 ` Alexander Bokovoy [this message]
2001-11-08 23:48 ` [sisyphus] vim+ruby AT
2001-11-09  1:43   ` Eugeny Korekin
2001-11-09  8:40   ` Dmitry V. Levin
2001-11-09 12:25     ` [sisyphus] gvim AT
2001-11-09 12:36       ` Artem K. Jouravsky
2001-11-09 12:51       ` Aleksey Novodvorsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20011102115743.C8602@pc152.belcaf.minsk.by \
    --to=a.bokovoy@sam-solutions.net \
    --cc=sisyphus@altlinux.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Sisyphus discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/sisyphus/0 sisyphus/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 sisyphus sisyphus/ http://lore.altlinux.org/sisyphus \
		sisyphus@altlinux.ru sisyphus@altlinux.org sisyphus@lists.altlinux.org sisyphus@lists.altlinux.ru sisyphus@lists.altlinux.com sisyphus@linuxteam.iplabs.ru sisyphus@list.linux-os.ru
	public-inbox-index sisyphus

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.sisyphus


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git