- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 136
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Description
Files with a path containing a $
character are not loaded in diffview. There are frontend routing frameworks that use the $
character for file-based routing.
Expected behavior
Files with a path containing a $
character can be viewed in diffview like any other file.
Actual behavior
Diffview seems to show the file under a path without the $
character. For example a file at the path $b/c
would become b/c
. Diffview will show this as a file that has been removed because it doesn't exist on disk. gf
will show the error
File does not exist on disk: 'b/c'
Steps to reproduce
mkdir -p a/\$b
cd a
git init
touch \$b/c
nvim \$b/c
:DiffviewOpen
gf
Health check
Output of :checkhealth diffview
==============================================================================
diffview: require("diffview.health").check()
Checking plugin dependencies ~
- OK nvim-web-devicons installed.
Checking VCS tools ~
- The plugin requires at least one of the supported VCS tools to be valid.
- OK Git found.
- OK Git is up-to-date. (2.48.1)
- WARNING Configured `hg_cmd` is not executable: 'hg'
Log info
Relevant info from :DiffviewLog
[ERROR 2025-02-19 11:41:32.311 -0800] ...cal/share/nvim/lazy/diffview.nvim/lua/diffview/utils.lua:42: File does not exist on disk: 'b/c'
Neovim version
NVIM v0.10.4
Build type: Release
LuaJIT 2.1.1713484068
Operating system and version
macOS Sonoma 14.4.1
Minimal config
-- #######################################
-- ### USAGE: nvim --clean -u mini.lua ###
-- #######################################
local root = vim.fn.stdpath("run") .. "/nvim/diffview.nvim"
local plugin_dir = root .. "/plugins"
vim.fn.mkdir(plugin_dir, "p")
for _, name in ipairs({ "config", "data", "state", "cache" }) do
vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end
local plugins = {
{ "nvim-web-devicons", url = "https://github.com/nvim-tree/nvim-web-devicons.git" },
{ "diffview.nvim", url = "https://github.com/sindrets/diffview.nvim.git" },
-- ##################################################################
-- ### ADD PLUGINS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE ###
-- ##################################################################
}
for _, spec in ipairs(plugins) do
local install_path = plugin_dir .. "/" .. spec[1]
if vim.fn.isdirectory(install_path) ~= 1 then
if spec.url then
print(string.format("Installing '%s'...", spec[1]))
vim.fn.system({ "git", "clone", "--depth=1", spec.url, install_path })
end
end
vim.opt.runtimepath:append(spec.path or install_path)
end
require("diffview").setup({
-- ##############################################################################
-- ### ADD DIFFVIEW.NVIM CONFIG THAT IS _NECESSARY_ FOR REPRODUCING THE ISSUE ###
-- ##############################################################################
})
vim.opt.termguicolors = true
vim.cmd("colorscheme " .. (vim.fn.has("nvim-0.8") == 1 and "habamax" or "slate"))
-- ############################################################################
-- ### ADD INIT.LUA SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE ###
-- ############################################################################
print("Ready!")
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Projects
Milestone
Relationships
Development
Select code repository
Activity
[-][Bug][/-][+][Bug] can't open files with path containing the `$` character[/+]bryankenote commentedon Feb 19, 2025
diffview.nvim/lua/diffview/path.lua
Lines 297 to 300 in 4516612
So it looks this is looking for environment vars in the path and trying to replace them with it's value.
raine commentedon Jul 11, 2025
Is there a fix?
Diffing does not work for paths with
$
in the filename.