Explorar el Código

Fixed an oversight that would cause an infinite loop

Simon Watson hace 1 año
padre
commit
32951da5f0
Se han modificado 1 ficheros con 11 adiciones y 11 borrados
  1. 11 11
      bashrc/bashrc-all

+ 11 - 11
bashrc/bashrc-all

@@ -1,3 +1,5 @@
+# -*- shell-script-mode -*-
+
 if [ -f ~/.wal_alias ]; then
 	. ~/.wal_alias 
 fi
@@ -12,7 +14,6 @@ if [ -f ~/.cache/wal/sequences ]; then
     $CAT_PATH ~/.cache/wal/sequences
 fi
 
-export EDITOR=$(which vim)
 
 BPYTOP_PATH=$(which bpytop)
 BTOP_PATH=$(which btop)
@@ -65,16 +66,15 @@ fi
 # Stop myself from opening vim when I mean to open emacs on the term
 vim()
 {
-	if command -v emacs;
-	then	
-		if [[ $(ps aux | grep -v grep | grep emacs) ]];
-		then
-		    # using anemic term/color/etc as it's faster in emacs
-		    TERM=tmux emacsclient -nw $1
-		    
-		else
-		    vim $1
-		fi	
+	if [[ $(ps aux | grep -v grep | grep emacs) ]];
+	then
+		# using anemic term/color/etc as it's faster in emacs
+		TERM=tmux emacsclient -nw $1
+		export EDITOR="emacsclient"
+	else
+		VIM_PATH=$(which vim)
+		$VIM_PATH $1
+		export EDITOR=$VIM_PATH
 	fi
 }