-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
One bug report and One confliction #43
Comments
Pasting from register * and + behave exactly the same typing very quickly. For the second question, I got the same error message with your snippet. It On Tue, Feb 25, 2014 at 8:01 AM, Jian Lan [email protected] wrote:
要了几天饱饭就不记得西北风啥味了 |
For the second question, it is only a copy and paste problem in my post. In my .vimrc, I'm pretty sure that I have the inoremap. The proof is: before applying xptemplate in *.c file, my snippet works and works well, no error messages. Only after applying one snippet of xptemplate and then apply my snippet again, two error messages show up. If delete that inoremap from that autocmd, I will get different error message like:
However, I notice, besides add inoremap, you also deleted from my autocmd, and you said you won't get error messages any more. This inspires me. I test no autocmd, and everything works good, even with xptemplate. You're right. Thank you! Now I know the problem origin from . However, I need that . Without it all buffers opened after a c program buffer will run this snippet, and add semicolon automatically. It shouldn't work like this. |
Hi! I have done more tests. I find something interesting: my snippet interact with xptemplate, and the results are different if applying different xptemplate snippets. If I use
Inside xptemplate main snippet, the error messages in my first post will be generated after typing in insert mode. Inside xptemplate struct snippet and enum snippet, type won't generate errors, but semicolon also won't be added automatically. When cursor jump to the last highlight area of these two snippet(just after the close brace }), type will generate error messages as inside xptemplate main snippet. If I delete , no error messages will be generated any more. However, inside xptemplate main snippet, type will generate semicolon and a wrong indent in the next line. Inside xptemplate struct snippet and enum snippet, type won't auto add semicolons to statements before cursor jump to the last highlight area. |
Xptemplate saves some key mapping during applying snippet, add some other is one of them that need to be remapped. But vim has problems retrieving key mapping information: it does not I see that newest vim supplies maparg() to retrieve complete information of autocmd FileType c,cpp,java inoremap :call This prevent the right-hand part of mapping to be recognised as And thank you a lot for tracing this issue that deep. On Tue, Feb 25, 2014 at 5:03 PM, Jian Lan [email protected] wrote:
要了几天饱饭就不记得西北风啥味了 |
I just pushed branch dist and branch master to github that should fix your Old version of vim still has the problem. On Thu, Feb 27, 2014 at 2:00 AM, dr-dr xp [email protected] wrote:
要了几天饱饭就不记得西北风啥味了 |
Thank you! My problem has been solved after this update in my vim 7.4. However, I have another question: my inoremap works well inside main snippet, while it doesn't work inside struct and enum snippets. You said "Xptemplate saves some key mapping during applying snippet". I think this is the reason. It works in some snippets contexts, and it doesn't work in some other snippets contexts. I just want to know how can I detect what kind of snippet contexts my cursor is in, and then I can make my inoremap work well in struct snippets. I also want to upgrade my AutoSemicolon() to AutoPunctuation() which can add "," automatically when in the enum snippet context. The snippet I posted before also had bugs. If ignore the case of "," of enum by now, after debugging, it should be like this:
The S at the end of this autocmd makes sure after mapping, there is a right indent in the new line. |
echo b:xptemplateData.renderContext.snipObject.name This way you can get the snippet name you are filling in to. echo b:xptemplateData.renderContext.phase This indicates where it is in process or finished. "fillin" means in the I hope this would help. On Thu, Mar 6, 2014 at 6:08 AM, Jian Lan [email protected] wrote:
要了几天饱饭就不记得西北风啥味了 |
Yes, they can help. Thank you! After testing I know when b:xptemplateData.renderContext.phase is "fillin" phase, my inoremap of doesn't work. It seems that I can't map when in "fillin" phase. Could you tell me how to get around of it(I tired to help myself and read the source code of xptemplate. Since I don't have experience of reading so much code, it's very hard for me)? |
Xpt remap cr before entering fillin phase. I am afraid that there is no way to get around. But I might add an callback for end user to do something before and after Xptemplate cr. like: What about this? 发自我的 iPhone
|
Could you explain how does it work. I don't quite understand what does that mean. |
I've pushed this patch to github. With the latest master or dist, the following line in .vimrc appends "abc"
And this appends current time every time pressed:
g:xptemplate_hook_before_cr does not accept . And if you want to use mapping with g:xptemplate_hook_before_cr , I hope this feature would help:) On Tue, Mar 11, 2014 at 7:44 AM, Jian Lan [email protected] wrote:
要了几天饱饭就不记得西北风啥味了 |
Thank you! I'm trying to play with it. It helps, but my snippet now doesn't work perfect. I still need to do some debug for my snippet. I'm also trying another way. I think, with the functions provided in you codes, I can try to make struct,
Semicolons autocomplete for every item in side struct, and press to generate another item with two parts of "data_type" and "member" and a semicolon at the end. If this finally works, since all the items and semicolons can be autocompleted, I can actually get around of the remap problem in most of the cases when I don't occasionally type the inside block by hand. I'm still working on it. |
"more..." defines an repetition. The placeholder "more..." also includes 4 {{ and }} defines body of repetition which includes another "more..." to On Thu, Mar 20, 2014 at 5:53 AM, Jian Lan [email protected] wrote:
要了几天饱饭就不记得西北风啥味了 |
Yes, I think this is what I want. |
My pleasure.:D On Mon, Mar 24, 2014 at 11:05 AM, Jian Lan [email protected] wrote:
要了几天饱饭就不记得西北风啥味了 |
I. When
let g:xptemplate_brace_complete=1
, paste from registers * and + wrong result will show up, for example: if I copy some text likegetline('.')[col('.') - 1]
with line end invisible symbol, which can be selected ifset list
, I will get(in two lines); if I virtual select an area without line end invisible symbol, I will get
getline(.'[ol(.') - 1]')
. Both are wrong. BTW, you can see a highlight marker inside the pasted text, which, I think, was generated by auto applying common.bracketcmpl.xpt.vim when pasting.II. It has been a long time for me not writing C-like code. So I write a vimscript function inside .vimrc to auto add semicolon to the end of non-blank line. My vimscript function is very simple and concentrates on adding semicolon only to the end of lines, because I know the non-line-end-semicolon, such as semicolon in structure(i = 0; i < len; i++) will be autocompleted by xptemplate. My function and map are like this:
However, I notice they conflict. Before trigger the first xptemplate snippet in a file, my code work well. After triggering a xptemplate snippet, when typing , I will get error messages:
Could you tell me how to solve this? And could you provide this kind of facility in the future version of xptemplate?
The text was updated successfully, but these errors were encountered: