norcalli / snippets.nvim

GNU General Public License v3.0
277 stars 13 forks source link

Remove "leftover" mappings #12

Closed pwntester closed 3 years ago

pwntester commented 4 years ago

Im configuring snippets.nvim as:

  vim.cmd [[ inoremap <silent><expr> <Return> pumvisible() ? "\<c-y>\<cr>" : "\<CR>" ]]
  vim.cmd [[ inoremap <silent><expr> <C-j> pumvisible() ? "\<C-n>" : "\<cmd>lua return require'snippets'.expand_or_advance()<CR>" ]]
  vim.cmd [[ inoremap <silent><expr> <C-k> pumvisible() ? "\<C-p>" : "\<cmd>lua return require'snippets'.advance_snippet(-1)<CR>" ]]

Which inverts the default mappings, that is c-j is used to expand or advance forward and c-k to advance backwards. That worked to expand the snippet, but once the float window was shown, the default behavior was still applied so c-j would go backwards and cancel the snippet expansion instead of advancing to second placeholder. I'm commenting out the lines I think should be removed.

Thanks!