无法改变终端默认的编辑器 [英] Unable to change the default editor in terminal

查看:254
本文介绍了无法改变终端默认的编辑器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的默认编辑器是在我的服务器微微。我用Bash和Linux操作系统。

我试图改变Vim的是由

我的默认编辑器失败

 回声VIM> $ EDITOR

我怎样才能改变我的Vim默认编辑器?

以下code不工作的.bashrc

 导出编辑器=VIM


解决方案

添加

 导出编辑器= VIM

到.bashrc真的应该做的伎俩。 (有没有引号必要的,这取决于你使用的,他们可能是你的问题的原因是什么行情。)

您必须打开一个新的shell(或输入源的〜/ .bashrc 在提示符下)修改为的.bashrc修改生效之后。

什么是你想要的vim要启动的程序?

编辑:我没有用git的,但文件(<一个href=\"http://www.kernel.org/pub/software/scm/git/docs/git-commit.html\">http://www.kernel.org/pub/software/scm/git/docs/git-commit.html)读``编辑器用于编辑提交日志信息将从GIT_EDITOR环境变量,则core.editor配置变量,视觉环境变量,或EDITOR环境变量(按顺序)来选择。

因此​​,检查是否这些变量的设置:

 回声$ GIT_EDITOR $ VISUAL $ EDITOR
混帐配置--get-所有core.editor

对于我来说,

 出口VISUAL = VIM

解决了这个问题。

My default editor is pico at my server. I use Bash and Linux.

I tried to change Vim to be my default editor unsuccessfully by

echo vim > $EDITOR

How can I change Vim my default editor?

[edit]

The following code does not work in .bashrc

export EDITOR='vim'

解决方案

Adding

export EDITOR=vim

to your .bashrc should really do the trick. (There a no quotes necessary and, depending on what quotes you used, they may be the cause for your problem.)

You must open a new shell (or enter source ~/.bashrc at the prompt) after modifying .bashrc for the modification to take effect.

What is the program from which you want vim to be started?

EDIT: I haven't used git, but the documentation (http://www.kernel.org/pub/software/scm/git/docs/git-commit.html) reads ``The editor used to edit the commit log message will be chosen from the GIT_EDITOR environment variable, the core.editor configuration variable, the VISUAL environment variable, or the EDITOR environment variable (in that order).''

So check whether one of these variables is set:

echo $GIT_EDITOR $VISUAL $EDITOR
git config --get-all core.editor

For me,

export VISUAL=vim

solved the problem.

这篇关于无法改变终端默认的编辑器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