macos mac os 中 ~\.vim 文件夹在哪里?以及如何在 gvim 中安装主题?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9239107/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
where is ~\.vim folder in mac os? and how to install themes in gvim?
提问by pythoniku
I downloaded color sample pack from http://vim.sourceforge.net/scripts/script.php?script_id=625
我从http://vim.sourceforge.net/scripts/script.php?script_id=625下载了颜色样本包
it says i should unzip and place it into ~/.vim but where is this folder? I tried unzip it to my usr/share/.vim folder but it is not working, I don't see themes added to gvim Edit>color scheme menu, and i tried "colorscheme sometheme", "color sometheme" in my gvimrc. Both not working for new themes
它说我应该解压缩并将其放入 ~/.vim 但这个文件夹在哪里?我尝试将它解压缩到我的 usr/share/.vim 文件夹,但它不起作用,我没有看到主题添加到 gvim Edit>color scheme 菜单,我在我的 gvimrc 中尝试了“colorscheme sometheme”、“color sometheme”。两者都不适用于新主题
Isn't the ~/.vim should be the .vim folder in use/share? or I should create a new folder under home?
~/.vim 不应该是使用/共享的 .vim 文件夹吗?或者我应该在 home 下创建一个新文件夹?
Note:there is a folder vim73 in my .vim, I guess this doesn't affect anything
注意:我的 .vim 中有一个文件夹 vim73,我想这不会影响任何事情
thanks for any help!
谢谢你的帮助!
回答by kev
First of all, open vim
, and get help from :help colorscheme
首先,打开vim
,并从:help colorscheme
:colo[rscheme] {name} Load color scheme {name}. This searches 'runtimepath'
for the file "colors/{name}.vim. The first one that
is found is loaded.
After reading the manual above. Take the following steps maybe help you:
阅读上面的手册后。采取以下步骤或许能帮到你:
find runtimepath
:set runtimepath?
It will print out run-time paths:
runtimepath=~/.vim,/usr/share/vim/vimfiles,/usr/share/vim/vim71,/usr/share/vim/vimfiles/after,~/.vim/after
create directory called
colors
under one of them if not exist(for example:~/.vim
)$ ls ~/.vim ls: cannot access /root/.vim: No such file or directory <== we need create it!!! $ mkdir -p ~/.vim/colors
copy your
color.vim
to yourcolors
directory$ cp /path/to/your/color.vim ~/.vim/colors
restart
vim
to use new colorscheme:colorscheme color
(optional) put command above to
~/.vimrc
file to make it permanent
找到运行时路径
:set runtimepath?
它将打印出运行时路径:
runtimepath=~/.vim,/usr/share/vim/vimfiles,/usr/share/vim/vim71,/usr/share/vim/vimfiles/after,~/.vim/after
创建一个名为目录
colors
下,他们中的一个,如果不存在(例如:~/.vim
)$ ls ~/.vim ls: cannot access /root/.vim: No such file or directory <== we need create it!!! $ mkdir -p ~/.vim/colors
将你的复制
color.vim
到你的colors
目录$ cp /path/to/your/color.vim ~/.vim/colors
重新启动
vim
以使用新的配色方案:colorscheme color
(可选)将上面的命令放入
~/.vimrc
文件以使其永久化
回答by romainl
In UNIX parlance, ~
represents your home folder which is /Users/<username>
in Mac OS X.
在 UNIX 中,~
代表您/Users/<username>
在 Mac OS X 中的主文件夹。
You are supposed to put all your custom scripts/colorschemes/whatever in a .vim
folder situated in your home folder. In Terminal.app, type each line (without the $
) then hit Enter:
您应该将所有自定义脚本/颜色方案/任何内容放在.vim
位于您的主文件夹中的文件夹中。在 Terminal.app 中,输入每一行(不带$
),然后按 Enter:
$ cd
to be sure you are in your home folder
确保你在你的主文件夹中
$ mkdir .vim
here you'll have an error message if ~/.vim
already exists; if you don't receive a message it means that the folder is created
如果~/.vim
已经存在,您将在此处收到错误消息;如果您没有收到消息,则表示该文件夹已创建
$ cd .vim
to move into it
进入它
$ open .
to open a Finder window here. At this point you should follow specific indications.
在此处打开 Finder 窗口。在这一点上,您应该遵循特定的指示。