cansafa26 / zen-coding

Automatically exported from code.google.com/p/zen-coding
0 stars 0 forks source link

Vim support? #16

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Vim support of this would be quite cool :)

Original issue reported on code.google.com by litt.fir...@gmail.com on 27 Sep 2009 at 9:51

GoogleCodeExporter commented 8 years ago
I miss this feature too

Original comment by frederic...@gmail.com on 7 Oct 2009 at 12:13

GoogleCodeExporter commented 8 years ago
OK, see what I can do. Can someone point me to the good resource about 
extending vim with Python for 
newbies? I never worked with vim.

Original comment by serge....@gmail.com on 7 Oct 2009 at 12:25

GoogleCodeExporter commented 8 years ago

Original comment by serge....@gmail.com on 7 Oct 2009 at 12:25

GoogleCodeExporter commented 8 years ago
there isn't really very many tutorials on this.
This was the best tutorial that I could find:
http://www.builderau.com.au/program/python/soa/Extending-Vim-with-Python/0,20000
64084,339283181,00.htm

I also wrote my own short vim script for python block commenting and I think 
it's a
simple example of how this would work in vim:
http://andre.smoenux.webfactional.com/blog/2009/sep/13/block-comenting-python-co
de-vim/

Before you start, I found a snippets vim script that basically does what your 
script
already does, and also supports various other really cool features. It's called
snipmate. Looks like it may be tough competition to beat that one, since it's 
already
quite feature full.
Snipmate for vim can be found here:
http://www.vim.org/scripts/script.php?script_id=2540

hope this helps.

Original comment by litt.fir...@gmail.com on 7 Oct 2009 at 1:01

GoogleCodeExporter commented 8 years ago
There's a similar project called Sparkup with extended syntax: 
http://github.com/rstacruz/sparkup
Vim support included

Original comment by serge....@gmail.com on 14 Oct 2009 at 4:49

GoogleCodeExporter commented 8 years ago
i'll have a try.
can we create a wiki page for the vim support? thanks

Original comment by frederic...@gmail.com on 14 Oct 2009 at 6:21

GoogleCodeExporter commented 8 years ago
I plan to refactor documentation in the near future. Maybe at that moment ZC 
will have Vim support 

Original comment by serge....@gmail.com on 14 Oct 2009 at 6:32

GoogleCodeExporter commented 8 years ago
Came here to ask for the same thing, though sparkup looks pretty good. Maybe 
combine
forces or something?

Original comment by gavin.gi...@gmail.com on 22 Nov 2009 at 1:39

GoogleCodeExporter commented 8 years ago
It looks like it'd probably be pretty easy to write a vim plugin for this.. You 
can
control the cursor and buffer directly using python. Look at
http://vimdoc.sourceforge.net/htmldoc/if_pyth.html. I've also attached the 
(hacked
together) beginnings of a plugin to do it, since you said you've not worked 
with vim.
It doesn't move the cursor or anything at the moment though.

Original comment by ryg...@gmail.com on 23 Nov 2009 at 1:03

Attachments:

GoogleCodeExporter commented 8 years ago
I made and attached a VIM script to expand abbreviation. Modified from TextMate 
the 
plugin.

It registers a shortcut Ctrl+L and only works in insert mode. When pressed, 
will expand 
the abbreviation and move the cursor to the first insertion point.

I hope that this script could be helpful.

Original comment by org.yi.d...@gmail.com on 1 Dec 2009 at 11:30

GoogleCodeExporter commented 8 years ago
Hi org.yi.dttvb,

I tried your script together with the most recent trunk of zencoding, but I had 
to
rename the call expand_abbr to expand_abbreviation and after that it did not 
throw
any error, but does nothing more than remove the last word from the current 
line.
Which version of zencoding do you use?

Original comment by boyerc...@gmail.com on 1 Dec 2009 at 12:00

GoogleCodeExporter commented 8 years ago
boyerchen,

I used zencoding library that comes with the TextMate plugin v0.3.1. It can be
downloaded from the front page. The filename is "Zen Coding for TextMate 
v0.3.1.zip".

I will try it with the most recent trunk and upload a modified script later.

Original comment by org.yi.d...@gmail.com on 1 Dec 2009 at 12:11

GoogleCodeExporter commented 8 years ago
Here is the script updated to work with the trunk.

Original comment by org.yi.d...@gmail.com on 1 Dec 2009 at 12:17

Attachments:

GoogleCodeExporter commented 8 years ago
Awesome, this works for me, too. Thanks a lot!

Original comment by boyerc...@gmail.com on 1 Dec 2009 at 12:22

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Hey, org.yi.dttvb.

