Coder Social home page Coder Social logo

pum.vim's Introduction

pum.vim

Doc

Please read help for details.

Introduction

pum.vim is the framework library to implement original popup menu completion.

It works both insert mode and command line mode.

Install

Note: pum.vim requires Neovim (0.8.0+ and of course, latest is recommended) or Vim 9.0.1276+.

pum.vim detects if "noice.nvim" is installed. https://github.com/folke/noice.nvim

Configuration

inoremap <C-n>   <Cmd>call pum#map#insert_relative(+1)<CR>
inoremap <C-p>   <Cmd>call pum#map#insert_relative(-1)<CR>
inoremap <C-y>   <Cmd>call pum#map#confirm()<CR>
inoremap <C-e>   <Cmd>call pum#map#cancel()<CR>
inoremap <PageDown> <Cmd>call pum#map#insert_relative_page(+1)<CR>
inoremap <PageUp>   <Cmd>call pum#map#insert_relative_page(-1)<CR>

Screenshots

pum.vim's People

Contributors

4513echo avatar aileot avatar gamoutatsumi avatar hokorobi avatar kuuote avatar matsui54 avatar natsu0077 avatar ogaken-1 avatar shougo avatar shutils avatar statiolake avatar syuzuki avatar uga-rosa avatar yasunori0418 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

pum.vim's Issues

The characters on the top line are inserted when `use_complete` is enabled for candidate selection.

Problems summary

If call pum#set_option('use_complete', v:true) is set, characters in the line above are also inserted when selecting completion candidates with . (i_CTRL-Y behavior).

Expected

When selecting a completion candidate with , the character on the line above is not inserted.

Environment Information (Required!)

  • pum.vim version(SHA1): 2625141

  • OS: Windows10

  • neovim/Vim :version output:

VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Dec 29 2022 23:29:18)
MS-Windows 64 ビット GUI 版 with OLE サポート
適用済パッチ: 1-1108
Compiled by appveyor@APPVYR-WIN
Huge 版 with GUI.  機能の一覧 有効(+)/無効(-)
+acl                +cindent            +cursorshape        -farsi              +job                +menu               +packages           +reltime            -sun_workshop       -tgetent            +visualextra
+arabic             +clientserver       +dialog_con_gui     +file_in_path       +jumplist           +mksession          +path_extra         +rightleft          +syntax             +timers             +vreplace
+autocmd            +clipboard          +diff               +find_in_path       +keymap             +modify_fname       +perl/dyn           +ruby/dyn           +tag_binary         +title              -vtp
+autochdir          +cmdline_compl      +digraphs           +float              +lambda             +mouse              +persistent_undo    +scrollbind         -tag_old_static     +toolbar            +wildignore
+autoservername     +cmdline_hist       +directx            +folding            +langmap            +mouseshape         +popupwin           +signs              -tag_any_white      +user_commands      +wildmenu
+balloon_eval       +cmdline_info       -dnd                -footer             +libcall            +multi_byte_ime/dyn -postscript         +smartindent        -tcl                +vartabs            +windows
-balloon_eval_term  +comments           -ebcdic             +gettext/dyn        +linebreak          +multi_lang         +printer            +sodium/dyn         -termguicolors      +vertsplit          +writebackup
+browse             +conceal            +emacs_tags         -hangul_input       +lispindent         +mzscheme/dyn       +profile            +sound              +terminal           +vim9script         -xfontset
++builtin_terms     +cryptv             +eval               +iconv/dyn          +listcmds           +netbeans_intg      +python/dyn         +spell              -termresponse       +viminfo            -xim
+byte_offset        +cscope             +ex_extra           +insert_expand      +localmap           +num64              +python3/dyn        +startuptime        +textobjects        +virtualedit        +xpm_w32
+channel            +cursorbind         +extra_search       +ipv6               +lua/dyn            +ole                +quickfix           +statusline         +textprop           +visual             -xterm_save
      システム vimrc: "$VIM\vimrc"
      ユーザー vimrc: "$HOME\_vimrc"
   第2ユーザー vimrc: "$HOME\vimfiles\vimrc"
   第3ユーザー vimrc: "$VIM\_vimrc"
       ユーザー exrc: "$HOME\_exrc"
    第2ユーザー exrc: "$VIM\_exrc"
     システム gvimrc: "$VIM\gvimrc"
     ユーザー gvimrc: "$HOME\_gvimrc"
  第2ユーザー gvimrc: "$HOME\vimfiles\gvimrc"
  第3ユーザー gvimrc: "$VIM\_gvimrc"
  デフォルトファイル: "$VIMRUNTIME\defaults.vim"
    システムメニュー: "$VIMRUNTIME\menu.vim"
コンパイル: cl -c /W3 /GF /nologo -I. -Iproto -DHAVE_PATHDEF -DWIN32 -DHAVE_STDINT_H  -DFEAT_CSCOPE -DFEAT_TERMINAL -DFEAT_SOUND -DFEAT_NETBEANS_INTG -DFEAT_JOB_CHANNEL -DFEAT_IPV6 -DHAVE_INET_NTOP   -DFEAT_XPM_W32 -DHAVE_SODIUM -DDYNAMIC_SODIUM -DDYNAMIC_SODIUM_DLL=\"libsodium.dll\" /I "C:\libsodium\include" -DWINVER=0x0601 -D_WIN32_WINNT=0x0601 /source-charset:utf-8 /MP /Ox /GL -DNDEBUG /Zl /MT /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE -DFEAT_OLE -DFEAT_MBYTE_IME -DDYNAMIC_IME -DFEAT_GUI_MSWIN -DFEAT_DIRECTX -DDYNAMIC_DIRECTX -DFEAT_DIRECTX_COLOR_EMOJI -DDYNAMIC_ICONV -DDYNAMIC_GETTEXT -DFEAT_LUA -DDYNAMIC_LUA -DDYNAMIC_LUA_DLL=\"lua54.dll\" -DFEAT_PYTHON -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"python27.dll\" -DFEAT_PYTHON3 -DDYNAMIC_PYTHON3 -DDYNAMIC_PYTHON3_DLL=\"python311.dll\" -DFEAT_MZSCHEME -I "C:\racket\include" -DMZ_PRECISE_GC -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"libracket3m_da32rk.dll\" -DDYNAMIC_MZGC_DLL=\"libracket3m_da32rk.dll\" -DFEAT_PERL -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl532.dll\" -DFEAT_RUBY -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL=\"x64-msvcrt-ruby300.dll\" -DRUBY_VERSION=30 -DFEAT_HUGE /Fd.\ObjGXOULYHRZAMD64/ /Zi
リンク: link /nologo /opt:ref /LTCG /HIGHENTROPYVA:NO oldnames.lib kernel32.lib advapi32.lib shell32.lib gdi32.lib  comdlg32.lib ole32.lib netapi32.lib uuid.lib user32.lib  /machine:AMD64 version.lib  winspool.lib comctl32.lib libcmt.lib oleaut32.lib  /nodefaultlib:lua54.lib  /STACK:8388608  /nodefaultlib:python27.lib /nodefaultlib:python311.lib    winmm.lib WSock32.lib Ws2_32.lib xpm\x64\lib-vc14\libXpm.lib  /PDB:gvim.pdb -debug

Provide a minimal init.vim/vimrc without plugin managers (Required!)

set rtp+=~/_vim/dein/repos/github.com/vim-denops/denops.vim
set rtp+=~/_vim/dein/repos/github.com/Shougo/ddc.vim
set rtp+=~/_vim/dein/repos/github.com/Shougo/ddc-source-around
set rtp+=~/_vim/dein/repos/github.com/Shougo/ddc-matcher_head
set rtp+=~/_vim/dein/repos/github.com/Shougo/ddc-sorter_rank
set rtp+=~/_vim/dein/repos/github.com/Shougo/ddc-ui-pum
set rtp+=~/_vim/dein/repos/github.com/Shougo/pum.vim
set wildoptions+=pum
call pum#set_option('use_complete', v:true)
call ddc#custom#patch_global('ui','pum')
call ddc#custom#patch_global('completionMenu','pum.vim')
call ddc#custom#patch_global('sources', ['around'])
call ddc#custom#patch_global('sourceOptions',#{
      \ _: #{
      \   ignoreCase: v:true,
      \   matchers: ['matcher_head'],
      \   sorters: ['sorter_rank'],
      \ },
      \ around: #{
      \   mark :  'A',
      \ },
      \ })
call ddc#enable()
inoremap <C-n> <Cmd>call pum#map#insert_relative(+1)<CR>

How to reproduce the problem from neovim/Vim startup (Required!)

Select a completion candidate with at a position shorter than the line above.

Screen shot (if possible)

ss.mp4

When item.word is the same candidates are lined up, insert_relative does not work.

Warning: I will close the issue without the minimal init.vim and the
reproduction instructions.

Problems summary

The next item cannot be selected and is confirmed.

Expected

Select the next item.

Environment Information (Required!)

Latest

  • pum.vim version(SHA1): 9069b94

  • OS: Ubuntu 22.04 (WSL2)

  • neovim/Vim :version output: NVIM v0.10.0-dev-0ca2d11

Provide a minimal init.vim/vimrc without plugin managers (Required!)

set runtimepath+=/path/to/denops.vim
set runtimepath+=/path/to/ddc.vim
set runtimepath+=/path/to/ddc-ui-pum
set runtimepath+=/path/to/pum.vim

call ddc#custom#patch_global(#{
      \ ui: 'pum',
      \ sources: ['test'],
      \ sourceOptions: #{
      \   _: #{
      \     dup: 'keep'
      \   }
      \ },
      \})

inoremap <C-n> <Cmd>call pum#map#insert_relative(+1)<CR>
inoremap <C-p> <Cmd>call pum#map#insert_relative(-1)<CR>
inoremap <C-y> <Cmd>call pum#map#confirm()<CR>
inoremap <C-x> <Cmd>call pum#open(1, [
      \ #{
      \   word: 'text',
      \   kind: 'A',
      \   dup: 1,
      \ }, #{
      \   word: 'text',
      \   kind: 'B',
      \   dup: 1,
      \ }
      \])<CR>

call ddc#enable()

And ddc-source-text

  • denops/@ddc-sources/test.ts
import { BaseSource, DdcGatherItems } from "https://deno.land/x/[email protected]/types.ts";
import { GatherArguments } from "https://deno.land/x/[email protected]/base/source.ts";

type Params = Record<string, never>;

type UserData = {
  data: string;
};

export class Source extends BaseSource<Params> {
  gather(
    _args: GatherArguments<Params>,
  ): Promise<DdcGatherItems<UserData>> {
    return Promise.resolve({
      items: [
        {
          word: "test1",
          kind: "A",
        },
        {
          word: "test1",
          kind: "B",
        },
      ],
      isIncomplete: false,
    });
  }

  params(): Params {
    return {};
  }
}

How to reproduce the problem from neovim/Vim startup (Required!)

  1. Insert text te
  2. Two candidates test1 come up
  3. You try to select one, the popup closes.

FYI:
This issue is related ddc.vim.
After disabling ddc.vim with call ddc#disable(), you can confirm that <C-n>/<C-p> works correctly by directly hitting pum#open() with <C-x>.

Screen shot (if possible)

Upload the log messages by :redir and :message (if errored)

When `pum#visible()` is true, leave and back to insert mode found error

summary

When any candidates is shown, two-times type <Esc> to leave insert mode.

Then back to insert mode and typing any character is found error.

environment

Vim 8.2.3448
Neovim 0.6.0 (nightly)

minimal .vimrc / init.vim

set runtimepath^=~/Repositories/github.com/vim-denops/denops.vim
set runtimepath^=~/Repositories/github.com/Shougo/ddc.vim
set runtimepath^=~/Repositories/github.com/Shougo/ddc-around
set runtimepath^=~/Repositories/github.com/Shougo/ddc-matcher_head
set runtimepath^=~/Repositories/github.com/Shougo/ddc-sorter_rank
set runtimepath^=~/Repositories/github.com/Shougo/pum.vim

if !has('nvim')
  set nocompatible
endif

set pumheight=10


function! s:ddcinit() abort
  imap <silent><expr> <TAB> pum#visible() ? '<Cmd>call pum#map#insert_relative(+1)<CR>' : '<TAB>'
  imap <silent><expr> <S-TAB> pum#visible() ? '<Cmd>call pum#map#insert_relative(-1)<CR>' : '<S-TAB>'
  imap <silent><expr> <CR> pum#visible() ? '<Cmd>call pum#map#confirm()<CR>' : '<CR>'
  imap <silent><expr> <Esc> pum#visible() ? '<Cmd>call pum#map#cancel()<CR>' : '<Esc>'
  call ddc#custom#patch_global('completionMenu', 'pum.vim')
  call ddc#custom#patch_global('sources', ['around'])
  call ddc#custom#patch_global('sourceOptions', {
    \ '_': { 'matchers': ['matcher_head'], 'sorters': ['sorter_rank'] },
    \ 'around': {'mark': 'A', 'minAutoCompleteLength': 3},
    \ })

  call ddc#custom#patch_global('backspaceCompletion', v:true)
  call ddc#custom#patch_global('autoCompleteEvents',
        \ ['InsertEnter', 'TextChangedP', 'TextChangedI'])
  call ddc#enable()
endfunction

autocmd User DenopsReady call s:ddcinit()

screenshot

Peek 2021-10-08 09-58

Unnecessary `...` are displayed with `padding: v:true` in command line popup window.

Problems summary

When the padding option is set to v:true, the unnecessary ... are displayed in the command line completion popup window.

This occurs with both neovim and vim.

Expected

The ... are not displayed, like the padding option is set to v:false.

