Git Product home page Git Product logo

Comments (7)

char101 avatar char101 commented on May 21, 2024 1

Ok, actually after trying it with gvim -u NONE -U NONE, it seems that pressing <CR> in completion menu does insert a newline.

I'm using the mappings from http://vim.wikia.com/wiki/Improve_completion_popup_menu , esp. inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<CR>"

I'm using Windows btw so pressing Enter to choose a completion item is the standard shortcut. But it is a bit hard to add the behaviour I want to the mapping set by the plugin, since the mapping is added by an autocommand thus it is hard to override it.

from bullets.vim.

dkarter avatar dkarter commented on May 21, 2024

Hi @char101,

Thanks for reaching out.

Can you please provide a minimal vimrc for reproducing the problem you are experiencing?

Are you using some plugin or special mappings for navigating and selecting a completion result?

I just tested what happens when a completion menu comes up at the end of the line and seems like <CR> should work just fine. (I am using deoplete). See GIF below:

screenflow

from bullets.vim.

char101 avatar char101 commented on May 21, 2024

Hi,

From the GIF, when selecting hello_ary and pressing <CR>, it should only insert the completion without adding a newline, otherwise if I am selecting a completion mid sentence, I will have to press backspace to go back to the previous line.

from bullets.vim.

dkarter avatar dkarter commented on May 21, 2024

Seems like this is a setup specific to your .vimrc so I'm closing this issue.

If you want to open a PR that will set the mapping in any other way that is more easily override-able I'll be open to that.

from bullets.vim.

FocusedWolf avatar FocusedWolf commented on May 21, 2024

I just noticed this issue myself, also on Windows if that matters.

I have
let g:bullets_enabled_file_types = [ \ 'markdown', \ 'text', \ 'gitcommit', \ 'scratch' \]

and when I type some stuff in a text file to trigger the omnicompletion popup, hitting enter fails to insert the selected item from the popup. When i removed the plugin the problem went away.

Maybe changing this line:
call s:add_local_mapping('inoremap', '<cr>', '<C-]><C-R>=<SID>insert_new_bullet()<cr>')
...to this (untested) could fix it?:
call s:add_local_mapping('inoremap', '<cr>', 'pumvisible() ? "<cr>" : "<C-]><C-R>=<SID>insert_new_bullet()<cr>"')

from bullets.vim.

dkarter avatar dkarter commented on May 21, 2024

@FocusedWolf I don't think this will work in the first scenario in my gif above. Can you produce a minimal .vimrc that I can use to reproduce the issue and come up with a better solution?


Example minimal vimrc

syntax on
call plug#begin('~/.vim/bundle')

Plug 'dkarter/bullets.vim'
Plug 'some-other/plugin'

call plug#end()

Save it to a file and then nvim -u .debug-vimrc test.md to make sure you can still generate the error.

from bullets.vim.

keiohtani avatar keiohtani commented on May 21, 2024

I am having the same issue. The issue is that both Coc and Bullets.vim use <CR> in insert mode.

call plug#begin(stdpath('data') . '/plugged')
  Plug 'neoclide/coc.nvim', 
  Plug 'dkarter/bullets.vim',
call plug#end()

filetype plugin indent on
syntax enable

" Use <cr> to confirm completion, `<C-g>u` means break undo chain at current
" position. Coc only does snippet and additional edit on confirm.
" <cr> could be remapped by other vim plugin, try `:verbose imap <CR>`.
if exists('*complete_info')
  inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
else
  inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
endif

As @FocusedWolf commented, I can see a pumvisible check like call s:add_local_mapping('inoremap', '<cr>', 'pumvisible() ? "<cr>" : "<C-]><C-R>=<SID>insert_new_bullet()<cr>"') to work , though I could not get this exact code to work.

Changing this behavior completely may not be preferred for everyone, but I would appreciate if you could set up a parameter to enable the pumvisible check. If that's not possible, a param to disable only the <CR> mapping would be pretty helpful.

Thank you.

from bullets.vim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.