Browse Source

Fixed an oversight that would cause an infinite loop

Simon Watson 1 year ago
parent
commit
32951da5f0
1 changed files with 11 additions and 11 deletions
  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
 }