Skip to content
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

Ambiguity of snippets keymap #99

Open
LittleNewton opened this issue Oct 16, 2023 · 1 comment
Open

Ambiguity of snippets keymap #99

LittleNewton opened this issue Oct 16, 2023 · 1 comment

Comments

@LittleNewton
Copy link

["<c-e>"] = cmp.mapping(
    function()
        cmp_ultisnips_mappings.compose { "expand", "jump_forwards" } (function() end)
    end,
    { "i", "s", --[[ "c" (to enable the mapping in command mode) ]] }
),

In autocomplete.lua, there is ambiguity.


Now I have a snippet:

snippet head "Head of Hexo Blogs"
title: ${1:title}
author: Peng Liu
cover: /images/`!p import os
base_name, _ = os.path.splitext(snip.fn)
snip.rv = base_name`/cover.png
date: `date +"%Y-%m-%d %H:%M:%S"`
tags:
	- ${2:tag}
categories:
	- ${3:type}
---

And another short snippet:

snippet aj "Markdown keyboard" i
<kbd>${1:key}</kbd>
endsnippet

The first snippet contains multiple placeholders.

In the first snippet instance, if I type aj with the intention of keyboard typing, the push of Ctrl e will have two different meanings:

  • expand aj
  • or jump-forward to the next placeholder.

I wanted it to take the expansion action but now it does nothing.

@theniceboy
Copy link
Owner

I see. I usually don't work on snippets within a snippet, but feel free to add another binding that's for expanding only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants