Skip to content

Cannot copy/move paste into empty directory #1736

Closed
@petobens

Description

@petobens

Description

If I cd into an empty directory and try to paste from clipboard nothing happens.

Neovim version

NVIM v0.9.0-dev-5e1687e-dirty
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3

Operating system and version

Arch Linux x86_64 6.0.7-arch1-1

nvim-tree version

latest master

Minimal config

local fn = vim.fn

-- Ignore default config and plugins and define new dirs
local test_dir = '/tmp/nvim-minimal'
vim.opt.runtimepath:remove(fn.expand('~/.config/nvim'))
vim.opt.packpath:remove(fn.expand('~/.local/share/nvim/site'))
vim.opt.runtimepath:append(fn.expand(test_dir))
vim.opt.packpath:append(fn.expand(test_dir))

-- Install packer
local install_path = test_dir .. '/pack/packer/start/packer.nvim'
if fn.empty(fn.glob(install_path)) > 0 then
    packer_bootstrap = fn.system({
        'git',
        'clone',
        '--depth',
        '1',
        'https://github.com/wbthomason/packer.nvim',
        install_path,
    })
    vim.cmd('packadd packer.nvim')
end

-- Setup packer
local packer = require('packer')
packer.init({
    package_root = test_dir .. '/pack',
    compile_path = test_dir .. '/plugin/packer_compiled.lua',
})
packer.startup(function(use)
    use('wbthomason/packer.nvim')
    use('nvim-tree/nvim-tree.lua')

    if packer_bootstrap then
        packer.sync()
    end
end)

-- Plugin setup
local ok, nvimtree = pcall(require, 'nvim-tree')
if ok then
    local tree_cb = require('nvim-tree.config').nvim_tree_callback
    local map_list = {
        { key = '<C-o>', cb = tree_cb('cd') },
        { key = 'u', cb = tree_cb('dir_up') },
        { key = 'F', cb = tree_cb('create') },
        { key = 'c', cb = tree_cb('copy') },
        { key = 'p', cb = tree_cb('paste') },
        { key = 'd', cb = tree_cb('remove') },
    }
    nvimtree.setup({
        view = {
            mappings = {
                custom_only = true,
                list = map_list,
            },
        },
    })
end

Steps to reproduce

As in the GIF

  1. Open nvim in a directory with a.txt and inner empty directory (inner) in my example
  2. Run :NvimTreeOpen to open the tree
  3. Press c to copy the a.txt file into the clipboard
  4. Press C-o on inner to cd into that empty directory
  5. Press p to paste into this empty directory -> nothing happens
  6. Press F to create a file b.txt
  7. Press p again to paste from clipboard -> the file a.txt file is now pasted

Expected behavior

After 5. above I expect to be able to paste the a.txt clipboard file

Actual behavior

After 5. nothing happens

nvimtree-paste

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingreproducedIssue confirmed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions