From: Iain Patterson Date: Wed, 10 Jun 2009 13:27:10 +0000 (+0100) Subject: Perforce and SVN Vim script fixes. X-Git-Url: http://git.iain.cx/?a=commitdiff_plain;h=76559e10296433ab488b9d9940c50a39282ee49a;p=profile.git Perforce and SVN Vim script fixes. Check for existence of p4 script before setting $P4EDITOR. Work around weird bug whereby calling "file [p4 diff]" when in a directory with a subdirectory called ``d'' would confuse Vim. Removed old debugging code which shouldn't have been still there. --- diff --git a/.profile.d/p4.bashrc b/.profile.d/p4.bashrc index 7cdb1db..93627f1 100644 --- a/.profile.d/p4.bashrc +++ b/.profile.d/p4.bashrc @@ -1,4 +1,3 @@ -# $Id: p4.bashrc 151 2008-11-20 13:59:19Z iain $ if [ ! -z "$SUDO_USER" ]; then export P4USER=$SUDO_USER export P4TICKETS=/tmp/.p4tickets.$SUDO_USER @@ -7,7 +6,11 @@ else fi export P4CONFIG=.p4config export P4DIFF="diff -u" -export P4EDITOR="vim -S '$HOME/.vim/script/p4'" +if [ -e "$HOME/.vim/script/p4" ]; then + export P4EDITOR="vim -S '$HOME/.vim/script/p4'" +else + export P4EDITOR=vim +fi if [ -z "$DISPLAY" ]; then export P4MERGE="vim -o -c '3wincmd j' -c 'wincmd L'" else diff --git a/.vim/script/p4 b/.vim/script/p4 index f4f48dd..fe7f252 100644 --- a/.vim/script/p4 +++ b/.vim/script/p4 @@ -12,7 +12,7 @@ fun! P4submit() " Delete the spec blurb if it exists. /^# A Perforce Change Spec/,/^# *(New changelists only\.)$/d " If the blurb was deleted the text will be in the unnamed register. - if @" != "grgergregergeg" + if @" != "" " Delete the blank line left above the remaining fields. 1 delete @@ -57,6 +57,9 @@ endfun let s:cmdheight = &cmdheight set cmdheight=3 +" Change directory so "file [p4 diff]" doesn't try to cd somewhere. +cd / + " Call and then discard our function. call P4submit() delfunction P4submit diff --git a/.vim/script/svn b/.vim/script/svn index 0eedff1..175f4fb 100644 --- a/.vim/script/svn +++ b/.vim/script/svn @@ -33,6 +33,9 @@ endfun let s:cmdheight = &cmdheight se cmdheight=3 +" Change directory so "file [svn diff]" doesn't try to cd somewhere. +cd / + " Call and then discard our function. call SVNcommit() delfunction SVNcommit