Provide a minimal init.vim/vimrc without plugin managers (Required!)
" Your minimal init.vim/vimrc
set rtp+=~/.cache/dein/nvim/repos/github.com/vim-denops/denops.vim
set rtp+=~/.cache/dein/nvim/repos/github.com/Shougo/ddu.vim
set rtp+=~/.cache/dein/nvim/repos/github.com/Shougo/ddu-ui-filer
set rtp+=~/.cache/dein/nvim/repos/github.com/Shougo/ddu-source-file
set rtp+=~/.cache/dein/nvim/repos/github.com/Shougo/ddu-kind-file
set rtp+=~/.cache/dein/nvim/repos/github.com/kamecha/ddu-column-custom
nnoremap [ddu] <Nop>
nmap <Space>u [ddu]
lua << EOF
vim.keymap.set('n', '[ddu]e', function()
local function getLengthCallback(args)
local length = 0
for _, item in ipairs(args.items) do
local display = item["word"]
if item["display"] ~= nil and item["display"] ~= "" then
display = item["display"]
end
display = " " .. "+" .. display
length = math.max(length, #display)
end
return length
end
local function getTextCallback(args)
local display = args.item["word"]
if args.item["display"] ~= nil and args.item["display"] ~= "" then
display = args.item["display"]
end
local text = ""
if args.item["__level"] == 0 then
if args.item["__expanded"] then
text = "-" .. display
else
text = "+" .. display
end
else
text = " " .. "|" ..display
end
return { text = text }
end
vim.fn["ddu#start"]({
ui = "filer",
resume = true,
sources = {
{
name = "file",
options = {
columns = {
{
name = "custom",
params = {
getLengthCallbackId = vim.fn["denops#callback#register"](getLengthCallback),
getTextCallbackId = vim.fn["denops#callback#register"](getTextCallback),
}
}
}
},
},
},
})
end, { remap = true })
EOF
autocmd FileType ddu-filer call s:ddu_filer_my_settings()
function s:ddu_filer_my_settings() abort
nnoremap <buffer> e
\ <Cmd>call ddu#ui#do_action('expandItem', {'mode': 'toggle'})<CR>
nnoremap <buffer> q
\ <Cmd>call ddu#ui#do_action('quit')<CR>
endfunction
How to reproduce the problem from neovim/Vim startup (Required!)
to fire expandItem action, current working directory has directory item.
type <Space>ue to start ddu
type e on directory item to fire ecpandItem action
type q to quit ddu
type <Space>ue to start ddu <- in this, the tree (expanded) does not resume... :sob:
Screenshot (if possible)
Upload the log messages by :redir and :message (if errored)
Note
what about ddu-column-custom
it is ddu column plugin I create.
this plugin allows you to set column with callback registered via denops#callback#register()
if I use vimscript to set via dictionary style, it works well
vimscript and use dictionary style ( ** it works correctly**)
function GetLengthCallback(args) abort
let length = 0
for item in a:args->get("items")
let display = item["word"]
if item->get("display") != 0 && item["display"] != ""
let display = item["display"]
endif
let display = " " .. "+" .. display
let length = max([length, len(display)])
endfor
return length
endfunction
function GetTextCallback(args) abort
let display = a:args->get("item")["word"]
if a:args->get("item")->get("display") != 0 && a:args->get("item")->get("display") != ""
let display = a:args->get("item")["display"]
endif
let text = ""
if a:args->get("item")["__level"] == 0
if a:args->get("item")["__expanded"]
let text = "-" .. display
else
let text = "+" .. display
endif
else
let text = " " .. "|" ..display
endif
return { "text": text }
endfunction
nmap <silent> [ddu]F <Cmd>call ddu#start(#{
\ ui: 'filer',
\ resume: v:true,
\ sources: [
\ #{
\ name: 'file',
\ options: #{
\ columns: [
\ #{
\ name: 'custom',
\ params: #{
\ getLengthCallbackId: denops#callback#register(function('GetLengthCallback')),
\ getTextCallbackId: denops#callback#register(function('GetTextCallback')),
\ }
\ }
\ ]
\ }
\ }
\ ],
\ })<CR>
if I don't use dictionary style setting, it works well
setting without dictionary style ( **it works correctly**)
lua << EOF
vim.keymap.set('n', '[ddu]E', function()
local function getLengthCallback(args)
local length = 0
for _, item in ipairs(args.items) do
local display = item["word"]
if item["display"] ~= nil and item["display"] ~= "" then
display = item["display"]
end
display = " " .. "+" .. display
length = math.max(length, #display)
end
return length
end
local function getTextCallback(args)
local display = args.item["word"]
if args.item["display"] ~= nil and args.item["display"] ~= "" then
display = args.item["display"]
end
local text = ""
if args.item["__level"] == 0 then
if args.item["__expanded"] then
text = "-" .. display
else
text = "+" .. display
end
else
text = " " .. "|" .. display
end
return { text = text }
end
vim.fn["ddu#start"]({
ui = "filer",
resume = true,
sources = {
{
name = "file",
options = { columns = { "custom" } },
},
},
columnParams = {
custom = {
getLengthCallbackId = vim.fn["denops#callback#register"](getLengthCallback),
getTextCallbackId = vim.fn["denops#callback#register"](getTextCallback),
}
},
})
end, { remap = true })
EOF
Warning: I will close the issue without the minimal init.vim and the reproduction instructions.
Problems summary
When I use ddu-column-custom via dictionary style ( in Neovim),
resume
option doesn't work.Expected
it is work as I set ddu-column-custom without dictionary style.
Environment Information
ddu.vim version (SHA1): 68bef91
denops.vim version (SHA1): 16d4bbc
deno version(
deno -V
output): deno 1.38.5OS: WSL2 Ubuntu 22.04.3
neovim/Vim
:version
output: NVIM v0.10.0-dev-1846+gf31f260f0 Build type: RelWithDebInfo LuaJIT 2.1.1702233742Provide a minimal init.vim/vimrc without plugin managers (Required!)
How to reproduce the problem from neovim/Vim startup (Required!)
to fire
expandItem
action, current working directory has directory item.<Space>
u
e
to start ddue
on directory item to fireecpandItem
actionq
to quit ddu<Space>
u
e
to start ddu <- in this, the tree (expanded) does not resume... :sob:Screenshot (if possible)
Upload the log messages by
:redir
and:message
(if errored)Note
denops#callback#register()
vimscript and use dictionary style ( ** it works correctly**)
setting without dictionary style ( **it works correctly**)