macos mac 上没有 vimrc、gvimrc 和 .vim

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11088292/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 09:16:09  来源:igfitidea点击:

No vimrc, gvimrc and .vim on mac

macosvim

提问by ratkke

There are no .vimrc, .gvimrcfiles and .vim/directory on my mac, and so I can't install any script. And when I create a folder .vim/and .vim/pluginand paste any script in there, it doesn't work. Sorry for my english.

我的 mac 上没有.vimrc,.gvimrc文件和.vim/目录,所以我无法安装任何脚本。当我创建一个文件夹.vim/.vim/plugin在其中粘贴任何脚本时,它不起作用。对不起我的英语不好。

回答by romainl

You mustcreate those files and folder yourself:

必须自己创建这些文件和文件夹:

  1. Open Terminal.app (found under /Applications/Utilities/).

  2. At the prompt, a $, type each of these lines followed by <Enter>(don't type the $):

    $ touch .vimrc
    $ touch .gvimrc
    $ mkdir .vim
    $ open .vim
    
  3. At this point, the ~/.vimfolder is open in a new Finder.app window.

  1. 打开 Terminal.app(在 下找到/Applications/Utilities/)。

  2. 在提示符 a 下$,键入以下每一行<Enter>(不要键入$):

    $ touch .vimrc
    $ touch .gvimrc
    $ mkdir .vim
    $ open .vim
    
  3. 此时,~/.vim文件夹在新的 Finder.app 窗口中打开。

But I'd respectfully suggest you to get accustomed to the command-line andVim's basics beforerushing to install plugins.

但我恭敬地建议您急于安装插件之前先习惯命令行Vim 的基础知识。

EDIT

编辑

You didn't follow the instructions, no wonder the plugin doesn't work.

你没有按照说明操作,难怪插件不起作用。

You have to move cvim.zipinto ~/.vimand run the command $ unzip cvim.zipin the terminal. Read the instructions more carefully and don't let Safari expand archives automatically.

您必须cvim.zip进入~/.vim$ unzip cvim.zip在终端中运行该命令。更仔细地阅读说明,不要让 Safari 自动扩展档案。

Now that you have ~/.vim/c, here is what you should do to go forward.

既然您已经有了~/.vim/c,这就是您应该做的事情才能继续前进。

Supposing your ~/.vimis empty (beside your ~/.vim/c), move the whole contentof ~/.vim/cinto ~/.vim. After this operation, your ~/.vimfolder should look like that:

假设你~/.vim是空的(你的旁边~/.vim/c),将全部内容~/.vim/c进入~/.vim。执行此操作后,您的~/.vim文件夹应如下所示:

+ ~/.vim
   + c <-- your folder
   + c-support
       + (many folders and files)
   + doc
       + csupport.txt
   + ftplugin
       + c.vim
       + make.vim
   + plugin
       + c.vim
   + README.csupport

When you are done, delete ~/.vim/cand start Vim. The plugin should be installed and working.

完成后,删除~/.vim/c并启动 Vim。该插件应该已安装并正常工作。

If your ~/.vimfolder is notempty (say it already has a bunch of folders and files like ~/.vim/color, ~/.vim/syntax, whatever…) you'll have to move manuallyeach subfolder/file from ~/.vim/cto the right place in ~/.vim.

如果你的~/.vim文件夹是不是空的(说它已经有一堆文件夹和文件等~/.vim/color~/.vim/syntax,无论...),你必须移动手动每个子文件夹/文件来自~/.vim/c于在正确的地方~/.vim

ENDEDIT

结束编辑

回答by juz

I found it on OSX Yosemite in /usr/share/vim/vimrc

我在 OSX Yosemite 的 /usr/share/vim/vimrc 中找到它

Update: Unfortunately on OSX El Capitan, this file is no longer editable even via sudo. So back to user-based versions in ~/.vimrc

更新:不幸的是,在 OSX El Capitan 上,即使通过 sudo 也无法再编辑此文件。所以回到 ~/.vimrc 中的基于用户的版本

回答by epsilonhalbe

A different approach would be as instructed by tim pope in the reference i gave copy to your command line/terminal.app:

一种不同的方法将按照 tim pope 在参考中的指示,我将副本复制到您的命令行/terminal.app:

mkdir -p ~/.vim/autoload ~/.vim/bundle; \
curl -so ~/.vim/autoload/pathogen.vim \
https://raw.github.com/tpope/vim-pathogen/master/autoload/pathogen.vim

also note if curlis not working try wget -O - ~/.vim/autoload/pathogen.vimput then into your .vimrc:

另请注意,如果curl不起作用,请尝试wget -O - ~/.vim/autoload/pathogen.vim放入您的.vimrc

call pathogen#infect()
syntax on
filetype plugin indent on

then unzip the plugin to ~/.vim/bundle/in a folder of your choice and don't forget to do :call pathogen#helptags()in your vim after the installation to generate the documentation.

然后将插件解压缩到~/.vim/bundle/您选择的文件夹中:call pathogen#helptags(),安装后不要忘记在 vim 中执行以生成文档。