Environment Information (Required!)

  • pum.vim version(SHA1): c981ac0

  • OS: macOS

  • neovim/Vim :version output:

NVIM v0.10.0-dev-1709+gef64e225f-Homebrew
Build type: Release
LuaJIT 2.1.0-beta3

      システム vimrc: "$VIM/sysinit.vim"
       省略時の $VIM: "/opt/homebrew/Cellar/neovim/HEAD-ef64e22/share/nvim"

Run :checkhealth for more info

Provide a minimal init.vim/vimrc without plugin managers (Required!)

if !has("nvim")
  set nocompatible
  filetype plugin indent on
  syntax enable
endif

let s:plugins = [
      \ 'vim-denops/denops.vim',
      \ 'Shougo/ddc.vim',
      \ 'Shougo/pum.vim',
      \ 'Shougo/ddc-ui-pum',
      \ 'Shougo/ddc-source-cmdline',
      \ ]

for item in s:plugins
  execute 'set runtimepath+=~/.cache/dein/repos/github.com/' . item
endfor

call ddc#custom#patch_global(#{
 \   ui: 'pum',
 \   cmdlineSources: ['cmdline'],
 \   autoCompleteEvents: ['InsertEnter', 'TextChangedI', 'TextChangedP', 'CmdlineEnter', 'CmdlineChanged'],
 \ })

call pum#set_local_option('c', #{
  \   padding: v:true,
  \   min_width: 50,
  \ })

nnoremap : <Cmd>call ddc#enable_cmdline_completion()<CR>:

call ddc#enable()

How to reproduce the problem from neovim/Vim startup (Required!)

  1. Start neovim.
  2. Press : to enter the command line.
  3. Input ca and then get completion.

Screen shot (if possible)

スクリーンショット 2023-05-18 21 15 15

Highlight is misaligned.

Warning: I will close the issue without the minimal init.vim and the
reproduction instructions.

Problems summary

Highlight is misaligned.

Expected

Environment Information (Required!)

Latest

  • pum.vim version(SHA1):

  • OS:

  • neovim/Vim :version output:

Provide a minimal init.vim/vimrc without plugin managers (Required!)

set runtimepath+=/path/to/denops.vim
set runtimepath+=/path/to/ddc.vim
set runtimepath+=/path/to/ddc-ui-pum
set runtimepath+=/path/to/pum.vim
set runtimepath+=/path/to/ddc-fuzzy

call ddc#custom#patch_global(#{
      \ ui: 'pum',
      \ sources: ['minimal'],
      \ sourceOptions: #{
      \   _: #{
      \     minAutoCompleteLength: 1,
      \     matchers: ['matcher_fuzzy'],
      \     sorters: ['sorter_fuzzy'],
      \     converters: ['converter_fuzzy'],
      \   },
      \ },
      \ filterParams: #{
      \   converter_fuzzy: #{
      \     hlGroup: 'Error',
      \   },
      \ },
      \})

call pum#set_option(#{
      \ item_orders: ['kind', 'space', 'abbr', 'space', 'menu'],
      \})

inoremap <C-n> <Cmd>call pum#map#insert_relative(+1)<CR>
inoremap <C-p> <Cmd>call pum#map#insert_relative(-1)<CR>
inoremap <C-y> <Cmd>call pum#map#confirm()<CR>

call ddc#enable()
  • denops/@ddc-sources/minimal.ts
import { BaseSource, DdcGatherItems } from "https://deno.land/x/[email protected]/types.ts";

type Params = Record<never, never>;

export class Source extends BaseSource<Params> {
  gather(): Promise<DdcGatherItems> {
    return Promise.resolve([
      { word: "test1", kind: "󰉿" },
    ]);
  }

  params(): Params {
    return {};
  }
}

How to reproduce the problem from neovim/Vim startup (Required!)

1.Input t.

Screen shot (if possible)

image

Upload the log messages by :redir and :message (if errored)

Preview window's resizing to content width feature is not working.(neovim only)

Problems summary

Preview window's resizing to content width feature is not working. (neovim only)

Expected

If the content width is within the preview_height, preview_width range set by the user, the preview window is resized to fit the content width.

Environment Information (Required!)

  • pum.vim version(SHA1):0263631d7cd56caaae58255de24fc8692861a142

  • OS:Ubuntu 22.04.2 LTS on Windows 10 x86_64

  • neovim/Vim :version output:NVIM v0.10.0-dev-836+g6d93bdd45-Homebrew/VIM - Vi IMproved 9.0

Provide a minimal init.vim/vimrc without plugin managers (Required!)

set rtp+=/path/to/pum.vim

call pum#set_option(#{
      \   preview: v:true,
      \   preview_border: "single",
      \   preview_height: 10,
      \   preview_width: 30,
      \ })

inoremap <C-n> <Cmd>call pum#map#insert_relative(+1)<CR>
inoremap <C-p> <Cmd>call pum#map#insert_relative(-1)<CR>
inoremap <C-Space> <Cmd>call pum#open(col('.'), [
      \   #{ 
      \     word: 'hoge',
      \     kind: 'Test',
      \     menu: '[test]',
      \     info: "some text.\nsome text."
      \   },
      \ ])<CR>

How to reproduce the problem from neovim/Vim startup (Required!)

  1. Press <C-Space> in insert mode.
  2. Press <C-n>.

Screen shot (if possible)

cap

Upload the log messages by :redir and :message (if errored)

Notting

Feature request: Add left/right padding to completion items

In (Neo)Vim's default completion menu, it has whitespaces in both side of completion item:

image

... while pum.vim does not:

image

Could you add the padding to pum.vim?

nvim-cmp seems to support this by directly adding padding in the completion entry buffer.

https://github.com/hrsh7th/nvim-cmp/blob/272cbdca3e327bf43e8df85c6f4f00921656c4e4/lua/cmp/view/custom_entries_view.lua#L211

Note: border doesn't solve the issue. With border:

image

Padding is added, but they looks different because selection highlight is not drawn over the border part.

In Neovim, highlighting of selected lines sometimes disappears

Problems summary

In Neovim, highlighting of selected lines sometimes disappears.

It occurs when moving from a candidate with a preview to one without, and vice versa.

Expected

Highlighting of selected lines remains

Environment Information (Required!)

  • pum.vim version(SHA1): e5a2cb0

  • OS: macOS Sonoma 14.2.1 (M1 Macbook Air)

  • Neovim :version output:

NVIM v0.10.0-dev-2042+g28c183b38-Homebrew
Build type: Release
LuaJIT 2.1.1703358377

Provide a minimal init.vim/vimrc without plugin managers (Required!)

syntax enable
filetype plugin indent on

set rtp+=~/temp/denops.vim
set rtp+=~/temp/ddc.vim
set rtp+=~/temp/ddc-ui-pum
set rtp+=~/temp/pum.vim
set rtp+=~/temp/ddc-around
set rtp+=~/temp/ddc-source-cmdline
set rtp+=~/temp/ddc-matcher_head

call ddc#custom#patch_global('sources',
\  [ 'around',  'cmdline' ]
\)

call ddc#custom#patch_global('sourceOptions', {
\  '_': {
\    'matchers': ['matcher_head'],
\  },
\  'around': {
\    'mark': 'A',
\  },
\  'cmdline': {
\    'mark': 'C',
\  }
\})

call ddc#custom#patch_global('autoCompleteEvents', [
\  'InsertEnter', 'TextChangedI', 'TextChangedP',
\])
call ddc#custom#patch_global('ui', 'pum')

call ddc#enable()

call pum#set_option({
\  'auto_select': v:true,
\  'preview': v:true,
\})

imap <script><silent><nowait><expr> <C-n> pum#map#select_relative(+1)
imap <script><silent><nowait><expr> <C-p> pum#map#select_relative(-1)

How to reproduce the problem from neovim/Vim startup (Required!)

  1. Type "ec"
  2. <C-n> to select the candidate below

Screen shot (if possible)

画面収録 2024-01-16 7 44 27

Upload the log messages by :redir and :message (if errored)

In scrolling to previous, cursor is out to pum window

summary

When in scrolled pum window, trying to back to previous candidates cursor into out of pum window.

environment

Vim 8.2.3448
Neovim 0.6.0 (nightly)

minimal .vimrc / init.vim

set runtimepath^=~/repos/github.com/vim-denops/denops.vim
set runtimepath^=~/repos/github.com/Shougo/pum.vim
set runtimepath^=~/repos/github.com/Shougo/ddc.vim
set runtimepath^=~/repos/github.com/Shougo/neco-vim
set runtimepath^=~/repos/github.com/Shougo/ddc-matcher_head
set runtimepath^=~/repos/github.com/Shougo/ddc-sorter_rank

set pumheight=10

if !has('nvim')
  set nocompatible
endif

function! CommandlinePre() abort
  let s:prev_buffer_config = ddc#custom#get_buffer()
  call ddc#custom#patch_buffer('sources', ['necovim'])
  call ddc#custom#patch_buffer('sourceOptions', {
        \ 'necovim': {'mark': 'V', 'minAutoCompleteLength': 3},
        \ })
  autocmd CmdlineLeave * call CommandlinePost()
  call ddc#enable_cmdline_completion()
endfunction

function! CommandlinePost() abort
  call ddc#custom#set_buffer(s:prev_buffer_config)
endfunction

function! s:ddcinit() abort
  cmap <silent><expr> <C-n> pum#visible() ? '<Cmd>call pum#map#insert_relative(+1)<CR>' : '<C-n>'
  cmap <silent><expr> <C-p> pum#visible() ? '<Cmd>call pum#map#insert_relative(-1)<CR>' : '<C-p>'
  cmap <silent><expr> <CR> pum#visible() ? '<Cmd>call pum#map#confirm()<CR>' : '<CR>'
  cmap <silent><expr> <Esc> pum#visible() ? '<Cmd>call pum#map#cancel()<CR>' : '<C-c>'

  call ddc#custom#patch_global('completionMenu', 'pum.vim')
  call ddc#custom#patch_global('backspaceCompletion', v:true)
  call ddc#custom#patch_global('autoCompleteEvents',
        \ ['CmdlineChanged'])
  call ddc#enable()
  nnoremap : <Cmd>call CommandlinePre()<CR>:
endfunction

autocmd User DenopsReady call s:ddcinit()

screenshot

Peek 2021-10-05 21-57

highlight_columns offset is wrong

Problems summary

highlight_columns offset is wrong.

Expected

It should be rendered without overhanging highlights.

Environment Information (Required!)

Neovim
NVIM v0.10.0-dev-713+gf2ce31d3d-Homebrew
Build type: Release
LuaJIT 2.1.0-beta3
Run ":verbose version" for more info
Vim
VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Jul 09 2023 01:38:28)
macOS 版 - arm64
適用済パッチ: 1-1677
Compiled by Homebrew
Huge 版 without GUI.  機能の一覧 有効(+)/無効(-)
+acl               +cmdline_hist      +ex_extra          +jumplist          +mouse_dec         +perl              +sodium            +textobjects       +wildmenu
+arabic            +cmdline_info      +extra_search      +keymap            -mouse_gpm         +persistent_undo   +sound             +textprop          +windows
+autocmd           +comments          -farsi             +lambda            -mouse_jsbterm     +popupwin          +spell             +timers            +writebackup
+autochdir         +conceal           +file_in_path      +langmap           +mouse_netterm     +postscript        +startuptime       +title             -X11
-autoservername    +cryptv            +find_in_path      +libcall           +mouse_sgr         +printer           +statusline        -toolbar           -xfontset
-balloon_eval      +cscope            +float             +linebreak         -mouse_sysmouse    +profile           -sun_workshop      +user_commands     -xim
+balloon_eval_term +cursorbind        +folding           +lispindent        +mouse_urxvt       -python            +syntax            +vartabs           -xpm
-browse            +cursorshape       -footer            +listcmds          +mouse_xterm       +python3           +tag_binary        +vertsplit         -xsmp
++builtin_terms    +dialog_con        +fork()            +localmap          +multi_byte        +quickfix          -tag_old_static    +vim9script        -xterm_clipboard
+byte_offset       +diff              +gettext           +lua               +multi_lang        +reltime           -tag_any_white     +viminfo           -xterm_save
+channel           +digraphs          -hangul_input      +menu              -mzscheme          +rightleft         -tcl               +virtualedit
+cindent           -dnd               +iconv             +mksession         +netbeans_intg     +ruby              +termguicolors     +visual
-clientserver      -ebcdic            +insert_expand     +modify_fname      +num64             +scrollbind        +terminal          +visualextra
+clipboard         +emacs_tags        +ipv6              +mouse             +packages          +signs             +terminfo          +vreplace
+cmdline_compl     +eval              +job               -mouseshape        +path_extra        +smartindent       +termresponse      +wildignore
      システム vimrc: "$VIM/vimrc"
      ユーザー vimrc: "$HOME/.vimrc"
   第2ユーザー vimrc: "~/.vim/vimrc"
       ユーザー exrc: "$HOME/.exrc"
  デフォルトファイル: "$VIMRUNTIME/defaults.vim"
       省略時の $VIM: "/opt/homebrew/share/vim"
コンパイル: clang -c -I. -Iproto -DHAVE_CONFIG_H -DMACOS_X -DMACOS_X_DARWIN -g -O2 -I/opt/homebrew/Cellar/libsodium/1.0.18_1/include -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
リンク: clang -L/usr/local/lib -o vim -lm -lncurses -L/opt/homebrew/Cellar/libsodium/1.0.18_1/lib -lsodium -liconv -lintl -framework AppKit -L/opt/homebrew/opt/lua/lib -llua5.4 -mmacosx-version-min=13.3 -fstack-protector-strong -L/opt/homebrew/opt/perl/lib/perl5/5.36/darwin-thread-multi-2level/CORE -lperl -L/opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.11/lib/python3.11/config-3.11-darwin -lpython3.11 -framework CoreFoundation -lruby.3.2 -L/opt/homebrew/Cellar/ruby/3.2.2_1/lib

Provide a minimal init.vim/vimrc without plugin managers (Required!)

set rtp^=~/Develops/github.com/Shougo/pum.vim

" For visibility
hi def PumKind ctermbg=blue guibg=#0000ff

call pum#set_option(#{
      \ highlight_columns: #{ kind: 'PumKind' },
      \ })

inoremap <Tab> <Cmd>call pum#open(col('.'), [
      \ #{ word: 'hoge', kind: 'Test', menu: '[test]' },
      \ #{ word: 'fuga', kind: 'Test', menu: '[test]' },
      \ ])<CR>

How to reproduce the problem from neovim/Vim startup (Required!)

  1. Press <Tab> in insert mode.

Screen shot (if possible)

Upload the log messages by :redir and :message (if errored)

Nothing.

Max vertical items

Is there a way to limit the amount of items it shows but still allow them to be scrollable? Basically a max_horizontal_items but for vertical menu.

My use case is simple, I have multiple sources that populate pum.vim. Say I have 5 sources and each gives 5 candidates for completion. This will produce a total of 25 items, which means my completion window will get big. Would be nice to have it maxed, for example, 7 items and be scrollable.

`/` is highlighting popup inner text (Neovim only)

summary

In using / search, highlighted popup inner text.

environment

Neovim 0.6.0 (nightly)

minimal init.vim

set runtimepath^=~/repos/github.com/vim-denops/denops.vim
set runtimepath^=~/repos/github.com/Shougo/pum.vim
set runtimepath^=~/repos/github.com/Shougo/ddc.vim
set runtimepath^=~/repos/github.com/Shougo/ddc-around
set runtimepath^=~/repos/github.com/Shougo/ddc-matcher_head
set runtimepath^=~/repos/github.com/Shougo/ddc-sorter_rank

function! s:ddcinit() abort
  call ddc#custom#patch_global('sources', ['around'])

  call ddc#custom#patch_global('completionMenu', 'pum.vim')
  call ddc#custom#patch_global('backspaceCompletion', v:true)
  call ddc#custom#patch_global('autoCompleteEvents',
        \ ['InsertEnter', 'TextChangedI', 'TextChangedP'])
  call ddc#custom#patch_global('sources', ['around'])
  call ddc#custom#patch_global('sourceOptions', {
        \ '_': {
          \   'matchers': ['matcher_head'],
          \   'sorters': ['sorter_rank']},
          \ })

  call ddc#enable()
endfunction

autocmd User DenopsReady call s:ddcinit()

Popup closed when whole rewrites pre inserted word with feedkeys

Problem

Popup closed when whole rewrites pre inserted word with setline_insert option is v:false

To Reproduce

  1. Prepare following vimrc
set runtimepath+=~/pum.vim
inoremap <C-n>   <Cmd>call pum#map#insert_relative(+1)<CR>
inoremap <C-p>   <Cmd>call pum#map#insert_relative(-1)<CR>
let words = map(['foo', 'foobar', 'foobarbaz'], '{"word": v:val, "equal": v:true, "icase": v:true}')
autocmd TextChangedI * eval col('.') == 2 && pum#open(1, words)
  1. Run vim -u vimrc -N

  2. Type any characters and insert candidate
    (Note: When "fo", "foo", "foob"..., it works fine.)

Environment

Vim 8.2.3565
Neovim v0.6.0-dev+515-gd918759de
pum.vim b03c256

pum.vim changes 'backspace' option

Problems summary

When I open a floating window and confirm a conversion candidate, the 'backspace' option is changed to 'start'.

Expected

Do not change 'backspace'.

Environment Information (Required!)

  • pum.vim version(SHA1): latest

  • OS: macOS

  • neovim/Vim :version output:

NVIM v0.10.0-dev-1805+gec3c569dd-Homebrew
Build type: Release
LuaJIT 2.1.1700008891
Run ":verbose version" for more info

Provide a minimal init.vim/vimrc without plugin managers (Required!)

let s:plugins = [
      \ 'vim-denops/denops.vim',
      \ 'Shougo/ddc.vim',
      \ 'Shougo/pum.vim',
      \ 'Shougo/ddc-ui-pum',
      \ 'Shougo/ddc-source-around',
      \ ]

for item in s:plugins
  execute 'set runtimepath+=~/.cache/dein/repos/github.com/' . item
endfor

call ddc#custom#patch_global(#{
 \   ui: 'pum',
 \   sources: ['around'],
 \   autoCompleteEvents: ['InsertEnter', 'TextChangedI', 'TextChangedP', 'CmdlineEnter', 'CmdlineChanged'],
 \ })

inoremap <expr><C-n> pum#visible() ? pum#map#select_relative(+1, "empty") : '<Cmd>normal! gj<CR>'
inoremap <expr><C-p> pum#visible() ? pum#map#select_relative(-1, "empty") : '<Cmd>normal! gk<CR>'
inoremap <expr><CR>  pum#visible() ? pum#map#confirm() : '<CR>'

set backspace=indent,eol,start

call ddc#enable()

How to reproduce the problem from neovim/Vim startup (Required!)

  1. type hoge.
  2. type hoge and you can see a popup window with a hoge candidate.
  3. select hoge and confirm it.

Screenshot (if possible)

2023-12-10.10.38.48.mov

`CompleteDone` called two times at `use_complete` is enabled.

Problems summary

CompleteDone called two times at use_complete is enabled.
For example, expand of vsnip source was duplicate.

Expected

Want to call CompleteDone only once.

Environment Information (Required!)

  • pum.vim version(SHA1): 43f585f

  • OS: Arch Linux

  • neovim/Vim :version output:

NVIM v0.9.0-dev-368+g5eb5f4948-dirty
Build type: Debug
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions     -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security     -fstack-clash-protection -fcf-protection -Wp,-U_FORTIFY_SOURCE -Wp,-D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -DNVIM_TS_HAS_SET_ALLOCATOR -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=1 -I/data/builder/src/neovim/src/neovim/build/cmake.config -I/data/builder/src/neovim/src/neovim/src -I/data/builder/src/neovim/src/neovim/.deps/usr/include -I/usr/include -I/data/builder/src/neovim/src/neovim/build/src/nvim/auto -I/data/builder/src/neovim/src/neovim/build/include
Compiled by root

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/share/nvim"

Run :checkhealth for more info

Provide a minimal init.vim/vimrc without plugin managers (Required!)

function s:add(repo)
  let path = '/tmp/plug/' .. a:repo
  if !isdirectory(path)
    execute '!git clone --depth=1 https://github.com/' .. a:repo .. ' ' .. path
  endif
  execute 'set rtp^=' .. path
endfunction

call s:add('Shougo/ddc-ui-pum')
call s:add('Shougo/ddc.vim')
call s:add('Shougo/pum.vim')
call s:add('hrsh7th/completion-snippet')
call s:add('hrsh7th/vim-vsnip')
call s:add('hrsh7th/vim-vsnip-integ')
call s:add('vim-denops/denops.vim')

let g:vsnip_snippet_dir = '/tmp/plug/hrsh7th/completion-snippet/snippets'
call ddc#custom#patch_global('ui', 'pum')
call ddc#custom#patch_global('sources', ['vsnip'])
call ddc#enable()
inoremap <C-n>   <Cmd>call pum#map#insert_relative(+1)<CR>
inoremap <C-y>   <Cmd>call pum#map#confirm()<CR>
call pum#set_option('use_complete', v:true)

How to reproduce the problem from neovim/Vim startup (Required!)

  1. execute nvim -u init.vim
  2. set filetype to Vim script :setf vim
  3. type itry<C-n><C-y> to expand snippet.
  4. type any key(accidentally expand snippet at this time.)

Screen shot (if possible)

movie

Feature Request: Option to not select first result

I have a strong muscle memory from the native completion system where no option from the completion is selected when the popout shows until I press like <c-n> or <c-y>, would it possible to add?

It creates a bit of a UX inconsistency in that on first showing we have an item selected, but the input is not updated, if I press <c-n>, I move to the next item, the input gets updated to the new string, now if I go back up once, the input is updated to the first string:

CleanShot.2021-11-29.at.00.57.29.mp4

I understand some people may prefer this, but it would be nice to at least have an option to not have any option selected at first

Cannot auto expand snippet when use with ddc.vim.

I use ddc.vim and pum.vim to impove completion menu. But I found that if I use pum.vim to insead of then native completion menu, snippet always cannot auto expand after pum#map#confirm called.(I have test and get the same result between neovim native lsp and vsnip)
without use pum.vim:

without-pum-2022-06-12_15.18.07.mp4

with use pum.vim:

with-pum-2022-06-12_15.17.05.mp4

When user input any char, popup doesn't close

Summary

I expected:

// expand ddc-around and popup close
foobar
foo<TAB>baz -> foobarbaz

but actual:

// popup doesn't close
foo<TAB>baz -> foobaz

Environment

Neovim 0.6.0 (nightly) and Vim 8.2.3448

set runtimepath^=~/repos/github.com/vim-denops/denops.vim
set runtimepath^=~/repos/github.com/Shougo/pum.vim
set runtimepath^=~/repos/github.com/Shougo/ddc.vim
set runtimepath^=~/repos/github.com/Shougo/ddc-around
set runtimepath^=~/repos/github.com/Shougo/ddc-matcher_head
set runtimepath^=~/repos/github.com/Shougo/ddc-sorter_rank

if !has('nvim')
  set nocompatible
endif

function! s:puminit() abort
  inoremap <silent><expr> <TAB> pum#visible() ? '<Cmd>call pum#map#select_relative(+1)<CR>' : '<TAB>'
  inoremap <silent><expr> <S-TAB> pum#visible() ? '<Cmd>call pum#map#select_relative(-1)<CR>' : '<C-h>'
  inoremap <silent><expr> <CR> pum#visible() ? '<Cmd>call pum#map#confirm()<CR>' : '<CR>'
  inoremap <silent><expr> <Esc> pum#visible() ? '<Cmd>call pum#map#cancel()<CR>' : '<Esc>'
endfunction

function! s:ddcinit() abort
  call ddc#custom#patch_global('sources', ['around'])
  call s:puminit()

  call ddc#custom#patch_global('completionMenu', 'pum.vim')
  call ddc#custom#patch_global('backspaceCompletion', v:true)
  call ddc#custom#patch_global('autoCompleteEvents',
        \ ['InsertEnter', 'TextChangedI', 'TextChangedP'])
  call ddc#custom#patch_global('sources', ['around'])
  call ddc#custom#patch_global('sourceOptions', {
        \ '_': {
          \   'matchers': ['matcher_head'],
          \   'sorters': ['sorter_rank']},
          \ })

  call ddc#enable()
endfunction

autocmd User DenopsReady call s:ddcinit()

Executing `pum#map#cancel` after `pum#map#insert_relative` breaks input text for some ddc sources

Warning: I will close the issue without the minimal init.vim and the
reproduction instructions.

Problems summary

Thank you for creating many great plugins.
When executing pum#map#cancel after pum#map#insert_relative, the inserted text does not revert to original input text.
This weird behaviour only happens for some ddc sources(nvim-lsp, and vsnip at the moment) and does not happen in around source.

Expected

Executing pum#map#cancel should revert the inserted text to the original input text.

Environment Information (Required!)

  • pum.vim version(SHA1): b927e1a

  • OS: Arch Linux

  • neovim/Vim :version output:

NVIM v0.8.1
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by builduser

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info

Provide a minimal init.vim/vimrc without plugin managers (Required!)

" Your minimal init.lua
vim.opt.runtimepath:append({ '~/.dein/repos/github.com/vim-denops/denops.vim' })
vim.opt.runtimepath:append({ '~/.dein/repos/github.com/Shougo/ddc.vim' })
vim.opt.runtimepath:append({ '~/.dein/repos/github.com/Shougo/ddc-around' })
vim.opt.runtimepath:append({ '~/.dein/repos/github.com/tani/ddc-fuzzy' })
vim.opt.runtimepath:append({ '~/.dein/repos/github.com/hrsh7th/vim-vsnip' })
vim.opt.runtimepath:append({ '~/.dein/repos/github.com/hrsh7th/vim-vsnip-integ' })
vim.opt.runtimepath:append({ '~/.dein/repos/github.com/rafamadriz/friendly-snippets' })
vim.opt.runtimepath:append({ '~/.dein/repos/github.com/Shougo/ddc-ui-pum' })
vim.opt.runtimepath:append({ '~/.dein/repos/github.com/Shougo/pum.vim' })

vim.opt.completeopt = { 'menu', 'menuone', 'noinsert' }
vim.fn['pum#set_option']('use_complete', false)
vim.fn['pum#set_option']('scrollbar_char', '')
local ddc_opts = {
    ui = 'pum',
    autoCompleteEvents = { 'InsertEnter', 'TextChangedI', 'TextChangedP', 'CmdlineChanged', 'CmdlineEnter' },
    sources = { 'around', 'vsnip' },
    sourceOptions = {
        _ = {
            matchers = { 'matcher_fuzzy' },
            sorters = { 'sorter_fuzzy' }
        },
        ['vsnip'] = {
            mark = "[vs]",
            dup = 'keep',
            ignoreCase = true,
        },
        ['around'] = {
            mark = '[A]'
        }
    }
}

vim.fn['ddc#custom#patch_global'](ddc_opts)
vim.fn['ddc#enable']()

