{"push_id":691871782,"size":2,"distinct_size":2,"ref":"refs/heads/master","head":"3740c248ee498220f3e7361b5e41023bd6cb2dbf","before":"e1e071ee606ab6b6fbfb9bf6100464ed031eacfd","commits":[{"sha":"0664b627e7390c7ab5b047ee5818801481d0f46c","author":{"email":"79e2475f81a6317276bf7cbb3958b20d289b78df@hurrell.net","name":"Greg Hurrell"},"message":"Vim: usher in a new era of autocompletion productivity\n\nSo, I'm using YouCompleteMe everywhere now, not just on my Mac, so I am\nexpecting to be doing a lot more autocompletion from here on. Time to\nfix some long-held grievances I have with the way autocompletion is\nworking with UltiSnips, YouCompleteMe and Supertab.\n\nHere's an example scenario.\n\nI have a snippet `log` that expands to `console.log();`, with a\nplaceholder inside the parens. Now, say I have a file with:\n\n   var fooBar = 1;\n\nand I type:\n\n    log<tab>\n\nUltiSnips puts me here:\n\n    console.log(|);\n                ^\n                (cursor here)\n\nIf I then type:\n\n    console.log(fooB<tab>);\n\nI wind up here:\n\n    console.log(fooB);|\n                      ^\n                      (cursor here)\n\nWhen what I really want is:\n\n    console.log(fooBar|);\n                      ^\n                      (cursor here)\n\nie. if Supertab _can_ complete something, I want it to, otherwise I want\nUltiSnips to get the tab.\n\nWith YouCompleteMe in the picture, the experience is even worse, because\nyou'll see the pop-up as soon as you start typing \"fooB\". Reflexively,\nyou'd think you could push `<Tab>` to expand the suggestion, but you\ncan't; you have to remember to push `<C-j>` or `<C-n>` or `<Down>` (ugh)\ninstead.\n\nHistorically, the way I've gotten YouCompleteMe and UltiSnips to play\nnicely is as described here:\n\n    http://0x3f.org/blog/make-youcompleteme-ultisnips-compatible/\n\nEffectively:\n\n- Override YouCompleteMe's default bindings, freeing up `<Tab>` and\n  `<S-Tab>`; set a new completion binding like `<C-j>` or something\n- Install Supertab and tell it to use the completion binding that you\n  just set up (in other words, pressing `<Tab>` will get \"forwarded\" to\n  the `<C-j>` or other binding that you set up for YouCompleteMe)\n- Tell UltiSnips to use `<Tab>` and `<S-Tab>` to do its thing\n\nSo, this works pretty darn well, except for the awkwardness described\nabove. In this commit, we make things better with a trick similar to the\none described here:\n\n  https://github.com/Valloric/YouCompleteMe/issues/36#issuecomment-15451411\n  [via http://stackoverflow.com/questions/14896327/ultisnips-and-youcompleteme]\n\nSpecifically:\n\n- Get rid of Supertab\n- Make a custom function that does the following when `<Tab>` is pressed\n  (note, the precedence here is different than in the linked examples):\n  - Try to expand a snippet\n  - If that doesn't work, try to cycle through completion options (if\n    the YouCompleteMe popup is visible) and otherwise try to jump to the\n    next UltiSnips placeholder\n  - If none of this works, just do a normal tab\n- Set up mappings for `<Tab>` and `<S-Tab>` that call this custom\n  function; note that these have to happen inside an autocommand in\n  order to overwrite the late-mapped default shortcuts set by\n  YouCompleteMe (although, as I write this, I think that may not be true\n  any more because I can select non-clashing mappings)\n- Get rid of `g:UltiSnipsJumpBackwardTrigger` so that it doesn't\n  overwrite our `<S-Tab>` mapping\n- Set up `<CR>` to accept completion; this gives us an easy way to break\n  out of an endless cycle when choosing YouCompleteMe completions inside\n  an  UltiSnips placeholder\n\nSome TODOs noted inline, but this basically works. It basically means:\n\n- `<Tab>` to cycle completions, `<S-Tab>` in reverse\n- `<Tab>` to expand snippets\n- `<Tab>` to jump between placeholders (for now `<S-Tab>` doesn't work\n  here, although I think I could make it do so; `<C-k> does work)\n- `<Enter>` to get out of completion mode (as noted inline, may need to\n  tap twice; not sure why, as the same happens with `<C-y>`)\n\nThis last behavior is a slight deviation from how Vim normally handles\nautocomplete mappings (see `:h ins-completion-menu`). Basically, it\nsometimes inserts newlines when you hit `<Enter>` during completion. I\nfind this annoying far more often than not, so I am happy to drop this\nbehavior in the name of progress.","distinct":true,"url":"https://api.github.com/repos/wincent/wincent/commits/0664b627e7390c7ab5b047ee5818801481d0f46c"},{"sha":"3740c248ee498220f3e7361b5e41023bd6cb2dbf","author":{"email":"79e2475f81a6317276bf7cbb3958b20d289b78df@hurrell.net","name":"Greg Hurrell"},"message":"Vim: further polish autocompletion handling\n\nThis commit depends on two new autocommands that I've added to my\nUltiSnips fork (and will submit an RFC PR for).\n\nThe enhancements are:\n\n- Don't let UltiSnips overwrite our mappings when it sets up inner\n  mappings; instead, listen for the autocommand and overwrite the\n  overwritten mappings\n- Ditto at boot, overwrite the default mappings that UltiSnips sets up\n  with our own, and make sure that UltiSnips' attempt to overwrite\n  Supertab's mappings doesn't overwite our overwrite\n- Additionally use the autocommands to reduce the scope of our `<CR>`\n  mapping; it will only take effect inside snippets now, leaving the old\n  default Vim behavior intact (ie. <Enter> actually can insert a newline\n  during completion)\n- Add some select-mode mappings for completeness\n\nOne bug noted inline: `<S-Tab>` isn't working yet.\n\nOne bug not noted inline: `<S-Tab>` still doesn't jump backwards among\nplaceholders.","distinct":true,"url":"https://api.github.com/repos/wincent/wincent/commits/3740c248ee498220f3e7361b5e41023bd6cb2dbf"}]}