From: Jeff Rose Date: 2006-05-29T09:30:20+09:00 Subject: Re: Automatic code generation in vim. Minkoo Seo wrote: > I've tried snippet magic, but I can't figure out how to use. As an example, > when I type 'forin' it expands like > > for element in collection > element. > end > > and my cursor is at 't' of 'element*t*'. And the status of vim is > command-mode. > (The mode after key is pressed) > > Now, what I have to do? Because my cursor is at 't' of 'element', I can't > change > the name of element using 'cw'. I just stuck. Hmmm. This has been one of the most frustrating things about this thing. For some it works just fine, and others it falls on its face. I don't know if it has to do with vim versions, preset mappings or what. One problem is that since the ruby bindings are so minimal many commands on the buffer have to be done by passing vim-script through ruby. I think this makes it susceptible to mappings and a mess of other junk, as opposed to a true binding that would have ruby methods directly operating on the buffer. Anyway... What should happen in this case is that 'element' should be highlighted in select mode. (Highlight something in visual mode and type -g) When you type it will change the word to whatever variable name you want, and when you hit tab it will automatically update the mirrors of that element, which in this case means the variable in the body. The idea is that you tab through the snippet, editing the important bits and tab jumping to where you want to be next. Once the term is over at the end of this month I'll get more serious about this again. -Jeff