Is this fully functional vim zen-coding plugin? If so, awesome. If not, what 
there is
and what there is not?

Original comment by mrejzlin on 2 Dec 2009 at 7:15

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
as I understand the source of this file should be pasted in .vimrc ,but where 
do I
place "zen coding for textmate" files?

Original comment by mrejzlin on 2 Dec 2009 at 7:25

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
svn checkout http://zen-coding.googlecode.com/svn/trunk/ zen-coding-read-only

then go to the zen-coding-read-only/python folder, just copy the "zen-coding" 
folder to 
the  path as  .vimrc's

Original comment by frederic...@gmail.com on 2 Dec 2009 at 9:23

GoogleCodeExporter commented 8 years ago
as now on, sparkup has more features than zen-coding's vim plugin
I use sparkup instead

Original comment by frederic...@gmail.com on 2 Dec 2009 at 9:26

GoogleCodeExporter commented 8 years ago
as of first lookup it seems that evething is ok.
Can somebody provide some test cases?

Original comment by mkTUMS on 2 Dec 2009 at 9:37

GoogleCodeExporter commented 8 years ago
To Comment 13 by org.yi.dttvb

Are there any special requirements for script to work?
After installing and trying to expand anything I get such output:

Error detected while processing function ZenCodingExpandAbbr:
line    2:
E319: Sorry, the command is not available in this version: ^Ipython << EOF
line    4:
E492: Not an editor command: import vim, os, sys, re
line    6:
E492: Not an editor command: sys.path.append (vim.eval('s:sfile'))
line    8:
E492: Not an editor command: from zencoding import zen_core
line   10:
E492: Not an editor command: cur_line = vim.current.line
line   11:
E492: Not an editor command: cur_index = vim.current.window.cursor[1]
line   12:
E492: Not an editor command: cur_line_num = vim.current.window.cursor[0] - 1
line   14:
E492: Not an editor command: already_placed = 0
line   15:
E492: Not an editor command: def get_insertion_point(text):
E486: Pattern not found: lre
line   17:
E121: Undefined variable: not
E15: Invalid expression: not already_placed:
line   48:
E171: Missing :endif

Original comment by smm...@gmail.com on 2 Dec 2009 at 10:31

GoogleCodeExporter commented 8 years ago
smmurf,

Your vim does not support Python interface. See:

http://vimdoc.sourceforge.net/htmldoc/if_pyth.html#python

Original comment by org.yi.d...@gmail.com on 2 Dec 2009 at 10:39

GoogleCodeExporter commented 8 years ago
I updated it a bit. I moved the Python code to a separate Python module, and 
added a 
"wrap" functionality.

Put zencoding folder and zencoding_vim.py to the same directory as the VIM 
script. 
(if you use ~/.vimrc, you should put these files and folders in your home 
directory. If 
you put the script somewhere else and :source it, put these in the same 
directory as 
the script)

I changed the key mapping a bit:

Ctrl+L on Insert Mode: Prompts for an abbreviation and insert it.
Ctrl+L on Visual Mode: Prompts for an abbreviation and then wrap with 
abbreviation
Ctrl+E on Insert Mode: Expand abbreviation (was ctrl+l on previous version, 
like 
TextMate which uses Command-E)
Tab on Insert Mode: Same as Ctrl+E, except that it inserts a tab if no 
abbreviation is 
found.

Of course you can customize the key mapping or even disable some. The key 
mapping codes are in the top of the file, followed by the main code.

2 attachments.

Original comment by org.yi.d...@gmail.com on 3 Dec 2009 at 5:22

Attachments:

