`port edit`, local/console vs. remote use

Bradley Giesbrecht pixilla at macports.org
Wed Dec 7 19:31:00 CET 2016


> On Dec 7, 2016, at 1:26 AM, René J.V. Bertin <rjvbertin at gmail.com> wrote:
> 
> On Tuesday December 6 2016 11:41:39 Ryan Schmidt wrote:
> 
>> I haven't taken the time to look into how I could configure that. So instead, I configure EDITOR to run TextWrangler, and whenever I ssh in and need to edit a portfile, which is rare, I use 'vi $(port file someport)` instead of `port edit someport`. 
> 
> I often use `port edit --editor XX foo` when I don't want to use the default editor. Maybe the cleanest solution would be to add a short option equivalent of `port edit --editor vi`. I'd say `port edit -v` as a mnemonic, but that could cause confusion with the verbose option. 
> 
> Either way this could serve users like Ryan and me:
> 
> - A new MP_GUI_EDITOR variable contains the name of the preferred/GUI editor that cannot be used over ssh
> - `port edit` uses that value if available unless an option is given to override this choice
> - nothing else changes
> 
> VISUAL_EDITOR could be used instead of MP_GUI_EDITOR but we don't know how many people use that variable.
> 
> A possible suitable choice for the short option: -f, as in "force editing even if your usual editor isn't available". In that case the option could override all env. variables with the possible exception of VISUAL_EDITOR if that's a traditional variable also used outside of MacPorts.

I have this in .bash_profile:
...
if [ "${SSH_TTY+1}" ];then
    export EDITOR=nano
else
    export EDITOR=bbedit
 fi
...

echo $EDITOR
ssh localhost
echo $EDITOR


Regards,
Bradley Giesbrecht (pixilla)


More information about the macports-dev mailing list