-
Notifications
You must be signed in to change notification settings - Fork 214
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
ObsidianTemplate command results in error with telescope #106
Comments
FYI @s-cassidy, maybe you can figure this out? @mertnuhoglu can you tell me which commit of telescope you're on? I'll try to reproduce. |
I've also run into this issue, the commit of telescope I'm on is |
I'll have a look when I get the chance. fzf-lua not inserting is probably that stupid whitespace thing. |
@mertnuhoglu could you post your |
I have a similar error when running This is my config: return {
"epwalsh/obsidian.nvim",
lazy = true,
event = "VeryLazy",
dependencies = {
"nvim-lua/plenary.nvim",
"hrsh7th/nvim-cmp",
"nvim-telescope/telescope.nvim",
},
opts = {
dir = "~/Documents/notes/notes", -- no need to call 'vim.fn.expand' here
-- Optional, if you keep daily notes in a separate directory.
daily_notes = {
folder = "Agenda",
},
-- Optional, completion.
completion = {
nvim_cmp = true, -- if using nvim-cmp, otherwise set to false
},
-- Optional, customize how names/IDs for new notes are created.
-- Optional, for templates (see below).
templates = {
subdir = "Templates",
date_format = "YY.MM.DD — dddd",
time_format = "HH:mm",
},
-- Optional, customize how names/IDs for new notes are created.
note_id_func = function(title)
return title
end,
finder = "telescope.nvim",
},
config = function(_, opts)
require("obsidian").setup(opts)
-- Optional, override the 'gf' keymap to utilize Obsidian's search functionality.
-- see also: 'follow_url_func' config option above.
vim.keymap.set("n", "gd", function()
if require("obsidian").util.cursor_on_markdown_link() then
return "<cmd>ObsidianFollowLink<CR>"
else
return "gd"
end
end, { noremap = false, expr = true })
end,
} |
I have the same error: [Obsidian] ...ocal/share/nvim/lazy/obsidian.nvim/lua/obsidian/util.lua:465:
...hare/nvim/lazy/telescope.nvim/lua/telescope/mappings.lua:308:
Attach mappings must always return a value. `true` means use default mappings, `false` means only use attached mappings Versions: $ nvim --version
NVIM v0.10.0-dev-29+g436e0147f
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wvla -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -fno-common -Wno-unused-result -Wimplicit-fallthrough -fdiagnostics-color=always -fstack-protector-strong -DUNIT_TESTING -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -I/home/lpanebr/build/neovim/.deps/usr/include/luajit-2.1 -I/usr/include -I/home/lpanebr/build/neovim/.deps/usr/include -I/home/lpanebr/build/neovim/build/src/nvim/auto -I/home/lpanebr/build/neovim/build/include -I/home/lpanebr/build/neovim/build/cmake.config -I/home/lpanebr/build/neovim/src -I/usr/include -I/home/lpanebr/build/neovim/.deps/usr/include -I/home/lpanebr/build/neovim/.deps/usr/include -I/home/lpanebr/build/neovim/.deps/usr/include -I/home/lpanebr/build/neovim/.deps/usr/include -I/home/lpanebr/build/neovim/.deps/usr/include -I/home/lpanebr/build/neovim/.deps/usr/include
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/local/share/nvim"
$ nvim --headless -c 'lua print(require("obsidian").VERSION)' -c q
1.10.0 |
The same bug, here the fix #137 |
* Provide custom format for dailynotes file name add type for config * update README: indicate custom date format for daily notes * Fix bug in ObsidianTemplate with telescope * Apply suggestions from code review custom date format: rename variables / adjust doc comments Co-authored-by: Pete <epwalsh10@gmail.com> * dailynotes: lint fix dailynotes: lint fix dailynotes: update changelog * Fix CHANGELOG for bug (#106) and PR (#137) * Fix CHANGELOG and README * Rename format_date to date_format and change its type to string. Add support for date_format to :ObsidianYesterday Fix README and CHANGELOG * Style fix for PR #138 --------- Co-authored-by: Anthony Balaine <abalaine@nexient.com> Co-authored-by: Antoine Balaine <54488126+AntoineBalaine@users.noreply.github.com> Co-authored-by: Pete <epwalsh10@gmail.com> Co-authored-by: Antoine Balaine <abalaineaccts@gmail.com> Co-authored-by: epwalsh <petew@allenai.org>
@lpanebr @nikbrunner @mertnuhoglu could you check with new version, this bug was fixed in #137 |
Hi there, After insert it looks like this: ## [[{{date:YY.MM.DD — dddd}}]]
> {{date:HH:mm}}
...
|
@nikbrunner I have a same problem due to Obsidian datetime format (https://momentjs.com/docs/#/displaying/format/). Now Obsidian.nvim supports only {{date}} {{time}} and {{title}}. So I plan to create separate daily journal template for obsidian.nvim |
This is correct; at the moment it only replaces the basic variables. If you set the date and title format in the Obsidian.md template settings you can set the format for all your templates without including the format string in the template. Then you can set an equivalent format in obsidian.nvim config using lua syntax. The same template should then work for both .md and .nvim -- it's only if you want different date/time formats for different templates that you need to format it in the template itself. Converting in-template |
it works. Thanks! |
Getting something similar:
my conf: require("obsidian").setup({
-- Required, the path to your vault directory.
dir = "~/tjroot/obsidian/paradigm-shifted",
-- Optional, if you keep notes in a specific subdirectory of your vault.
notes_subdir = "forrest-floor",
-- Optional, set the log level for obsidian.nvim. This is an integer corresponding to one of the log
-- levels defined by "vim.log.levels.*" or nil, which is equivalent to DEBUG (1).
log_level = vim.log.levels.DEBUG,
daily_notes = {
-- Optional, if you keep daily notes in a separate directory.
folder = "diaries",
-- Optional, if you want to change the date format for daily notes.
date_format = "%Y-%m-%d"
},
disable_frontmatter = true,
templates = {
subdir = "extra/templates",
date_format = "%Y-%m-%d-%a",
time_format = "%H:%M"
},
}) Filepath to templates: |
Got the same bug. Pined the package to https://github.com/epwalsh/obsidian.nvim/releases/tag/v1.11.0 and it works now. Seems a future commit re-introduced the bug |
@ngunyimacharia sorry about that, my last PR introduced the issue. Should be fixed now on |
Works well now, thank you for fixing this @epwalsh. Great work 🙌🏿 |
Works for me now too :) Excellent! @mertnuhoglu should the issue be closed? |
Is there any update on the fix for @mertnuhoglu's original problem? I'm getting the same issue.
VersionsOS: Windows 10
On telescope commit |
@TristanLeclair this is a compatibility issue with old versions of Telescope. I've fixed this in #230. |
🐛 Describe the bug
:ObsidianTemplate
command results in the following error:I disabled the telescope plugin and run the command with
fzf-lua
. This time the file selection window appeared correctly but template insertion didn't occur.Versions
❯ nvim --version
NVIM v0.8.3
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by brew@Monterey
Features: +acl +iconv +tui
See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/local/Cellar/neovim/0.8.3/share/nvim"
Run :checkhealth for more info
❯ nvim --headless -c 'lua print(require("obsidian").VERSION)' -c q
1.8.0
The text was updated successfully, but these errors were encountered: