View All Posts. MiCHiLU.com powered by Django ;-)

Project.vimのfilterでexcludeできないの?

できなかったので、なんとかしてみるメモ。

filterの値はglobに渡っていて、ワイルドカードが展開されるだけみたい。 globは `comannds` というように「`」で括るとsystemコマンドの結果に置き換える。 でもMac OSXのlsはexcludeできない。 --ignore オプションが使えない。 grepしたりsedしたりいろいろやったけど、globが扱える出力に加工できなかった。どうやるんだろう。なに<NL>って。

vimの system() はshellの出力を扱う。改行文字は<NL>に自動変換される。 glob()system() に書き換える。 filterに空白文字を含めたまま、systemに渡す方法がわからない。 script書いてコマンドにしてあげるとうまくいった。

via

~/.vim/plugin/project.vim

$ diff project.vim.org project.vim
428c428
<             let single=glob(strpart(filter, 0, end))
---
>             let single=system(strpart(filter, 0, end))

~/bin/filter4project_vim.sh

#!/usr/bin/env sh

ls |grep -v pyc$

~/.vimprojects

michilu=/path/to/dj/michilu CD=. filter="~/bin/filter4project_vim.sh" {
 __init__.py
 doc-ja_revision.txt
 dump.json
 initial_data_.json
 manage.py
 settings.py
 sitemaps.py
 test.sql
 urls.py

 bin=bin {
  cron.sh
  doc-ja_update.py

  wsgi=wsgi {
   michilu.wsgi

  }
 }
 blog=blog {
  __init__.py
  feeds.py
  models.py
  sitemaps.py
  tests.py
  urls.py
  views.py

 }
 conf=conf {
  fixtures=fixtures {
   site_develop.json
   site_production.json

  }
  servers=servers {
   django.conf
   httpd.conf
   lighttpd.conf
   mime.types

  }

そうそう、pycがリストされなければいいのです。 1行空いてるけど気にしない。 変な出力を渡すと変なことになるので注意。

Sat, 22 Sep 2007 14:22:19 +0900 source edit
Creative Commons License
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 2.1 Japan License.
View All Posts. MiCHiLU.com powered by Django ;-)