Skip to main content
added 2 characters in body
Source Link

I realize you mentioned not to edit .bashrc. However, I hope this might help someone else. I have been looking for a good answer to a similar problem for many years. I like to use vi but don't want to change the default for everyone else.

Edit /etc/ssh/ssh_config in your local configuration and add the following line:

SendEnv EDITOR 

You can use any environment variable but EDITOR seems like a good choice. In my case EDITOR is set to vim.

In the remote system, edit /etc/ssh/sshd_config and add the following line:

AcceptEnv EDITOR 

Edit .bashrc or .bash_profile and add the following:

if [ $EDITOR"$EDITOR" = "vim" ]; then set -o vi; fi 

For the use case in this question, replace vi with emacs. Note: You might need to restart sshd in the target system.

I realize you mentioned not to edit .bashrc. However, I hope this might help someone else. I have been looking for a good answer to a similar problem for many years. I like to use vi but don't want to change the default for everyone else.

Edit /etc/ssh/ssh_config in your local configuration and add the following line:

SendEnv EDITOR 

You can use any environment variable but EDITOR seems like a good choice. In my case EDITOR is set to vim.

In the remote system, edit /etc/ssh/sshd_config and add the following line:

AcceptEnv EDITOR 

Edit .bashrc or .bash_profile and add the following:

if [ $EDITOR = "vim" ]; then set -o vi; fi 

For the use case in this question, replace vi with emacs. Note: You might need to restart sshd in the target system.

I realize you mentioned not to edit .bashrc. However, I hope this might help someone else. I have been looking for a good answer to a similar problem for many years. I like to use vi but don't want to change the default for everyone else.

Edit /etc/ssh/ssh_config in your local configuration and add the following line:

SendEnv EDITOR 

You can use any environment variable but EDITOR seems like a good choice. In my case EDITOR is set to vim.

In the remote system, edit /etc/ssh/sshd_config and add the following line:

AcceptEnv EDITOR 

Edit .bashrc or .bash_profile and add the following:

if [ "$EDITOR" = "vim" ]; then set -o vi; fi 

For the use case in this question, replace vi with emacs. Note: You might need to restart sshd in the target system.

Source Link

I realize you mentioned not to edit .bashrc. However, I hope this might help someone else. I have been looking for a good answer to a similar problem for many years. I like to use vi but don't want to change the default for everyone else.

Edit /etc/ssh/ssh_config in your local configuration and add the following line:

SendEnv EDITOR 

You can use any environment variable but EDITOR seems like a good choice. In my case EDITOR is set to vim.

In the remote system, edit /etc/ssh/sshd_config and add the following line:

AcceptEnv EDITOR 

Edit .bashrc or .bash_profile and add the following:

if [ $EDITOR = "vim" ]; then set -o vi; fi 

For the use case in this question, replace vi with emacs. Note: You might need to restart sshd in the target system.