NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
Refactored (Score:1)
Note that you're duplicating the filetype detection there, twice. The standard
$VIMRUNTIME/filetype.vimdefines an autocommand such that starting to edit a file matchingsvn-commit*.tmpwill trigger a FileType event forsvn. As you've got it set up, making a commit causes these steps to run:.vim/ftplugin/svn.vimis run (because you have filetype plug-ins enabled), which in your case defines a function.svn.vimhas just defined.svn-commit.tmp.If in step 1 you just run the commands immediately in
svn.vimrather than defining a function then you can get rid of step 2 entirely. And the check in step 3 is unnecessary, sincesvn.vimonly runs at all if the filename matches.So this can be refactored quite a bit. Also:
fnamemodify()can do the filename manipulation.startinsert!but with the exclamation mark conveniently puts the cursor at the end of the line, which is more robust than having to track how many lines and characters you've inserted.Putting all that together, I think you can just have the following in
.vim/ftplugin/svn.vim:However, neither your nor my version actually seems to do the right thing! It seems that
svn commitchanges to the directory of the file being committed, which messes upgetcwd()for commits in subdirectories. So it looks like parsingsvn infowill be needed, unfortunately.Reply to This