Use vim alias for P4EDITOR etc.
authorIain Patterson <me@iain.cx>
Fri, 26 Feb 2010 07:44:25 +0000 (07:44 +0000)
committerIain Patterson <me@iain.cx>
Fri, 21 May 2010 16:21:51 +0000 (17:21 +0100)
.profile.d/p4.bashrc

index 2850951..736d7e4 100644 (file)
@@ -8,18 +8,20 @@ fi
 export P4CONFIG=.p4config
 eval $(alias diff 2>/dev/null | sed 's/^alias diff/P4DIFF/')
 export P4DIFF="${P4DIFF:-diff} -u"
-P4EDITOR=vim
+eval $(alias vim 2>/dev/null | sed 's/^alias vim/p4vim/')
+p4vim=${p4vim:-vim}
+P4EDITOR="$p4vim"
 p4script=$(find_target_profile ".vim/script/p4")
-[ -n "$p4script" ] && P4EDITOR="vim -S '$p4script'"
+[ -n "$p4script" ] && P4EDITOR="$p4vim -S '$p4script'"
 export P4EDITOR
 if [ -z "$DISPLAY" ]; then
   p4script=$(find_target_profile ".vim/script/merge")
   if [ -n "$p4script" ]; then
-    export P4MERGE="vim -S '$p4script'"
+    export P4MERGE="$p4vim -S '$p4script'"
   else
-    export P4MERGE="vim -o -c '3wincmd j' -c 'wincmd L'"
+    export P4MERGE="$p4vim -o -c '3wincmd j' -c 'wincmd L'"
   fi
 else
   export P4MERGE="p4merge"
 fi
-unset p4script
+unset p4script p4vim