Permalink
Browse files

Fixes

  • Loading branch information...
Aldis Berjoza
Aldis Berjoza committed Mar 27, 2013
1 parent 319c4f9 commit 48863ee73d3b01ce8e39dc4df4249e7184dab3b3
Showing with 36 additions and 13 deletions.
  1. +35 −12 bin/vim.sh
  2. +1 −1 dot.xinitrc
View
@@ -1,26 +1,49 @@
#!/bin/sh
+is_true() {
+ case "$1" in
+ [Tt][Rr][Uu][Ee])
+ return 0
+ ;;
+ [Ff][Aa][Ll][Ss][Ee])
+ return 1
+ ;;
+ *)
+ echo "must be TRUE or FALSE" > /dev/stderr
+ return 2
+ ;;
+ esac
+}
+
+is_false() {
+ is_true $1 && return 1 || return 0
+}
+
+
vim_app=`which vim`
+
if [ $? -eq 0 ]; then
[ "$WM" = 'fvwm' ] && wm_is_fvwm="true" || wm_is_fvwm="false"
+ app="$vim_app"
# vim server
if [ "$DISPLAY" != '' -a "$SSH_CLIENT" = '' ]; then
- vim_opt="-g"
+ gvim_app=`which gvim`
+ [ $? -eq 0 ] && app="$gvim_app"
- if is_true $wm_is_fvwm; then
- FvwmCommand 'Next ("*VIMS") MoveToDesk'
- FvwmCommand 'Next ("*VIMS") Raise'
- FvwmCommand 'Next ("*VIMS") Focus'
- fi
+ if is_true $wm_is_fvwm; then
+ FvwmCommand 'Next ("*VIMS") MoveToDesk'
+ FvwmCommand 'Next ("*VIMS") Raise'
+ FvwmCommand 'Next ("*VIMS") Focus'
+ fi
fi
- if [ "`$vim_app --serverlist`" = '' ]; then
- exec $vim_app -p -N $vim_opt --servername VIMS $*
+ if [ "`$app --serverlist`" = '' ]; then
+ $app -p -N --servername VIMS $*
elif [ "$1" != '' ]; then
- exec $vim_app -p -N $vim_opt --servername VIMS --remote-tab $*
+ $app -p -N --servername VIMS --remote-tab $*
else
- if is_false $wm_is_fvwm; then
- echo "vim is in other Desk or terminal" > /dev/stderr
- fi
+ if is_false $wm_is_fvwm; then
+ echo "vim is in other Desk or terminal" > /dev/stderr
+ fi
fi
fi
View
@@ -8,7 +8,7 @@ else
export WM="$DEFAULT_WM"
[ -f "$HOME/.last_wm" ] && WM="`cat "$HOME/.last_wm"`"
fi
-export GUI_EDITOR=gvim
+export GUI_EDITOR=vim.sh
export IMG_VIEWER=gpicview
export UTERM=urxvtc

0 comments on commit 48863ee

Please sign in to comment.