简体   繁体   English

Windows上Vim中的SnipMate

[英]SnipMate in Vim on Windows

What is wrong with my install of snipMate? 我安装的snipMate有什么问题? I cannot get it to work. 我无法正常工作。 I even tried installing Pathogen as noted in the other answer. 我什至尝试按照其他答案中的说明安装Pathogen。 I am running vim7.4 on a windows XP. 我在Windows XP上运行vim7.4。 The _vimrc is noted below - _vimrc如下所示-

set nocompatible
set textwidth=80
set formatoptions=cqrol
set ts=2
set expandtab
set guifont:Courier_New:h8:cANSI
set backupdir=$temp
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin

filetype plugin on

autocmd BufEnter * setlocal cursorline cursorcolumn
hi cursorcolumn ctermbg=247 guibg=grey70
hi cursorline ctermbg=247 guibg=grey70            

call pathogen#infect()

The VIM install directory structure looks like below. VIM安装目录结构如下所示。 It is after I unzipped the snipMate.zip to vim74 folder. 我将snipMate.zip解压缩到vim74文件夹后。

c:\program files\vim\vim74
after/
autoload/
colors/
compiler/
doc/
ftplugin/
indent/
keymap/
lang/
macros/
plugin/
snippets/
spell/
syntax/
tools/
tutor/
README.txt
bugreport.vim
delmenu.vim
diff.exe*
evim.vim
filetype.vim
ftoff.vim
ftplugin.vim
ftplugof.vim
gvim.exe*
gvimext.dll
gvimrc_example.vim
indent.vim
indoff.vim
install.exe*
libintl.dll
macmap.vim
makemenu.vim
menu.vim
mswin.vim
optwin.vim
rgb.txt
scripts.vim
synmenu.vim
uninstal.exe*
uninstal.txt
uninstall-gui.exe*
vim.exe*
vimrc_example.vim
vimrun.exe*
vimtutor.bat*
xxd.exe*
.swp

I'm a Unix guy and don't know much about Windows, but try the following steps: 我是Unix人士,对Windows不太了解,但是请尝试以下步骤:

1) Per default pathogen searches in your personal folder ($HOME\\vimfiles\\bundle) and not in Vim's installation directory 1)默认的病原体搜索在您的个人文件夹($ HOME \\ vimfiles \\ bundle)中,而不在Vim的安装目录中

2) Put call pathogen#infect() at the top of your vimrc 2)call pathogen#infect()放在vimrc的顶部

3) Maybe try commenting out the two mswin lines, maybe they interfere somehow 3)也许尝试注释掉两个mswin行,也许它们以某种方式干扰了

4) Which snipmate did you use? 4)您使用了哪个狙击手? There is the old, unmaintained version from msanders (I still use this one) that has no depedencies and there is a fork by garbas that actually has dependencies 有一个从旧的,没有维护版本msanders (我仍然使用这一个),有没有depedencies并有一个叉通过garbas实际上具有依赖性

Okay finally problem solved. 好的,问题终于解决了。 After some reading and trial&error, I stumbled upon this question which did it. 经过一番阅读和反复试验后,我偶然发现了这个问题 The path separator slashes in the _vimrc are "\\" by default. _vimrc中的路径分隔符斜杠默认为“ \\”。 But they need to be "/". 但是它们必须为“ /”。 Thank you those who helped with their answers and comments. 谢谢那些为他们的答案和评论提供帮助的人。

The working _vimrc file is shown below - _vimrc工作文件如下所示-

"for pathogen
runtime ../vimfiles/bundle/vim-pathogen-master/autoload/pathogen.vim
execute pathogen#infect()
execute pathogen#helptags()

"for snipmate
let g:snippets_dir="$VIMRUNTIME/../vimfiles/bundle/sv-snippets/snippets"

set nocompatible
set textwidth=80
set formatoptions=cqrol
set ts=2
set expandtab
set guifont:Courier_New:h8:cANSI
set backupdir=$temp
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin

filetype plugin indent on
syntax on

autocmd BufEnter * setlocal cursorline cursorcolumn
hi cursorcolumn ctermbg=247 guibg=grey70
hi cursorline ctermbg=247 guibg=grey70    

Some notes about this _vimrc - 有关此_vimrc的一些说明-

  1. I call pathogen#helptags() in _vimrc because I am sure I shall forget it. 我在_vimrc中称为病原体#helptags(),因为我确定我会忘记它的。 I do not have too many plugins so this is not a problem. 我没有太多的插件,所以这不是问题。
  2. During the exercise I stumbled upon a way to locate pathogen in the bundle folder as well. 在练习中,我偶然发现了一种在捆扎文件夹中定位病原体的方法。 Thank you Ted Reed for this. 谢谢Ted Reed I haven't seen anybody talk about installing pathogen this way. 我还没有看到有人谈论过以这种方式安装病原体。 But it's great because now the install is not corrupted even with the pathogen files. 但这很棒,因为即使使用病原体文件,现在安装也不会损坏。
  3. I did not see any differences in the behavior if I comment out the mswin related statements. 如果我注释掉与mswin相关的语句,则在行为上没有任何区别。 But I left it in there because I do not completely know what they do and I have been using it this way for a longtime now without any issues. 但是我把它留在那儿是因为我不完全知道他们在做什么,而且我很长时间以来一直以这种方式使用它,而没有任何问题。

The directory structure I use - 我使用的目录结构-

c:\program files\vim\vim74 - vim install, given by $VIMRUNTIME
c:\program files\vim\vimfiles\bundle - plugins such as pathogen, snipmate
c:\program files\vim\_vimrc 

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

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