出しちゃいます。
/dotfiles/vim/mattn-vimrc - CodeRepos::Share - Trac正直デカイです。
/dotfiles/vim/mattn-gvimrc - CodeRepos::Share - Trac
もう随分昔からあるvimrcなので使ってない機能もあれば、忘れてしまったノウハウもいっぱい...
あまり参考にならないかもしれませんが、どうぞ。
mattn the vimmer!
追記
マルチプラットフォーム用です。
/dotfiles/vim/mattn-vimrc - CodeRepos::Share - Trac正直デカイです。
/dotfiles/vim/mattn-gvimrc - CodeRepos::Share - Trac
http://www.hsbt.org/diary/20071022.html#p02頼まれた!
だれか indent たのむ - HsbtDiary (2007-10-22)
Private Sub Class_Initialize()
Debug.Print "あめんぼ赤いな"
If Me.strValue = "" Then
Debug.Print "エラー!"
End If
End Sub
Private Sub Class_Terminate()
Debug.Print "あいうえお"
End Sub
こんなに崩れたファイルでも、vimなら「gg=G」でおしまい。
Private Sub Class_Initialize()
Debug.Print "あめんぼ赤いな"
If Me.strValue = "" Then
Debug.Print "エラー!"
End If
End Sub
Private Sub Class_Terminate()
Debug.Print "あいうえお"
End Sub
例えば、以下の様なJavaのソースファイルでも
public class Test {
public Test() {
System.out.println("コンストラクタ");
}
public void doPhpSpot() {
//ここでは何もしない
}
}
上のコマンドで
public class Test {
public Test() {
System.out.println("コンストラクタ");
}
public void doPhpSpot() {
//ここでは何もしない
}
}
あらキレイ!
svn ci -m "lang/LanguageName/BigProjectName: Commit messege."
svn ci -m "lang/LanguageName/misc/ScriptName: Commit messege."
svn ci -m "dotfiles/SoftwareName/Username-Filename: Commit messege."
を守ってcommit時にファイル名を一覧しました。
lang/LanguageName/BigProjectName,
lang/LanguageName/misc/ScriptName,
dotfiles/SoftwareName/Username-Filename:
Added.
といった書き方をされていました。
URL : http://host/root/path/to/dir
Repository Root : http://host/root
という部分の2行の差、「path/to/dir」を取得し、svn commit実行時にエディタに表示されている
--This line, and those below, will be ignored--
A docs
A docs/file1.txt
A docs/file2.txt
A docs/file3.txt
のファイル名部分の先頭に上記フォルダ「path/to/dir」を付与し
path/to/dir/docs,
path/to/dir/docs/file1.txt,
path/to/dir/docs/file2.txt,
path/to/dir/docs/file3.txt:
というコメントを生成します。
path/to/dir/docs,
path/to/dir/docs/file1.txt,
path/to/dir/docs/file2.txt,
path/to/dir/docs/file3.txt:
--This line, and those below, will be ignored--
A docs
A docs/file1.txt
A docs/file2.txt
A docs/file3.txt
という画面が現れます。カーソルも":"の次の行に移動しますので、そこからコメントを書くと事が出来ます。
"=============================================================================
" File: svn_file_comment.vim
" Author: Yasuhiro Matsumoto <mattn.jp@gmail.com>
" Last Change: Fri, 12 Oct 2007
" Version: 0.1
"-----------------------------------------------------------------------------
" when editing comment for 'svn commit',
" it append svn comment like following
"
" root/path/to/dir/docs,
" root/path/to/dir/docs/file1.txt,
" root/path/to/dir/docs/file2.txt,
" root/path/to/dir/docs/file3.txt:
" <= cursor
" --This line, and those below, will be ignored--
" A docs
" A docs/file1.txt
" A docs/file2.txt
" A docs/file3.txt
"-----------------------------------------------------------------------------
function! AppendCommitFiles()
let lstart = search("^--", "n")
let lend = line("$")
if line(".") > 1 || lstart != 2
return
endif
let oldlang=$LANG
let $LANG="C"
let lines=system("svn info")
let $LANG=oldlang
let url=substitute(lines, '.*\nURL: \([^\x0A]*\).*', '\1', '')
let root=substitute(lines, '.*\nRepository Root: \([^\x0A]*\).*', '\1', '')
if match(url, root) != 0
return
endif
let basedir=substitute(strpart(url, strlen(root)), '^\/*', '', '')
let lcur = lstart
let lines = ""
let mx = '^\s*[A-Z]\s\+\([^$]\+\)$'
while lcur <= lend
let line = getline(lcur)
if line =~ mx
let lines .= basedir."/".substitute(line, mx, '\1', '')."\<NL>"
endif
let lcur = lcur + 1
endwhile
let lines = substitute(lines, '\n.', ',&', 'g')
let lines = substitute(lines, '\n$', ':&', '')
call cursor(0)
let value = getreg("a")
let type = getregtype("a")
call setreg("a", lines, "c")
execute 'normal! "ap'
call setreg("a", value, type)
silent! /^$
endfunction
autocmd FileType svn call AppendCommitFiles()
例によって、このソースもCodeReposのコノ辺に置く予定です。このブログを応援する