Shougo / ddu-filter-sorter_alpha

Alphabet sorter for ddu.vim
MIT License
1 stars 0 forks source link

directory items in the expanded directory are not sorted #2

Closed glassesneo closed 5 months ago

glassesneo commented 5 months ago

Problem summerly

directory Items in the expanded directory are not sorted in alphabetical order

Environment information

minimal vimrc

set rtp+=~/.cache/dpp/repos/github.com/vim-denops/denops.vim
set rtp+=~/.cache/dpp/repos/github.com/Shougo/ddu.vim
set rtp+=~/.cache/dpp/repos/github.com/Shougo/ddu-ui-filer
set rtp+=~/.cache/dpp/repos/github.com/Shougo/ddu-source-file
set rtp+=~/.cache/dpp/repos/github.com/Shougo/ddu-kind-file
set rtp+=~/.cache/dpp/repos/github.com/Shougo/ddu-column-filename
set rtp+=~/.cache/dpp/repos/github.com/Shougo/ddu-filter-sorter_alpha

lua <<EOF
local doAction = vim.fn["ddu#ui#async_action"]

vim.fn["ddu#custom#patch_local"]("filer", {
  ui = "filer",
  uiParams = {
    filer = {
      split = "floating",
      splitDirection = "floating",
      floatingBorder = "rounded",
    },
  },
  sources = { "file" },
  sourceOptions = {
    file = {
      sorters = {
        "sorter_alpha",
      },
      columns = {
        "filename",
      },
    },
  },
})

---@param mode string|string[]
---@param key string
---@param action string
---@param args? table
local function mapAction(mode, key, action, args)
  vim.keymap.set(mode, key, function()
    if args ~= nil and next(args) then
      doAction(action, args)
    else
      doAction(action)
    end
  end, { noremap = true, silent = true, buffer = true })
end

vim.api.nvim_create_autocmd("FileType", {
  pattern = "ddu-filer",
  callback = function()
    mapAction("n", "q", "quit")
    mapAction("n", "<CR>", "itemAction", { name = "narrow" })
    mapAction("n", "l", "expandItem")
    mapAction("n", "h", "collapseItem")
  end,
})
EOF

nnoremap <Space><Space> <Cmd>call ddu#start(#{ name: 'filer' })<CR>
call ddu#start(#{ name: 'filer' })

How to reproduce the problem

  1. run ddu#start(#{name: 'filer'}) with the config above
  2. expand a directory

Screenshot

https://github.com/Shougo/ddu-filter-sorter_alpha/assets/61031352/12250738-9d36-4ee5-a84e-fdd2e3e4baae

Shougo commented 5 months ago

I get the reason.

Fixed.