Shougo / ddu-kind-file

File kind for ddu.vim
MIT License
25 stars 9 forks source link

`buflisted` is not set after the second time #17

Closed futsuuu closed 1 year ago

futsuuu commented 1 year ago

problem

If I open a file with itemAction open and delete its buffer with :bdelete, when I try to open the same file again, buflisted is not set.

1. call ddu#start()
2. call ddu#ui#do_action('itemAction') " name: 'open'
3. set buflisted? " -> buflisted
4. bdelete

5. call ddu#start()
6. call ddu#ui#do_action('itemAction') " name: 'open'
7. set buflisted? " -> nobuflisted

https://github.com/Shougo/ddu-kind-file/assets/105504350/a4662920-74b3-4856-a515-c7272ff691a2

environment

NVIM v0.10.0-dev-753+g4a06de40e
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3

init.vim

let s:plugins = [
    \ 'vim-denops/denops.vim',
    \ 'Shougo/ddu.vim',
    \ 'Shougo/ddu-ui-ff',
    \ 'Shougo/ddu-kind-file',
    \ 'Shougo/ddu-source-file_rec',
    \ ]

let s:plugin_dir = stdpath('data') .. '/plugins/'
for plugin in s:plugins
    let s:path = s:plugin_dir .. plugin
    if !isdirectory(s:path)
        let s:repo_url = 'https://github.com/' .. plugin
        execute '!git clone' s:repo_url s:path
    endif
    execute 'set rtp^=' .. s:path
endfor

call ddu#custom#patch_global({
    \   'ui': 'ff',
    \   'sources': [{'name': 'file_rec', 'params': {}}],
    \   'kindOptions': {
    \     'file': {
    \       'defaultAction': 'open',
    \     },
    \   }
    \ })

autocmd FileType ddu-ff call s:ddu_my_settings()
function! s:ddu_my_settings() abort
    nnoremap <buffer> <CR> <Cmd>call ddu#ui#do_action('itemAction')<CR>
endfunction

nnoremap <Space>f <Cmd>call ddu#start()<CR>
nnoremap <Space>b <Cmd>set buflisted?<CR>
nnoremap <Space>c <Cmd>bdelete<CR>
Shougo commented 1 year ago

It seems :buffer does not set buflisted. But :edit does set.

Shougo commented 1 year ago

Fixed