Skip to content
This repository has been archived by the owner on Mar 5, 2020. It is now read-only.

Add completion #6

Merged
merged 3 commits into from
Dec 7, 2017
Merged

Add completion #6

merged 3 commits into from
Dec 7, 2017

Conversation

arp242
Copy link

@arp242 arp242 commented Nov 30, 2017

2017-11-30-011735_510x201_scrot

Is this something you'd be interested in adding?

This is a very quick implementation mostly copied from another plugin I made a few years ago, and doesn't quite work right; but it does show how the code would basically look like. I can finish it up if you'd like to add it.

Use <C-x><C-t> to start the completion.

@joereynolds
Copy link
Owner

There is a deoplete source already made here

https://github.com/joereynolds/deoplete-minisnip

Though maybe native completion would be better if it "just worked"

@arp242
Copy link
Author

arp242 commented Nov 30, 2017

There is a deoplete source already made here

Using Deoplete is more than a little overkill for such a small feature in such a small plugin :-)

Anyway, I'll finish this PR up later then 👍

@arp242
Copy link
Author

arp242 commented Dec 5, 2017

Alright; I finished it up. I changed the mapping to <C-x><C-t>, because <C-m> is the same as <CR>, which makes mapping both the enter key and <C-m> impossible (gotta love terminals...)

Use `<C-x><C-t>`
@joereynolds
Copy link
Owner

I'll look at testing this some time today. This means one less plugin for me to include (deoplete-minisnip), good work!

@joereynolds
Copy link
Owner

joereynolds commented Dec 6, 2017

If you do <c-x><c-t> with no word under the cursor it brings back an error

image

Is it possible to prevent the error from interrupting us?

Also, I've noticed that if I type a snippet and press <tab> it first adds a character and then when I press another key, only then does it expand the snippet

@arp242
Copy link
Author

arp242 commented Dec 6, 2017

Interesting; it works for me.

@arp242
Copy link
Author

arp242 commented Dec 6, 2017

Okay, I pushed an update which may fix it, but I wasn't able to reproduce that error.

Another thing that I should fix is that it should show pattern not found when there are no completions. An echo or echom get overriden, and won't be seen, So need to look in how to do that.

@joereynolds
Copy link
Owner

joereynolds commented Dec 7, 2017

Cool, that fixes the error message problem. I've managed to get a gif of me reproducing the completion bug with a minimal vimrc.

Notice that a stray p gets inserted when I press <tab>.
There's also the command yRMinisnip displayed in the bottom right

completion-minisnip

This seems to work better?
@arp242
Copy link
Author

arp242 commented Dec 7, 2017

The "p" is just some temporary output; it doesn't actually get inserted in the buffer. I noticed that too, but I just assumed it was a generic problem due to terminal escape code whatnot, but it seems this problem isn't present on master :-/ I changed the mapping from <Plug>Name to <Plug>(name), which seems to fix it for reasons I don't quite understand. Using (name) is more standard anyway, AFAIK. This also seems to fix things in the bottom-right? Not sure why that happened, either :-/

@joereynolds
Copy link
Owner

Works a treat!

@joereynolds joereynolds closed this Dec 7, 2017
@joereynolds joereynolds reopened this Dec 7, 2017
@joereynolds joereynolds merged commit 3c6338b into joereynolds:master Dec 7, 2017
@arp242
Copy link
Author

arp242 commented Dec 7, 2017

One small thing (sorry) can we add this to the docs?

I already added an entry for the mapping: https://github.com/joereynolds/vim-minisnip/pull/6/files#diff-e6ab5d74568837d50ee63e2c0c00b05fR42

Was there some other doc you would want to see?

BTW, I also want to fix the error when there are no matches; otherwise it's very confusing imho. I'll do that this evening.

@joereynolds
Copy link
Owner

Hey @Carpetsmoker

No other docs are needed (I think), great work on the prs so far! :D

joereynolds pushed a commit that referenced this pull request Nov 13, 2019
<CR> isn't the standard Vim mapping to accept the completion, <C-y> is.
This is just a personal preference that snuck in when I wrote the
completion (#6).

Fixes #42 and #43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants