Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Can't open oil, if path contains sharp symbol (#) #96

Closed
3 tasks done
lolpie244 opened this issue Apr 29, 2023 · 2 comments
Closed
3 tasks done

bug: Can't open oil, if path contains sharp symbol (#) #96

lolpie244 opened this issue Apr 29, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@lolpie244
Copy link

lolpie244 commented Apr 29, 2023

Did you check the docs and existing issues?

  • I have read the docs
  • I have searched the existing issues

Neovim version (nvim -v)

v0.9.0

Operating system/version

Arch Linux, zsh

Describe the bug

If path to current working directory contains sharp symbol(#), I get error:
Error executing Lua callback: /oil.nvim/lua/oil/init.lua:351: Vim:E194: No alternate file name to substitute for '#'. [C]: in function 'edit'
And oil won't open

Steps To Reproduce

  1. mkdir #
  2. cd #
  3. nvim
  4. :Oil

Expected Behavior

Open Oil

Directory structure

No response

Repro

local select = function(params)
	local oil = require("oil")
	oil.select(params)
	vim.cmd.wincmd({ args = { "p" } })
	oil.close()
	vim.cmd.wincmd({ args = { "p" } })
end

local vertical_split = function()
	select({ vertical = true })
end

local split = function()
	select({ horizontal = true })
end


require("oil").setup({
	view_options = {
		show_hidden = true,
	},
	keymaps = {
		["<CR>"] = "actions.select",
		["<C-v>"] = vertical_split,
		["<C-s>"] = split,
		["<Leader>v"] = "actions.select_vsplit",
		["<Leader>s"] = "actions.select_split",
		["<C-p>"] = "actions.preview",
		["<Esc>"] = "actions.close",
		["-"] = "actions.parent",
		["_"] = "actions.open_cwd",
		["`"] = "actions.cd",
		["~"] = "actions.tcd",
		["g."] = "actions.toggle_hidden",
	},
})

Did you check the bug with a clean config?

  • I have confirmed that the bug reproduces with nvim -u repro.lua using the repro.lua file above.
@lolpie244 lolpie244 added the bug Something isn't working label Apr 29, 2023
@lolpie244 lolpie244 changed the title bug: Can't open oli, if path contains sharp symbol (#) bug: Can't open oil, if path contains sharp symbol (#) Apr 29, 2023
@stevearc
Copy link
Owner

stevearc commented May 5, 2023

This was because oil is using :edit under the hood, and :edit will auto expand # to be the alternate buffer name. Should be fixed now!

@stevearc stevearc closed this as completed May 5, 2023
@lolpie244
Copy link
Author

Yes, It works, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants