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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

vim.tbl_islist is deprecated, use vim.islist instead #597

Closed
xarthurx opened this issue May 23, 2024 · 4 comments
Closed

vim.tbl_islist is deprecated, use vim.islist instead #597

xarthurx opened this issue May 23, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@xarthurx
Copy link

馃悰 Describe the bug

This bug is due to a recent upgrade of Neovim to v0.11.

When this plugin is loaded, nvim will report an error like this:
image

It seems it is caused by a call of a vim function.

Config

Not related. But provided below:

require("obsidian").setup({

	workspaces = {
		{
			name = "xVimObsidian",
			path = getWorkspacePath(),
		},
	},

	-- Optional, if you keep notes in a specific subdirectory of your vault.
	notes_subdir = "_quick.notes",

	-- Optional, completion of wiki links, local markdown links, and tags using nvim-cmp.
	completion = {
		-- Set to false to disable completion.
		nvim_cmp = true,
		-- Trigger completion at 2 chars.
		min_chars = 2,
	},
	-- Optional, configure key mappings. These are the defaults. If you don't want to set any keymappings this
	-- way then set 'mappings = {}'.
	mappings = {
		-- Overrides the 'gf' mapping to work on markdown/wiki links within your vault.
		["gf"] = {
			action = function()
				return require("obsidian").util.gf_passthrough()
			end,
			opts = { noremap = false, expr = true, buffer = true },
		},
		-- Toggle check-boxes.
		["<leader>ch"] = {
			action = function()
				return require("obsidian").util.toggle_checkbox()
			end,
			opts = { buffer = true },
		},
		-- -- Smart action depending on context, either follow link or toggle checkbox.
		["<cr>"] = {
			action = function()
				return require("obsidian").util.smart_action()
			end,
			opts = { buffer = true },
		},
	},

	-- Where to put new notes. Valid options are
	--  * "current_dir" - put new notes in same directory as the current buffer.
	--  * "notes_subdir" - put new notes in the default notes subdirectory.
	new_notes_location = "notes_subdir",

	-- Optional, customize how note IDs are generated given an optional title.
	---@param title string|?
	---@return string
	note_id_func = function(title)
		-- Create note IDs in a Zettelkasten format with a timestamp and a suffix.
		-- In this case a note with the title 'My new note' will be given an ID that looks
		-- like '1657296016-my-new-note', and therefore the file name '1657296016-my-new-note.md'
		local suffix = ""
		if title ~= nil then
			-- If title is given, transform it into valid file name.
			suffix = title:gsub(" ", "-"):gsub("[^A-Za-z0-9-]", ""):lower()
		else
			-- If title is nil, just add 4 random uppercase letters to the suffix.
			for _ = 1, 4 do
				suffix = suffix .. string.char(math.random(65, 90))
			end
		end
		return tostring(os.date("%Y-%m-%d-%H%M")) .. "_" .. suffix
	end,

	-- Optional, customize how note file names are generated given the ID, target directory, and title.
	---@param spec { id: string, dir: obsidian.Path, title: string|? }
	---@return string|obsidian.Path The full path to the new note.
	note_path_func = function(spec)
		-- This is equivalent to the default behavior.
		local path = spec.dir / tostring(spec.id)
		return path:with_suffix(".md")
	end,

	-- Optional, customize how wiki links are formatted. You can set this to one of:
	--  * "use_alias_only", e.g. '[[Foo Bar]]'
	--  * "prepend_note_id", e.g. '[[foo-bar|Foo Bar]]'
	--  * "prepend_note_path", e.g. '[[foo-bar.md|Foo Bar]]'
	--  * "use_path_only", e.g. '[[foo-bar.md]]'
	-- Or you can set it to a function that takes a table of options and returns a string, like this:
	wiki_link_func = function(opts)
		return require("obsidian.util").wiki_link_id_prefix(opts)
	end,

	-- Optional, customize how markdown links are formatted.
	markdown_link_func = function(opts)
		return require("obsidian.util").markdown_link(opts)
	end,

	-- Either 'wiki' or 'markdown'.
	preferred_link_style = "wiki",

	-- Optional, customize the default name or prefix when pasting images via `:ObsidianPasteImg`.
	---@return string
	image_name_func = function()
		-- Prefix image names with timestamp.
		return string.format("%s-", os.time())
	end,

	-- Specify how to handle attachments.
	attachments = {
		-- The default folder to place images in via `:ObsidianPasteImg`.
		-- If this is a relative path it will be interpreted as relative to the vault root.
		-- You can always override this per image by passing a full path to the command instead of just a filename.
		img_folder = "assets/imgs", -- This is the default
		-- A function that determines the text to insert in the note when pasting an image.
		-- It takes two arguments, the `obsidian.Client` and an `obsidian.Path` to the image file.
		-- This is the default implementation.
		---@param client obsidian.Client
		---@param path obsidian.Path the absolute path to the image file
		---@return string
		img_text_func = function(client, path)
			path = client:vault_relative_path(path) or path
			return string.format("![%s](%s)", path.name, path)
		end,
	},
})

Environment

NVIM v0.11.0-dev
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Run "nvim -V1 -v" for more info
@xarthurx xarthurx added the bug Something isn't working label May 23, 2024
@tris203
Copy link
Contributor

tris203 commented May 23, 2024

I have a PR to fix this in #593

@epwalsh
Copy link
Owner

epwalsh commented May 23, 2024

Closed via #593

@epwalsh epwalsh closed this as completed May 23, 2024
@azinsharaf
Copy link

hi @epwalsh, thanks for the great plugin. The issue still persist for me (nvim 0.11.0-dev). Not sure if this PR has been included in the 3.7.12 release yet.

@epwalsh
Copy link
Owner

epwalsh commented May 31, 2024

@azinsharaf looks like it did not make it in. After I get through the few PRs that have been on my backlog I'll cut a new release.

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

4 participants