I am relatively new to linux. I am connecting to a remote linux machine sometimes via telnet and sometimes via NX client for windows. When I connect via telent I would like the default editor to be vim, and when I connect via NX I would like the default editor to be gvim. Is there a way to automatically detect which connection I am using when the alias file is sourced? Right now I have the following in my alias file:
alias usevim 'setenv CSCOPE_EDITOR vim; setenv EDITOR vim' alias usegvim 'setenv CSCOPE_EDITOR gvim; setenv EDITOR gvim' echo 'using vim' usevim
This sets the default editor to vim. When I connect via NX, the first thing I will do is type 'usegvim'. I would like to not have to do this every time! Is there a way to detect whether a display is present or not?
UPDATE: if($?DISPLAY) doesn't work because my .cshrci file has a line with "setenv DISPLAY ..."
UPDATE: I am now using cygwin to ssh into the remote box and using Cygwin XWin Server to display my gui apps. Now I don't need to worry about which editor to use because gvim is always available. I will probably ditch NX client because everything I need can now be launched directly from the command line and gui apps work just like native windows apps.