vim.cmd([[autocmd User PumCompleteDone call vsnip_integ#on_complete_done(g:pum#completed_item)]])

vim.keymap.set('i', '<C-y>', '<cmd>call pum#map#confirm()<cr>')
vim.keymap.set('i', '<C-e>', '<cmd>call pum#map#cancel()<cr>')
vim.keymap.set('i', '<C-n>', '<cmd>call pum#map#insert_relative(+1)<cr>')
vim.keymap.set('i', '<C-p>', '<cmd>call pum#map#insert_relative(-1)<cr>')

How to reproduce the problem from neovim/Vim startup (Required!)

  1. Save above settings to min_init.lua
  2. Start neovim and edit python file (I think it should be reproduced with other filetypes too)
       nvim -Nu min_init.lua test.py
    
  3. Please refer to screencast for detail

Screen shot (if possible)

Unexpected Behaviour (pum#cancel on vsnip source entry)

unexpected_behaviour

Expected Behaviour (pum#cancel on around source entry)

expected_behaviour

Upload the log messages by :redir and :message (if errored)

No error messages.

Vim throws error at pum#set_option

Hi, thank you for the awesome project.
I found an error when I use pum.vim in Vim, and not Neovim.
The minimal .vimrc is

call plug#begin('~/.vim/plugged')
Plug 'Shougo/pum.vim'
call plug#end()

call pum#set_option({})

Then, Vim throws the following error

$ cat vimrc
call plug#begin('~/.vim/plugged')
Plug 'Shougo/pum.vim'
call plug#end()

call pum#set_option({})
$ vim -u vimrc
Error detected while processing /home/tani/vimrc[5]..function pum#set_option[2]..pum#_options:
line    2:
E15: Invalid expression: "{"
Error detected while processing /home/tani/vimrc[5]..function pum#set_option:
line    2:
E712: Argument of extend() must be a List or Dictionary
Press ENTER or type command to continue

Cannot cancel completion when mapping `pum#map#cancel()` to `<BS>` (Neovim only)

I try to cancel completion by <BS> when pum is visible. It is working in Vim. However, in Neovim, it doesn't work. Mapping pum#map#confirm() to <CR> doesn't work also.

minimum vimrc:

if &compatible
  set nocompatible
endif

set runtimepath+=~/.cache/vim/dein/repos/github.com/vim-denops/denops.vim
set runtimepath+=~/.cache/vim/dein/repos/github.com/Shougo/ddc.vim
set runtimepath+=~/.cache/vim/dein/repos/github.com/Shougo/ddc-around
set runtimepath+=~/.cache/vim/dein/repos/github.com/Shougo/pum.vim

call ddc#custom#patch_global({
      \ 'sources': ['around'],
      \ 'completionMenu': 'pum.vim',
      \ })

function! BS() abort
  if pum#visible()
    call pum#map#cancel()
    return ''
  else
    return "\<BS>"
  endif
endfunction

function! CR() abort
  if pum#visible()
    call pum#map#confirm()
    return ''
  else
    return "\<CR>"
  endif
endfunction

inoremap <silent><expr> <BS> BS()
inoremap <silent><expr> <CR> CR()
inoremap <silent><expr> <TAB>
\ ddc#map#pum_visible() ? '<Cmd>call pum#map#select_relative(+1)<CR>' :
\ (col('.') <= 1 <Bar><Bar> getline('.')[col('.') - 2] =~# '\s') ?
\ '<TAB>' : ddc#map#manual_complete()

call ddc#enable()

`ddc#map#insert_relative()` overwrites right chars

summary

When fired ddc#map#insert_relative(), complemented text overwrites chars right of cursor.

foobar
|baz // "|" is cursor
foobar
foo<TAB>baz // use ddc-around
foobar
foobarz // "baz" is overwritten

environment

Vim 8.2.3448
Neovim 0.6.0 (nightly)

minimal .vimrc/init.vim

set runtimepath^=~/repos/github.com/vim-denops/denops.vim
set runtimepath^=~/repos/github.com/Shougo/pum.vim
set runtimepath^=~/repos/github.com/Shougo/ddc.vim
set runtimepath^=~/repos/github.com/Shougo/ddc-around
set runtimepath^=~/repos/github.com/Shougo/ddc-matcher_head
set runtimepath^=~/repos/github.com/Shougo/ddc-sorter_rank

if !has('nvim')
  set nocompatible
endif

function! s:ddcinit() abort
  inoremap <silent><expr> <TAB> pum#visible() ? '<Cmd>call pum#map#insert_relative(+1)<CR>' : '<TAB>'
  inoremap <silent><expr> <S-TAB> pum#visible() ? '<Cmd>call pum#map#insert_relative(-1)<CR>' : '<C-h>'
  inoremap <silent><expr> <CR> pum#visible() ? '<Cmd>call pum#map#confirm()<CR>' : '<CR>'
  imap <silent><expr> <Esc> pum#visible() ? '<Cmd>call pum#map#cancel()<CR>' : '<Esc>'

  call ddc#custom#patch_global('sources', ['around'])

  call ddc#custom#patch_global('completionMenu', 'pum.vim')
  call ddc#custom#patch_global('backspaceCompletion', v:true)
  call ddc#custom#patch_global('autoCompleteEvents',
        \ ['InsertEnter', 'TextChangedI', 'TextChangedP'])
  call ddc#custom#patch_global('sources', ['around'])
  call ddc#custom#patch_global('sourceOptions', {
        \ '_': {
          \   'matchers': ['matcher_head'],
          \   'sorters': ['sorter_rank']},
          \ })

  call ddc#enable()
endfunction

autocmd User DenopsReady call s:ddcinit()

Auto Imports Seem Broken With ddc/pum

It appears that when selecting an autoimport item from pum selection menu, the appropriate imports are not added:

Using pum.vim:

CleanShot.2021-11-27.at.17.04.28.mp4

Using built in completion menu:

CleanShot.2021-11-27.at.17.06.17.mp4

Notice how in this second one, the import gets added up top automatically?

Tab indentation not working when inoremap to `pum#map#insert_relative()`

Problem

If follow the steps of the README.md, and set the inoremap in ~/.vimrc like below,

inoremap <Tab>   <Cmd>call pum#map#insert_relative(+1)<CR>
inoremap <S-Tab> <Cmd>call pum#map#insert_relative(-1)<CR>

increment/decrement function doesn't work when type <Tab>/<S-Tab> in insert mode.

Is it expected behavior?

My Solution

I resolved the problem by defining my_insert_relative() and inoremap <Tab> my_insert_relative() like this:

function! s:my_insert_relative(number)
    if pum#visible()
        call pum#map#insert_relative(a:number)
    else
        if a:number > 0
            call feedkeys("\<Tab>", 'n')
            " `call feedkeys("\<C-o>>", 'n')` does't result expected behavior when cursor is not on a first character of a line
        else
            " call feedkeys("\<S-Tab>", 'n') unexpectedly feeds <Tab> key.
            " And I think there might be a more appropriate way than "\<C-o><<", but I don't know it.
            call feedkeys("\<C-o><<", 'n')
        endif
    endif
endfunction

inoremap <Tab>   <Cmd>call <SID>my_insert_relative(+1)<CR>
inoremap <S-Tab> <Cmd>call <SID>my_insert_relative(-1)<CR>

Proposal

I propose change README.md or implementation of pum#map#insert_relative() like above.

Consideration: pass 'n' option to feedkeys() disables re-mapping fed keys, so changing the implementation of pum#map#insert_relative() might lost some flexibility.

Other

The name of the argument of pum#map#insert_relative() is:

Would they be standarized?

pum#set_option is ignored in Neovim

This issue is related to #8 and it is for Neovim.
In vimrc, even if we set an option by pum#set_option,
the option is ignored in the following steps.

plug#begin('~/.vim/plugged')
Plug 'Shougo/pum.vim'
plug#end()

pum#set_option('border', 'single')
innoremap <C-n> <Cmd>call pum#insert_relative(+1)<CR>
  1. Vim set an option by pum#set_option when it loads vimrc
  2. User calls pum#map#insert_relative after the Neovim initialization
  3. Vim calls pum#_init and clears the s:options

To prevent this initialization, we need to call pum#_init before pum#set_option.

Thanks.

onCompleteDone is delayed when show new menu after typing with a word inserted.

Problems summary

onCompleteDone is delayed when show new menu after typing with a word inserted.

Expected

Always call onCompleteDone immediately.

Environment Information (Required!)

  • pum.vim version(SHA1): b05f66c

  • ddc.vim version(SHA1): 4ea5dc5a0c181a65e58b460d6f2d4e0e21616950

  • OS: Arch Linux

  • neovim/Vim :version output:

NVIM v0.10.0-dev-575+ge59cf3b3a-dirty
Build type: Debug
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wvla -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -fno-common -Wimplicit-fallthrough -fdiagnostics-color=auto -fstack-protector-strong -DNVIM_LOG_DEBUG -DUNIT_TESTING -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_TS_HAS_SET_MAX_START_DEPTH -I/data/builder/src/neovim/src/neovim/.deps/usr/include/luajit-2.1 -I/usr/include -I/data/builder/src/neovim/src/neovim/.deps/usr/include -I/data/builder/src/neovim/src/neovim/build/src/nvim/auto -I/data/builder/src/neovim/src/neovim/build/include -I/data/builder/src/neovim/src/neovim/build/cmake.config -I/data/builder/src/neovim/src/neovim/src

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/share/nvim"

Run :checkhealth for more info

Provide a minimal init.vim/vimrc without plugin managers (Required!)

set rtp+=/path/to/vim-denops/denops.vim
set rtp+=/path/to/Shougo/ddc.vim
set rtp+=/path/to/Shougo/ddc-ui-native
set rtp+=/path/to/Shougo/ddc-ui-pum
set rtp+=/path/to/Shougo/pum.vim
set noshowmode

call ddc#enable()
call ddc#register('source', expand('<sfile>:h') .. '/a.ts')
call ddc#custom#patch_global('ui', 'pum')
call ddc#custom#patch_global('sources', ['a'])
inoremap <C-n>   <Cmd>call pum#map#insert_relative(+1)<CR>
inoremap <C-y>   <Cmd>call pum#map#confirm()<CR>

and place this source to same directory of init.vim named "a.ts"

import { BaseSource } from "https://deno.land/x/[email protected]/types.ts";

type Params = Record<never, never>;

export class Source extends BaseSource<Params> {
  override async gather() {
    return [{
      word: "hoge",
      user_data: {},
    }];
  }

  override async onCompleteDone() {
    console.log(Math.random());
  }

  override params() {
    return {};
  }
}

How to reproduce the problem from neovim/Vim startup (Required!)

  1. Run nvim -u init.vim.
  2. Insert "ho" and insert candidate. (<C-n>)
  3. Type any alphabet. (If action that close menu(e.g. , , etc...), then works properly)

Not called at this timing and delayed until time to close menu.

Strange Overflow Behavior

As you can see from this screenshot, I am getting some strange overflow behavior. Is there something with my configuration I should be aware of?

CleanShot 2021-10-19 at 13 53 25

`auto_select` option breaks pum's view updating

Warning: I will close the issue without the minimal init.vim and the
reproduction instructions.

Problems summary

When user set auto_select option to v:true, pum.vim stops updating its view.

Expected

Environment Information (Required!)

  • pum.vim version(SHA1): 7900bb4

  • OS: Arch Linux on WSL2 (Distord)

  • neovim/Vim :version output:

NVIM v0.9.0-dev-273+g451b8d6cb
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/sbin/cc -DNVIM_TS_HAS_SET_MATCH_LIMIT -DNVIM_TS_HAS_SET_ALLOCATOR -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/ogaken/repos/github.com/neovim/neovim/build/cmake.config -I/home/ogaken/repos/github.com/neovim/neovim/src -I/home/ogaken/repos/github.com/neovim/neovim/.deps/usr/include -I/usr/include -I/home/ogaken/repos/github.com/neovim/neovim/build/src/nvim/auto -I/home/ogaken/repos/github.com/neovim/neovim/build/include
Compiled by ogaken@ogaken

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/home/ogaken/.local/share/nvim/share/nvim"

Run :checkhealth for more info

Provide a minimal init.vim/vimrc without plugin managers (Required!)

const s:packpath = expand('<sfile>:h') .. '/plugins/'
const s:optpackpath = s:packpath .. '/pack/foo/opt/'
if !isdirectory(s:optpackpath)
  call mkdir(s:optpackpath, 'p')
endif
exec printf('set packpath=%s', s:packpath)

function s:packadd(ghrepo)
  const l:installdir = s:optpackpath .. a:ghrepo
  if !isdirectory(l:installdir)
    call system(printf('git clone https://github.com/%s.git %s', a:ghrepo, l:installdir))
  endif
  exec printf('packadd %s', a:ghrepo)
endfunction

call s:packadd('vim-denops/denops.vim')
call s:packadd('Shougo/ddc.vim')
call s:packadd('Shougo/pum.vim')
call s:packadd('Shougo/ddc-ui-pum')
call s:packadd('Shougo/ddc-source-around')
call s:packadd('Shougo/ddc-matcher_head')

call ddc#custom#patch_global(#{
      \ ui: 'pum',
      \ sources: ['around'],
      \ sourceOptions: #{
      \   around: #{
      \     matchers: ['matcher_head'],
      \   }
      \ }})
call ddc#enable()

call pum#set_option('auto_select', v:true)

How to reproduce the problem from neovim/Vim startup (Required!)

  1. Put follow init.vim to any directory.
  2. Run Neovim by $ nvim -Nu ./init.vim ./init.vim
  3. Input any text in insert-mode

Screen shot (if possible)

pumvim.mp4

Upload the log messages by :redir and :message (if errored)

No error message was output

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.