我在我的 Mac 上使用 coda 作为编辑器,并使用内置的 svn 客户端,这确实很有帮助。
但是它缺少文件的忽略功能,我正在尝试通过命令行来完成
通过终端,我转到要从中排除文件的文件夹并运行此命令“svn propedit svn:ignore database.php”。
结果我得到了这个
svn:环境变量 SVN_EDITOR、VISUAL 或 EDITOR 均未设置,也未找到“editor-cmd”运行时配置选项
请问我能得到一些帮助吗?
The svn propedit
or svn pedit
command requires an editor in order to work, and that's what your error message is telling you. You need to set up an environment variable that contains the name of the editor you want to use.
The Mac has several text editors that can work. Remember, you're not talking about things like TextEdit
, but terminal editors. For example, you can look at vim
, pico
, and emacs
. I prefer vim
, but that can be fairly difficult for a person who has never been exposed to it to understand. You can try pico
which is friendlier.
To set an environment variable in your shell, you'd do something like this:
$ EDITOR=pico; export EDITOR
What Subversion does is take the editors in the following order:
SVN_EDITOR
is set to. If this isn't set...VISUAL
is set to. If this isn't set...EDITOR
is set to. If this isn't set, you're in troubleMost of the time, you set your editor environment variable in your $HOME/.profile
file or if you're using bash, your $HOME/.bash_profile
file. This way, when you first log in, your editor will be set.
Another method is to edit the $HOME/.subversion/config
file to set your editor there. This will override your environment variable settings.
Take a look at that file, and you'll see a section like this:
### Section for configuring external helper applications.
[helpers]
### Set editor-cmd to the command used to invoke your text editor.
### This will override the environment variables that Subversion
### examines by default to find this information ($EDITOR,
### et al).
# editor-cmd = editor (vi, emacs, notepad, etc.)
You'll be changing that last line by removing the #
in front, and setting editor-cmd
to your favorite editor:
### Section for configuring external helper applications.
[helpers]
### Set editor-cmd to the command used to invoke your text editor.
### This will override the environment variables that Subversion
### examines by default to find this information ($EDITOR,
### et al).
editor-cmd = pico
If none of this makes sense to you, it's about time to learn a bit about the underlying Unix system that's at the heart of your Mac. You might want to look at Take Control of the Mac Command Line with Terminal as a first step. After that, I recommend to look at some of O'Reilly's BASH command shell books since that's what the Mac's shell defaults to.
I would also recommend you learn VI/VIM. This is an old editor first published by Bill Joy in 1976. Bill Joy would later be famous for founding Sun Microsystems and his work on NFS, Sparc, and Java. He also wrote the C Shell, but I'm willing to let that ride.
Anyway, this 37 year old editor is probably the most powerful programming editor ever invented (and don't listen to those EMAC people. They're just a cult group). It can be tough for a beginner, but once you've learned it, you'll find it fast, simple, and powerful.