0

Like the subject, i found linux solution:

https://stackoverflow.com/a/8103835

but on windows this apparently doesn't work. When added file "c:\Program Files\Vim\vimfiles\snippets\javascript.snippets", all js snippets didn't work.

Community
  • 1
  • 1
xliiv
  • 5,399
  • 5
  • 29
  • 35
  • 1
    Please accept answers to your other questions (using the check mark next to the question score). – Benoit Jan 05 '12 at 09:07

2 Answers2

4

Ok there is a path issue on Windows or something because of this:

  1. my default variable (without ingerention to $myvimrc) g:snippets_dir is"C:\Documents and Settings\xliiv\vimfiles\snippets\,C:\Documents and Settings\xliiv\vimfiles\bundle\snipmate\snippets\" and both snippets (plugin and my defines) dosn't work.

but after setting it with additonal escapings in $myvimrc like this:

let g:snippets_dir="C:\\Documents and Settings\\xliiv\\vimfiles\\snippets,C:\\Documents and Settings\\xliiv\\vimfiles\\bundle\\snipmate\\snippets"

(the same as '1.' but with doubled '\') both WORKS perfect.

So my lateset WORKING line from $myvimrc is this: let g:snippets_dir="$HOME\vimfiles\snippets,$HOME\vimfiles\bundle\snipmate\snippets"

xliiv
  • 5,399
  • 5
  • 29
  • 35
  • Rather than hardcoding it, I'd rather let Snipmate set `g:snippets_dir` for me and then fix it - https://github.com/someboddy/vimConfig/blob/110128c10fb6cdd4fac9051fa368dd82001abc76/my-configurations/after/plugin/fix_snipmate_for_windows.vim – Idan Arye Mar 02 '14 at 11:50
3

It's not a good idea to store your plugins in c:\Program Files\Vim\vimfiles\, specially if your machine can be shared with other users. You should put them in C:\Users\[your name here]\vimfiles\.

Do you use SnipMate?

Assuming "yes" and since you appear to be using Pathogen, the correct location for SnipMate is C:\Users\[your name here]\vimfiles\bundle\snipmate.

Next time you edit a .js file all the default JavaScript snippets will be available.

Regarding the location of your snippets everything is explained in :help snipmate: if you have your own custom snippets you are supposed to put them under C:\Users\[your name here]\vimfiles\snippets\ which is their default location.

romainl
  • 186,200
  • 21
  • 280
  • 313
  • I moved c:\Program Files\Vim\vimfiles\ to C:\Users\[your name here]\vimfiles\ but if only i create C:\Users\[your name here]\vimfiles\snippets\ (with snippet file in there) all snippets stop working. – xliiv Jan 10 '12 at 07:12
  • There is a missing "\" after `Users` in C:\Users[your name here]\vimfiles\snippets\ and I hope you replaced `[your name here]` with your username. $HOME\vimfiles\snippets\ is SnipMate's default location for snippets: on Windows Vista/7 it's C:\Users\[your name here]\vimfiles\snippets\ and on Windows XP it's C:\Documents and Settings\[your name here]\vimfiles\snippets. – romainl Jan 10 '12 at 07:38
  • Dirs are correct. If i moved content of $HOME\vimfiles\bundle\snipmate\\* to (original path) $HOME\vimfiles\ all snippets worked. The problem is when there are snipmate plugin in bundle dir ($HOME\vimfiles\bundle\snipmate ) and snippets dir in vimfiles ($HOME\vimfiles\snippets ). No snippet works then. – xliiv Jan 10 '12 at 11:19