GoogleCodeExporter commented 8 years ago
well, which one should be used? sparkup or zencoding.vim with python? (the 
problem
with the python vim script is that it requires vim to be compiled with python
support, and that isn't common on windows systems)

and if I understand right zencoding.vim uses textmates zen-coding files, which 
means
that it works with the official zencoding release, right? 

Original comment by mrejzlin on 10 Dec 2009 at 3:09

GoogleCodeExporter commented 8 years ago
I manage to run my vim with zen-coding (thanks org.yi.dttvb). It was pretty 
simple on
Ubuntu. I just had to figure out path to zencoding for svn, final command is:

svn co http://zen-coding.googlecode.com/svn/trunk/python/zencoding 

I haven't tested it enough yet, but I think that wrapping abbreviation is not
correct. When I watched screencast from Coda, it should wrap somthing like this:

home
contact
about

with this: ul>li
into this:

<ul>
<li>home</li>
<li>contact</li>
<li>about</li>
</ul>

But it is possible that I didn't do it correctly.

Original comment by sham...@gmail.com on 12 Jan 2010 at 2:09

GoogleCodeExporter commented 8 years ago
Use: ul>li*

Original comment by org.yi.d...@gmail.com on 12 Jan 2010 at 2:42

GoogleCodeExporter commented 8 years ago
Could anybody please compile some instructions on a wiki page?

I dont really understand what frederik.zou means here: 
http://code.google.com/p/zen-coding/issues/detail?id=16#c21

Maybe other people are asking the same questions themselves...

Thanks

Original comment by martinkl...@googlemail.com on 16 Jan 2010 at 6:56

GoogleCodeExporter commented 8 years ago
Sparkup is really nice, and seems very smart when using the "<" operator. IMHO 
you should really join your 
plugins together.
For the moment I will use Sparkup to work with MacVim, I will also wait for the 
official release of Zen Coding for 
Vim.
Thanks a lot for these wonderful plugins.

Original comment by peppecar...@gmail.com on 26 Jan 2010 at 10:09

GoogleCodeExporter commented 8 years ago
Could you please pack it as a vim tarball? If so, it will be more convenient 
for us.
Currently it's a little confusing about how to organize these dirs and files.

Original comment by visual...@gmail.com on 2 Feb 2010 at 3:06

GoogleCodeExporter commented 8 years ago
Issue 73 has been merged into this issue.

Original comment by serge....@gmail.com on 15 Feb 2010 at 12:35

GoogleCodeExporter commented 8 years ago
I'm new to vim . I really wonder how this script work ?

Original comment by nxqd3051...@gmail.com on 21 Feb 2010 at 6:21

GoogleCodeExporter commented 8 years ago
It looks like Matz started writing one about a month ago:
http://github.com/mattn/zencoding-vim

Original comment by dmond...@gmail.com on 11 Apr 2010 at 12:48

GoogleCodeExporter commented 8 years ago
Hey Sergey, there is some good info on the IBM site about writing plugins for 
vi/m. The url is huge (4 lines in this text field), so I used a shortener; 
http://bit.ly/gmgFvG will take you to the IBM search results page of 8 
documents containing lots of good info. While they specifically use perl script 
examples, they explain how it can be done the same way with other scripting 
languages including python.

I really hope that you can transform your original plugin to work with vim, as 
I really miss it's elegance while working on headless cli-only servers!

Thank you again for this extremely useful plugin! I use it with Komodo and 
Textmate and can't wait to use it with vim! :)

Jeff Hales (AKA QBass) <-- so you recognize me supporting your project in other 
places on the web. :))

Original comment by qbassist on 21 Dec 2010 at 10:24

GoogleCodeExporter commented 8 years ago
So how is the support for Vim going? I mean officially. All the third party 
scripts I've found either lack features, buggy or outdated and not working at 
all. The most updated one is the one by the Japanese dev, it has lots of bugs 
and the html output is very inconsistent.

Original comment by vim...@gmail.com on 29 Dec 2010 at 2:46

GoogleCodeExporter commented 8 years ago
No progress right now, because I never worked with vim so I don't even know how 
to do basic stuff in this editor :) But I can see how big vim community is, so 
at least I'll try when I'm done with v0.7 of Zen Coding

Original comment by serge....@gmail.com on 29 Dec 2010 at 12:33

GoogleCodeExporter commented 8 years ago
Oh, btw, if you'd want to know how to do basic stuff, there is a great link for 
you :) 
http://www.derekwyatt.org/vim/vim-tutorial-videos/vim-novice-tutorial-videos/

Just awesome screencasts.

I don't use vim often, but after watching these videos I'd try to dig in, and 
an absence of zen-coding is somewhat a stopper for me.

Original comment by kizmarh on 1 Feb 2011 at 5:20

GoogleCodeExporter commented 8 years ago

Original comment by serge....@gmail.com on 1 Feb 2011 at 10:49

GoogleCodeExporter commented 8 years ago
Что насчет Vim? Очень нужно! 
https://github.com/bingaman/vim-sparkup - неплохо, но очень 
уступает по функциональности.
Сергеи, пожалуиста, если будет время.
Заранее спасибо

Original comment by Andrey.S...@gmail.com on 17 May 2011 at 9:27

GoogleCodeExporter commented 8 years ago
Есть ещё http://www.vim.org/scripts/script.php?script_id=2981
Я сам с vim никогда не работал, поэтому мне 
сложно будет даже привыкнуть к нему сначала

Original comment by serge....@gmail.com on 17 May 2011 at 9:29