Skip to content

Windwos path with Colon (:) (ex: E:\repoes\README.md) can't open #725

Open
@hasansujon786

Description

@hasansujon786

Describe the bug

[[file:E:\repoes\react-native-apps\mini_sports\README.md::12]]
        ^
  Path with colon here

Default action ORG_OPEN_AT_POINT <leader>oo can't open this file.
The URL parser returns false on Windows.

Steps to reproduce

  1. Capture file path <leader>oc with a custom template that stores file location
-- my custom template
org_capture_templates = {
  m = {
    description = "Mark file",
    template = "** %?\n  %a",
    target = "~/my_vault/orgfiles/mark_files.org",
  },
}
  1. Put cursor on generated URL and press <leader>oo
* heading
[[file:E:\repoes\react-native-apps\mini_sports\README.md::12]
  1. Failed to open the file

Expected behavior

Open the file correctly.

Emacs functionality

No response

Minimal init.lua

vim.o.number = true
vim.g.mapleader = " "
vim.g.maplocalleader = " "

local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
	vim.fn.system({
		"git",
		"clone",
		"--filter=blob:none",
		"https://github.com/folke/lazy.nvim.git",
		"--branch=stable", -- latest stable release
		lazypath,
	})
end
vim.opt.rtp:prepend(lazypath)

require("lazy").setup({
	{
		"nvim-treesitter/nvim-treesitter",
		config = function()
			-- TSInstallSync javascript typescript tsx org
			local parsers = {
				"lua",
				"vim",
				"vimdoc",
			}

			require("nvim-treesitter.configs").setup({
				ensure_installed = parsers,
				highlight = {
					enable = true, -- false will disable the whole extension
					use_languagetree = false,
					disable = { "vim" },
					additional_vim_regex_highlighting = { "org", "vim", "markdown" }, -- Required since TS highlighter doesn't support all syntax features (conceal)
				},
				indent = { enable = true, disable = { "dart" } },
			})
		end,
	},
	{
		"nvim-orgmode/orgmode",
		-- lazy = true,
		-- ft = { 'org' },
		opts = {
			org_agenda_files = { "~/my_vault/orgfiles/**/*" },
			org_default_notes_file = "~/my_vault/orgfiles/refile.org",
			org_hide_leading_stars = true,
			org_hide_emphasis_markers = true,
			org_todo_keywords = { "TODO", "NEXT", "WORKING", "WAITING", "|", "DONE", "CANCELED" },
			org_capture_templates = {
				m = {
					description = "Mark file",
					template = "** %?\n  %a",
					target = "~/my_vault/orgfiles/mark_files.org",
				},
				t = {
					description = "Task",
					headline = "Quick Tasks",
					template = "** TODO %?\n  %u",
				},
			},
		},
	},
})

Screenshots and recordings

No response

OS / Distro

Windows 10

Neovim version/commit

0.9.5

Additional context

Please let me know If I can help you to debug if you don't use a Windows PC.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions