vim Part2at SOFTWARE
vim Part2 - 暇つぶし2ch734:名無しさん@お腹いっぱい。
08/06/30 18:39:38 QTNpt5Qe0
ついにvim scriptを初めて書いてみた。
ファイルの中のhead_strで始まる単語を重複なくリストに格納し返す関数。
2時間もかかった。ゼロからの挑戦。超疲れた。

function! Get_words_starting_with(head_str)
  let words = []
  let lines = getline('1','$')
    for line in lines
    let str = matchstr(line, '\<' . a:head_str . '.\{-}\>')
    while str != ""
      let line = strpart(line, match(line, '\<' . a:head_str . '.\{-}\>') + 1)
      if count(words, str) == 0
        call add(words, str)
      endif
      let str = matchstr(line, '\<' . a:head_str . '.\{-}\>')
    endwhile
  endfor
  return words
endfunction

ところで、昔はvim scriptスレがあったみたいだけど、今はないのね。


次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch