3 #copyright(c) 29/06/2006 arrowworld@gmail.com
4 #use: enhance my vim, implement remote server, and use tab
7 GEO
="-geom 106x37+0+25"
10 #hostname will change to uppercase
11 #V_SERVERNAME="`hostname`"
12 if [ "$1" = "" ]; then
13 echo "check parameter please"
18 V_SERVERNAME
=`echo "$V_SERVERNAME" | tr "a-z" "A-Z"`
19 V_REMOTE_TAB_SILENT
="--remote-tab-silent"
20 #set to empty if you do like it
21 #V_REMOTE_TAB_SILENT=""
24 V_NEED_WAIT
="`$V_EXEFILE --serverlist | grep "$V_SERVERNAME" | grep -v grep`"
25 #test for go on if has error
27 V_HAS_ERROR
="$V_SERVERNAME"
28 if [ "$V_NEED_WAIT" = "" ]; then
34 #set -- `getopt "ks" "$@"`
35 set -- `getopt "ks" "$@"`
41 -s) #silent, do not echo msg when open a file
45 #delete this parameter
51 #----------function open file with editor
52 function arrow_change_dir
()
54 if [ "$V_HAS_ERROR" != "" ] && [ "$V_KEEP_DIR" != "YES" ]; then
56 "$V_EXEFILE" --servername "$V_SERVERNAME" --remote-send ":lcd $V_CURRENT_DIR<CR>:<CR>"
57 echo "send lcd success"
60 function arrow_openfile
()
62 #first parameter is the filename
63 if [ "$V_KEEP_QUIET" != "YES" ]; then
64 echo -e "server open: ${CL_GREEN}$1${CL_END}"
66 "$V_EXEFILE" $GEO --servername "$V_SERVERNAME" "$V_REMOTE_TAB_SILENT" "$1" 2>/dev
/null
69 if [ "$V_NEED_WAIT" != "$V_SERVERNAME" ]; then
71 #arrow_change_dir #now change dir at init
73 #check open gvim success, bcs remote used with x server only
74 V_HAS_ERROR
="`$V_EXEFILE --serverlist | grep "$V_SERVERNAME" | grep -v grep`"
76 #----------function end
78 #remove it for a while, we can use {EXE} -g {FILENAME} to open files
80 #check parameter at first, echo err msg if is empty
81 if [ "$1" = "" ]; then
82 echo "arrow: make sure has file name -_-"
83 arrow_openfile
"/tmp/tmp"
87 #now open file with loop
88 echo -e "server name: [${CL_YELLOW}$V_SERVERNAME${CL_END}]"
92 #check err no, ask for go on
93 #check if here does not exists a xserver, ask for continue
94 if [ "$V_HAS_ERROR" = "" ]; then
95 echo "ERROR: here may do not exists a x server"
96 echo -n "->Question: do you want open rest files(y,n) "
98 if [ "$V_SHOULD_EXIT" != "y" ]; then
99 echo "END: check your xserver"
105 #revert wait variable
106 if [ "$V_NEED_WAIT" != "$V_SERVERNAME" ]; then
107 V_NEED_WAIT
="$V_SERVERNAME"
110 #arrow_change_dir #change current dir for every file to local
116 # v1.0 create open gvim server with remote command
117 # v1.1 fix can not open multi files, set current dir for new file
118 # v1.2 fix open file will wait every time when exec "ge"
119 # UP: ask for to open rest files when can not open xserver
120 # and do not send lcd command when open xserver fail