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

Snippet completion with <tab>? #69

Open
srsudar opened this issue Jul 3, 2018 · 5 comments
Open

Snippet completion with <tab>? #69

srsudar opened this issue Jul 3, 2018 · 5 comments

Comments

@srsudar
Copy link

srsudar commented Jul 3, 2018

I use UltiSnips for snippets in my markdown. By default I use <tab> to complete Snippets. That completion is no longer working with this plugin enabled.

I would have thought that was because <tab> here indents list items, but a few other things are going wonky on me as well--eg my autowrap at 80 is no longer working.

Before trying to track down potential vagaries in my configuration I was hoping to hear if you use snippets successfully, if your <tab> mapping only applies in the context of a bulleted list and otherwise should be unaffected, etc.

Any thoughts you might have would be much appreciated.

This looks great and I would love to get my config back to normal so I can use it without hiccups.

@srsudar
Copy link
Author

srsudar commented Jul 30, 2018

Aha, :verbose imap <tab> reveals the problem. The insert mode mappings override my existing <tab> trigger, and it looks like they don't pass on the keypress to the next function (no idea if this is possible or desirable in general), eg:

    inoremap <silent> <buffer> <script> <expr> <Tab>
      \ <SID>IsAnEmptyListItem() \|\| <SID>IsAnEmptyQuote() ? '<C-O>:call <SID>Indent(1)<CR>' : '<Tab>'

I can disable this with g:markdown_enable_insert_mappings = 0, but I would love to keep these very useful commands if possible. I don't know enough about vimscript to suggest good options I'm afraid.

@tachim
Copy link

tachim commented Apr 1, 2019

Hey @srsudar did you find any good workaround for this?

@srsudar
Copy link
Author

srsudar commented Apr 1, 2019

Hmm you know I do not remember. Apparently I use my own fork of the repo in my .vimrc, but I don't appear to actually have any diffs there. I think I was trying to get fancy with changing the bullet formatting, but in the end I found it too imperfect so I just turned it all off.

UltiSnips now works for me, I think due to this line in my .vimrc:

let g:markdown_enable_insert_mode_mappings = 0

I can't remember what I lost by enabling that, but I don't miss it.

@tachim
Copy link

tachim commented Apr 2, 2019

Thanks. Presumably what you lose is tab/shift-tab for indenting and un-indenting while in insert mode.

@unixdigest
Copy link

unixdigest commented Apr 1, 2020

This is also a problem with both supertab and if you use a custom function like these: https://vim.fandom.com/wiki/Smart_mapping_for_tab_completion

The solution provided by @srsudar solves the issue nicely.

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

3 participants