Git Product home page Git Product logo

Comments (13)

hrsh7th avatar hrsh7th commented on June 16, 2024 4

@tami5 I've implemented scrolling mapping. Please see docs.

from nvim-compe.

hrsh7th avatar hrsh7th commented on June 16, 2024 2

If this problem was solved, please close this.

from nvim-compe.

hrsh7th avatar hrsh7th commented on June 16, 2024

Could you explain it in more little in detail?

from nvim-compe.

kkharji avatar kkharji commented on June 16, 2024

So basically, in addition to open/close the documentation window. on event, add <c-u> and <c-d> to navigated it. This is super useful when the content is 80 lines long and instead of having large preview window, it would be set to minheight and the user can navigate through it.

Does it make sense?

from nvim-compe.

hrsh7th avatar hrsh7th commented on June 16, 2024

I think documentation scrolling is easy. So we add it to README.md is enough.

nnoremap <expr> <C-f> <SID>scroll(+4)
nnoremap <expr> <C-u> <SID>scroll(-4)
inoremap <expr> <C-f> <SID>scroll(+4)
inoremap <expr> <C-u> <SID>scroll(-4)

function! s:scroll(count) abort
  let l:ctx = {}
  function! l:ctx.callback(count) abort
    let l:wins = nvim_list_wins()
    let l:wins = filter(l:wins, '!empty(nvim_win_get_config(v:val).relative)')
    if !empty(l:wins)
      call lamp#view#window#do(l:wins[0], { ->
      \   execute(printf('normal! %s%s%s%s',
      \     abs(a:count),
      \     a:count >= 0 ? "\<C-e>" : "\<C-y>",
      \     abs(a:count),
      \     a:count >= 0 ? 'j' : 'k',
      \   ))
      \ })
    endif
  endfunction
  call timer_start(100, { -> l:ctx.callback(a:count) })
  return "\<Ignore>"
endfunction

from nvim-compe.

kkharji avatar kkharji commented on June 16, 2024

I don't understand how would this control the popup? πŸ€” also, scroll will only be useful when the max height of the popup can be limited to certain extend.

from nvim-compe.

hrsh7th avatar hrsh7th commented on June 16, 2024

Ah. You want to enter to popup, right?
It's bit difficult now... hm...

from nvim-compe.

kkharji avatar kkharji commented on June 16, 2024

I mean by control the popup is to control only what part is visible through scrolling the popup buffer ... hope you understand that way.

For scrolling we can easily attach to it mappings when it get created and destroyed with it.

That is by normally binding buffer local mapping nnoremap <buffer> in the global scope that control that popup and then during close unmap

from nvim-compe.

hrsh7th avatar hrsh7th commented on June 16, 2024

I think #57 (comment) is realizing scrolling...

from nvim-compe.

kkharji avatar kkharji commented on June 16, 2024

Thanks a lot @hrsh7th, I'll test out soon

from nvim-compe.

kkharji avatar kkharji commented on June 16, 2024

Well ... it would be nice to only map nav keys when the popup show and map them back when popup closes. I usually have inter mode mapping for c-f,c-b,c-d and it would be cool to have them working if no popup

from nvim-compe.

hrsh7th avatar hrsh7th commented on June 16, 2024

Hm... I can add the compe#scroll({ 'delta': +4, 'fallback': ... })

from nvim-compe.

kkharji avatar kkharji commented on June 16, 2024

Oh @hrsh7th that would be awesome !!!

from nvim-compe.

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.