Question

So, I've just installed the zen-coding.vim plugin and expansions aren't happening. The plugin is there if I do scriptnames, and :verbose map shows the ZenCoding mappings. However, if I edit an html file (or set ft=html) and type

h1#title

Nothing happens. I am sure my .vimrc is hosed, but I am a bit new to the vim world so I am struggling finding out what I've messed up. My vim setup is here. I am on Mac OSX and I am using pathogen to bundle my plugins.

Anyone have any suggestions?

Thanks, Glenn

Output of :set rtp

runtimepath=~/.vim,~/.vim/bundle/IndexedSearch,~/.vim/bundle/gist,~/.vim/bundle/jquery,~/.vim/bundle/nerdtree,~/. vim/bundle/snipmate.vim,~/.vim/bundle/textile.vim,~/.vim/bundle/vim-align,~/.vim/bundle/vim-cucumber,~/.vim/bundle/ vim-fugitive,~/.vim/bundle/vim-git,~/.vim/bundle/vim-haml,~/.vim/bundle/vim-markdown,~/.vim/bundle/vim-rails,~/.vim /bundle/vim-repeat,~/.vim/bundle/vim-ruby,~/.vim/bundle/vim-ruby-debugger,~/.vim/bundle/vim-shoulda,~/.vim/bundle/v im-supertab,~/.vim/bundle/vim-surround,~/.vim/bundle/vim-tcomment,~/.vim/bundle/vim-vividchalk,~/.vim/bundle/zencoding-vim,/Applications/MacVim.app/Contents/Resources/vim/vimfiles,/Applications/MacVim.app/Contents/Resources/vim/ru ntime,/Applications/MacVim.app/Contents/Resources/vim/vimfiles/after,~/.vim/bundle/snipmate.vim/after,~/.vim/after

Was it helpful?

Solution

I got it working by putting this in my .vimrc:

let g:user_zen_expandabbr_key = '<c-e>' 
let g:use_zen_complete_tag = 1

(I used <c-e> instead of the default mostly because that's what I'm used to from using other editors with Zen Coding)

P.S. For me, Sparkup wasn't really an option since one of my favorite features of zen coding is the "wrap in abbreviation" which Sparkup doesn't support (yet).

OTHER TIPS

It seems that Pathogen doesn't explicitly include the "after" directories found within plugins that you place in your "bundle" directory. What this means is that plugins such as zen-coding and snipMate fail to run their initialization/cleanup/key binding routines.

Apparently these plugins have worked fine for other folks in other environments, but for me in Windows, snipMate wouldn't work because the final snippet loading command in the "after" directory was not sourced.

I fixed this in pathogen.vim by amending the pathogen#runtime_append_all_bundles() function to explicitly append all "after" directories found within bundle directories.

Here is a patch for pathogen.vim version 1.2:

121c121,125
<       let list +=  [dir] + pathogen#glob_directories(dir.sep.name.sep.'*[^~]')
---
>       let subdirs = pathogen#glob_directories(dir.sep.name.sep.'*[^~]')
>       let list += [dir]
>       for subdir in subdirs
>         let list += [subdir] + pathogen#glob_directories(subdir.sep.'*after*')
>       endfor

BIG EDIT: After coming across this closed issue on the Pathogen github site, I discovered that the root cause was not that the "after" directories needed to be added explicitly, but that they were not being added because of a backslash escaping issue on win32 systems in the substitute() command.

Here is a much more concise patch, and in unified format this time, sorry...

@@ -116,7 +116,8 @@
   let list = []
   for dir in pathogen#split(&rtp)
     if dir =~# '\<after$'
-      let list +=  pathogen#glob_directories(substitute(dir,'after$',name.sep.'*[^~]'.sep.'after','')) + [dir]
+      let replacement = substitute(name.sep.'*[^~]'.sep.'after', '\\', '\\\\', 'g')
+      let list +=  pathogen#glob_directories(substitute(dir,'after$',replacement,'')) + [dir]
     else
       let list +=  [dir] + pathogen#glob_directories(dir.sep.name.sep.'*[^~]')
     endif

The reporter of the github issue said that they sent Tim a pull request, and Tim said he accepted it, but the described change isn't in the current version of the code, so I thought I would do what I could to provide my solution here.

This patch escapes any backslashes in the glob. There shouldn't be any backslashes in any of the runtime path items on non-win32 systems in the first place, or if there are it is because +shellslash is set in vim and this escaping is probably required.

I'm leaving the old solution up there for reference.

I had to chmod +x sparkup's support script to make it work. Does Vim give you some error message?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top