简体   繁体   English

在Mac上没有vimrc,gvimrc和.vim

[英]No vimrc, gvimrc and .vim on mac

There are no .vimrc , .gvimrc files and .vim/ directory on my mac, and so I can't install any script. 我的Mac上没有.vimrc.gvimrc文件和.vim/目录,因此我无法安装任何脚本。 And when I create a folder .vim/ and .vim/plugin and paste any script in there, it doesn't work. 当我创建一个文件夹.vim/.vim/plugin并将任何脚本粘贴到其中时,它不起作用。 Sorry for my english. 对不起我的英语不好。

You must create those files and folder yourself: 必须自己创建这些文件和文件夹:

  1. Open Terminal.app (found under /Applications/Utilities/ ). 打开Terminal.app(位于/Applications/Utilities/ )。

  2. At the prompt, a $ , type each of these lines followed by <Enter> (don't type the $ ): 在提示符$ ,键入以下各行,然后按<Enter> (不要键入$ ):

     $ touch .vimrc $ touch .gvimrc $ mkdir .vim $ open .vim 
  3. At this point, the ~/.vim folder is open in a new Finder.app window. 此时, ~/.vim文件夹在新的Finder.app窗口中打开。

But I'd respectfully suggest you to get accustomed to the command-line and Vim's basics before rushing to install plugins. 但是我谨建议您着急安装插件之前先熟悉命令行 Vim的基础知识。

EDIT 编辑

You didn't follow the instructions, no wonder the plugin doesn't work. 您没有按照说明进行操作,难怪该插件无法正常工作。

You have to move cvim.zip into ~/.vim and run the command $ unzip cvim.zip in the terminal. 您必须将cvim.zip移至~/.vim并在终端中运行命令$ unzip cvim.zip Read the instructions more carefully and don't let Safari expand archives automatically. 请更仔细地阅读说明,不要让Safari自动扩展档案。

Now that you have ~/.vim/c , here is what you should do to go forward. 现在您有了~/.vim/c ,这是您应该继续进行的操作。

Supposing your ~/.vim is empty (beside your ~/.vim/c ), move the whole content of ~/.vim/c into ~/.vim . 假如你的~/.vim是空的(你的身边~/.vim/c的全部内容移到~/.vim/c~/.vim After this operation, your ~/.vim folder should look like that: 完成此操作后, ~/.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/c and start Vim. 完成后,删除~/.vim/c并启动Vim。 The plugin should be installed and working. 该插件应已安装并且可以正常工作。

If your ~/.vim folder is not empty (say it already has a bunch of folders and files like ~/.vim/color , ~/.vim/syntax , whatever…) you'll have to move manually each subfolder/file from ~/.vim/c to the right place in ~/.vim . 如果~/.vim文件夹不为空(例如,它已经有很多文件夹和文件,如~/.vim/color~/.vim/syntax等等),则必须手动移动每个子文件夹/文件从~/.vim/c在正确的地方~/.vim

ENDEDIT 结束编辑

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. 更新:不幸的是,在OSX El Capitan上,即使通过sudo也无法编辑此文件。 So back to user-based versions in ~/.vimrc 回到〜/ .vimrc中基于用户的版本

A different approach would be as instructed by tim pope in the reference i gave copy to your command line/terminal.app: 我将副本复制到您的命令行/terminal.app中的参考文献中的tim pope所指示的是一种不同的方法:

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 curl is not working try wget -O - ~/.vim/autoload/pathogen.vim put 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/中,并且不要忘记在安装后在vim中:call pathogen#helptags()来生成文档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM