question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

A more feature rich vimrc example, and a demo gif

See original GitHub issue

peek 2018-07-17 18-15

Vimrc for demo:

Make sure you do understand what it is doing before copying config. Comment if you have any question

execute 'source ' . $WORKSPACE_DIR . '/plug.vim'

call plug#begin($WORKSPACE_DIR)
    Plug 'ncm2/ncm2'
    Plug 'roxma/nvim-yarp'

    autocmd BufEnter * call ncm2#enable_for_buffer()
    set completeopt=noinsert,menuone,noselect
    set shortmess+=c

    inoremap <c-c> <ESC>

    inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
    inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"

    Plug 'ncm2/ncm2-match-highlight'

    Plug 'ncm2/ncm2-ultisnips'
    Plug 'SirVer/ultisnips'
    Plug 'honza/vim-snippets'

    inoremap <silent> <expr> <CR> ((pumvisible() && empty(v:completed_item)) ?  "\<c-y>\<cr>" : (!empty(v:completed_item) ? ncm2_ultisnips#expand_or("", 'n') : "\<CR>" ))

    " c-j c-k for moving in snippet
    imap <expr> <c-u> ncm2_ultisnips#expand_or("\<Plug>(ultisnips_expand)", 'm')
    smap <c-u> <Plug>(ultisnips_expand)
    let g:UltiSnipsExpandTrigger		= "<Plug>(ultisnips_expand)"
    let g:UltiSnipsJumpForwardTrigger	= "<c-j>"
    let g:UltiSnipsJumpBackwardTrigger	= "<c-k>"
    let g:UltiSnipsRemoveSelectModeMappings = 0

    Plug 'ncm2/ncm2-html-subscope'
    Plug 'ncm2/ncm2-markdown-subscope'
    Plug 'ncm2/ncm2-bufword'
    Plug 'ncm2/ncm2-jedi'
    Plug 'ncm2/ncm2-pyclang'
    Plug 'ncm2/ncm2-tern'
    Plug 'ncm2/ncm2-cssomni'

    Plug 'autozimu/LanguageClient-neovim', {
        \ 'branch': 'next',
        \ 'do': 'bash install.sh',
        \ }
    let g:LanguageClient_serverCommands = {
                \ 'vue': ['vls'],
                \ 'rust': ['rls'],
                \ }

    " read
    " https://github.com/autozimu/LanguageClient-neovim/pull/514#issuecomment-404463033
    " for contents of settings.json for vue-language-server
    let g:LanguageClient_settingsPath = $WORKSPACE_DIR . '/.vim/settings.json'
    let g:LanguageClient_completionPreferTextEdit = 1
    autocmd BufNewFile,BufRead *.vue set filetype=vue
    autocmd filetype vue LanguageClientStart

    " the suddennly popup of diagnostics sign is kind of annoying
    let g:LanguageClient_diagnosticsSignsMax = 0

    " " for debugging LanguageClient-neovim
    " set noshowmode
    " inoremap <silent> <c-q> <esc>:<c-u>q!<cr>
    " let g:LanguageClient_loggingFile = '/tmp/lc.log'
    " let g:LanguageClient_loggingLevel = 'DEBUG'

    " markdown syntax highlight, theme
    Plug 'morhetz/gruvbox'
    Plug 'plasticboy/vim-markdown', {'for': 'markdown'}
call plug#end()

set background=dark
colorscheme gruvbox
set number
set relativenumber

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:9
  • Comments:17 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
roxmacommented, Jan 27, 2019

@terkelg

1. (pumvisible() && empty(v:completed_item)) -> 
    popup menu is visible but non was selected ->  "\<c-y>\<cr>" -> 
        close the popup with <c-y> and break line with <CR>

2. !empty(v:completed_item) -> 
    popup menu may or may not be visible, but there's a valid completion there -> 
        try expand its snippet, if expansion fails, do nothing else

3. empty(v:completed_item) -> 
    this implies that !pumvisible() in step 1, popup menu is not visible, no valid completion out there -> 
        break the line with <CR>

I don’t remember why I chose this mapping. Currently I’m using inoremap <silent> <expr> <CR> ncm2_ultisnips#expand_or("\<CR>", 'n') in my vimrc.

1reaction
roxmacommented, Mar 21, 2019

@ukrdev you should be familiar with one of ultisnips, neosnippet or snipmate before using the snippet feature for parameter expansion.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tweets mit Antworten von Vim Links (@VimLinks) / Twitter
A fascinating Neovim tool that lets you search-and-replace by AST: https://github.com/cshuaimin/ssr.nvim/…
Read more >
5 Killer Vim Features for Your Data Science Daily Routine
In this article, I will introduce a few vim features that really help me to remove frictions in my data science workflows.
Read more >
Vimrc Configuration Guide - How to Customize Your Vim ...
In this article I will show you a few ways you can customize your .vimrc file. I will go over: Basic Settings; Plugins;...
Read more >
awesome-vscode | A curated list of delightful VS Code ...
Show language diagnostics inline (errors/warnings/…). error lens demo gif. Toggle. Toggle any VS Code setting by your favorite keybindings. Example of toggling ...
Read more >
Vim C++ - There Is Such a Thing! - Incredibuild
For example, there are a variety of plugins for C++ that offer support for syntax checking, code completion, and debugging. Hence, Vim C++!....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found