-
-
Notifications
You must be signed in to change notification settings - Fork 691
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
Add JumpOrExpand support #1542
Add JumpOrExpand support #1542
Conversation
Thanks for your contribution! You understood correctly that the functionality is not there and I think your approach for implementing it is reasonable. This needs testing and update to the documentation. As for the documentation, you just change the doc/UltiSnips.txt - it is all manual. For testing see the Contributing document. |
I'm not a English native speaker so my expression may be unclear and vague(in this PR & in the documentation). In addition, I'm sorry that I don't know how to add a test because |
I am not a native speaker either, but your english seems excellent from all that I can tell. The documentation is very well like that, but this still needs a test, otherwise it likely will regress the functionality in the next refactor. I think you want to add a test in this file. The idea is that you use |
Absolutely great contribution. Thank you very much for this! |
CI Failures seem to relate to latest Git version, but have nothing to do with this change. Gonna merge. Thanks again for the contributions! |
Thank you very much! I was ever since missing this feature that e.g. neosnippet had and had to work around it by something like (using let g:ulti_expand_or_jump_res = 0
function! UltiSnips_ExpandableOrJumpable()
call UltiSnips#ExpandSnippetOrJump()
if g:ulti_expand_or_jump_res > 0
return ""
else
if pumvisible()
return "\<C-E>"
else
return "\<End>"
endif
endif
endfunction
inoremap <silent> <C-E> <c-r>=UltiSnips_ExpandableOrJumpable()<cr> |
From the commit itself it is not obvious to me what happens in case neither a jump nor expansion is possible. Does the mapping fall back to the default operation of the supplied key combo or to no operation? |
The first case, falling back to the default operation. For example if I set let g:UltiSnipsJumpOrExpandTrigger = "<Tab>" It'll jump or exapnd if it could, or it will send Tab. |
This is a very small improvement. As far as I know, we can not consider to jump forward instead of expanding snippets first if the expand trigger is as same as the jump forward trigger. So I introduce two new options
g:UltiSnipsExpandOrJumpTrigger
&g:UltiSnipsJumpOrExpandTrigger
to achieve this goal. If none of them is set, it'll still expand snippets first if two triggers remain same, or it'll map separately(that is, same as before, nothing broken).Besides, I'm wondering how to write the document. I'll appreciate if some one could help me improve the document with adding the introduction of these two new options.
I'm not familiar with this project that I may misunderstand something or make some mistakes. If so, please let me know! Any advice is welcome. Hopefully my PR could be accepted.