【问题标题】:SnipMate in Vim on WindowsWindows 上 Vim 中的 SnipMate
【发布时间】:2013-08-13 20:15:46
【问题描述】:

我安装的 snipMate 有什么问题?我无法让它工作。我什至尝试按照其他答案中的说明安装 Pathogen。我在 Windows XP 上运行 vim7.4。 _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()

VIM 安装目录结构如下所示。这是在我将 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

【问题讨论】:

  • Vim 7.4 实现了一个新的正则表达式引擎。可能是 snipMate 还没有准备好与这样的引擎一起使用。你用 Vim 7.3 试过 snipMate 吗?
  • 它不应该在 vim74 文件夹中。它应该在~/vimfiles
  • @danialepolencic 我用 Vim 7.2 试过了。
  • @FDinoff 你的意思是把 snipMate 提取的文件夹放在 ./vim74/vimfiles 中?
  • @shparekh 也许是时候问了。什么实际上不起作用?

标签: vim windows-xp vim-plugin snipmate


【解决方案1】:

我是 Unix 人,对 Windows 了解不多,但请尝试以下步骤:

1) 默认的病原体搜索在你的个人文件夹 ($HOME\vimfiles\bundle) 中而不是在 Vim 的安装目录中

2)call pathogen#infect()放在你的vimrc的顶部

3) 也许可以尝试注释掉这两条 mswin 行,也许它们会以某种方式干扰

4) 你用的是哪个 snipmate? msanders 有一个旧的、未维护的版本(我仍然使用这个),它没有依赖关系,garbas 的一个分支实际上有依赖关系

【讨论】:

  • 我手动创建了 c:\program files\vim\vimfiles\bundle\snipmate.vim 并将 msanders snipMate rev 0.83 解压到这个文件夹中。当然,这没有帮助。我将调用移到 vimrc 的顶部并删除了 mswin 行。
  • 不,据我所知,\program files\ 是安装软件所在的位置。 :echo $HOME .'\vimfiles' 应该给你正确的目录。
  • 实际上,$HOME 变量并没有指向 c:\"program files"\vim。但我将其更改为指向 vim 安装文件夹。但这没有帮助。
  • 您不应该将 $HOME 指向另一个目录,而是将您的插件放入它指向的目录中。 :echo $HOME .'\vimfiles 可能与%USERPROFILE%\vimfiles 相同。
【解决方案2】:

好的,问题终于解决了。经过一番阅读和反复试验,我偶然发现了this question,它做到了。 _vimrc 中的路径分隔斜线默认为“\”。但它们必须是“/”。感谢那些帮助他们的答案和 cmets 的人。

工作的 _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    

关于这个 _vimrc 的一些注意事项 -

  1. 我在_vimrc 中调用pathogen#helptags() 因为我确信我会忘记它。我没有太多插件,所以这不是问题。
  2. 在练习期间,我偶然发现了一种在捆绑文件夹中定位病原体的方法。谢谢Ted Reed。我还没有看到有人谈论以这种方式安装病原体。但这很棒,因为现在即使使用病原体文件,安装也没有损坏。
  3. 如果我注释掉与 mswin 相关的语句,我没有发现行为有任何差异。但我把它留在了那里,因为我不完全知道他们在做什么,而且我一直以这种方式使用它很长时间了,没有任何问题。

我使用的目录结构-

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 

【讨论】:

    猜你喜欢
    • 2023-03-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-10-17
    • 2014-01-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多