vim - 如何使用 deoplete 下拉菜单自动展开 Neosnippet?

标签 vim neovim

我正在寻找一种配置 (init.vim) 以在使用 deoplete 插件下拉菜单选择时扩展 Neosnippet。

到目前为止我所做的:

  • 全部添加到 vim-plug
    call plug#begin ('~/.local/share/nvim/plugged')
    Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
    Plug 'Shougo/neosnippet.vim' | Plug 'Shougo/neosnippet-snippets'
    call plug#end ()
    
  • 配置为自动启动
    " Use deoplete.
    let g:deoplete#enable_at_startup = 1
    " Use smartcase.
    let g:deoplete#enable_smart_case = 1
    " Set minimum syntax keyword length.
    let g:deoplete#sources#syntax#min_keyword_length = 2
    

  • 这导致此屏幕:deoplug drop down selection

    现在我想扩展这个片段,当点击 <Enter> 时在选择。有没有人建议如何实现这一目标?

    感谢您的时间和最好的问候,

    贝费多

    最佳答案

    Neosnippets 不会自动扩展。您需要配置键映射。该项目建议使用 Ctr+k 扩展它们:

    " Plugin key-mappings.
    " Note: It must be "imap" and "smap".  It uses <Plug> mappings.
    imap <C-k>     <Plug>(neosnippet_expand_or_jump)
    smap <C-k>     <Plug>(neosnippet_expand_or_jump)
    xmap <C-k>     <Plug>(neosnippet_expand_target)
    

    如果要在使用弹出菜单时扩展它们,请使用以下命令:
    inoremap <silent><expr><CR> pumvisible() ? deoplete#mappings#close_popup()."\<Plug>(neosnippet_expand_or_jump)" : "\<CR>"
    

    关于vim - 如何使用 deoplete 下拉菜单自动展开 Neosnippet?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42024254/

    相关文章:

    vim - 获取函数调用的回溯

    Vim 使用 nerdtree 关闭缓冲区

    git - 有 VIM Git 时间线吗?

    lua - 如何使用快捷方式重新加载用 lua 编写的 Neovim 配置?

    function - Neovim 中的 ALE Fixer 配置

    regex - vim - 按表达式折叠代码

    Vim 或 sed : Replace character(s) within a pattern

    php - 将 PHP API 文档添加到 vims bubbleexpr

    vim - 如何在 git bash commit 中保存退出 vim