Skip to content

Commit 41c2571

Browse files
committed
Merge branch 'main' into main
2 parents 2ec3d7b + 695f70d commit 41c2571

File tree

15 files changed

+479
-196
lines changed

15 files changed

+479
-196
lines changed

CHANGELOG.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
- Added default `image_name_func` similar to Obsidian's.
1313
- Added support `text/uri-list` to `ObsidianPasteImg`.
14+
- Added support for obsidian style `%%` comment
1415

1516
### Changed
1617

17-
- `ObsidianToggleCheckbox` now works in visual mode for multiline toggle
18-
- `ObsidianRename` input field is pre-filled filled with the current note id to ease renaming
18+
- Moved all commands into one `:Obsidian` command.
19+
- Added `opts.legacy_commands` option which enables the old commands.
20+
- `ObsidianToggleCheckbox` now works in visual mode for multiline toggle.
21+
- `ObsidianRename` input field is pre-filled filled with the current note id to ease renaming.
1922
- Improved type annotations for user commands: add `CommandArgs` type.
2023

2124
### Fixed
2225

2326
- Enhanced completion menu to correctly display and handle non-English (ex. Korean) file names and tags in link, fixing Unicode encoding issues
27+
- Fixed bug where `ObsidianRename` did not update the note_id if run in current buffer and not remove the old buffer
28+
- Fixed `<C-x>` not working after command merging
2429

2530
## [v3.10.0](https://github.com/obsidian-nvim/obsidian.nvim/releases/tag/v3.10.0) - 2025-04-12
2631

2732
### Added
2833

2934
- Added `opts.follow_img_func` option for customizing how to handle image paths.
3035
- Added better handling for undefined template fields, which will now be prompted for.
31-
- Added support for the [`snacks.picker`](https://github.com/folke/snacks.nvim/blob/main/docs/picker.md) picker
36+
- Added support for the [`snacks.picker`](https://github.com/folke/snacks.nvim/blob/main/docs/picker.md) picker.
3237
- Added support for the [`blink.cmp`](https://github.com/Saghen/blink.cmp) completion plugin.
3338
- Added health check module
3439
- Added a minimal sandbox script `minimal.lua`
@@ -39,7 +44,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3944
- Default to not activate ui render when `render-markdown.nvim` or `markview.nvim` is present
4045
- `smart_action` shows picker for tags (`ObsidianTag`) when cursor is on a tag
4146
- `ObsidianToggleCheckbox` now works with numbered lists
42-
- `Makefile` is friendlier: self-documenting and automatically gets dependencies
47+
- # `Makefile` is friendlier: self-documenting and automatically gets dependencies
48+
- Default to not activate ui render when `render-markdown.nvim` or `markview.nvim` is present.
4349

4450
### Fixed
4551

README.md

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -48,54 +48,54 @@ The fork aims to stay close to the original, but fix bugs, include and merge use
4848

4949
### Commands
5050

51-
- `:ObsidianOpen [QUERY]` to open a note in the Obsidian app.
51+
- `:Obsidian open [QUERY]` to open a note in the Obsidian app.
5252
This command has one optional argument: a query used to resolve the note to open by ID, path, or alias. If not given, the note corresponding to the current buffer is opened.
5353

54-
- `:ObsidianNew [TITLE]` to create a new note.
54+
- `:Obsidian new [TITLE]` to create a new note.
5555
This command has one optional argument: the title of the new note.
5656

57-
- `:ObsidianQuickSwitch` to quickly switch to (or open) another note in your vault, searching by its name using [ripgrep](https://github.com/BurntSushi/ripgrep) with your preferred picker (see [plugin dependencies](#plugin-dependencies) below).
57+
- `:Obsidian quick_switch` to quickly switch to (or open) another note in your vault, searching by its name using [ripgrep](https://github.com/BurntSushi/ripgrep) with your preferred picker (see [plugin dependencies](#plugin-dependencies) below).
5858

59-
- `:ObsidianFollowLink [vsplit|hsplit]` to follow a note reference under the cursor, optionally opening it in a vertical or horizontal split.
59+
- `:Obsidian follow_link [vsplit|hsplit]` to follow a note reference under the cursor, optionally opening it in a vertical or horizontal split.
6060

61-
- `:ObsidianBacklinks` for getting a picker list of references to the current buffer.
61+
- `:Obsidian backlinks` for getting a picker list of references to the current buffer.
6262

63-
- `:ObsidianTags [TAG ...]` for getting a picker list of all occurrences of the given tags.
63+
- `:Obsidian tags [TAG ...]` for getting a picker list of all occurrences of the given tags.
6464

65-
- `:ObsidianToday [OFFSET]` to open/create a new daily note. This command also takes an optional offset in days, e.g. use `:ObsidianToday -1` to go to yesterday's note. Unlike `:ObsidianYesterday` and `:ObsidianTomorrow` this command does not differentiate between weekdays and weekends.
65+
- `:Obsidian today [OFFSET]` to open/create a new daily note. This command also takes an optional offset in days, e.g. use `:Obsidian today -1` to go to yesterday's note. Unlike `:Obsidian yesterday` and `:Obsidian tomorrow` this command does not differentiate between weekdays and weekends.
6666

67-
- `:ObsidianYesterday` to open/create the daily note for the previous working day.
67+
- `:Obsidian yesterday` to open/create the daily note for the previous working day.
6868

69-
- `:ObsidianTomorrow` to open/create the daily note for the next working day.
69+
- `:Obsidian tomorrow` to open/create the daily note for the next working day.
7070

71-
- `:ObsidianDailies [OFFSET ...]` to open a picker list of daily notes. For example, `:ObsidianDailies -2 1` to list daily notes from 2 days ago until tomorrow.
71+
- `:Obsidian dailies [OFFSET ...]` to open a picker list of daily notes. For example, `:Obsidian dailies -2 1` to list daily notes from 2 days ago until tomorrow.
7272

73-
- `:ObsidianTemplate [NAME]` to insert a template from the templates folder, selecting from a list using your preferred picker. See ["using templates"](#using-templates) for more information.
73+
- `:Obsidian template [NAME]` to insert a template from the templates folder, selecting from a list using your preferred picker. See ["using templates"](#using-templates) for more information.
7474

75-
- `:ObsidianSearch [QUERY]` to search for (or create) notes in your vault using `ripgrep` with your preferred picker.
75+
- `:Obsidian search [QUERY]` to search for (or create) notes in your vault using `ripgrep` with your preferred picker.
7676

77-
- `:ObsidianLink [QUERY]` to link an inline visual selection of text to a note.
77+
- `:Obsidian link [QUERY]` to link an inline visual selection of text to a note.
7878
This command has one optional argument: a query that will be used to resolve the note by ID, path, or alias. If not given, the selected text will be used as the query.
7979

80-
- `:ObsidianLinkNew [TITLE]` to create a new note and link it to an inline visual selection of text.
80+
- `:Obsidian linknew [TITLE]` to create a new note and link it to an inline visual selection of text.
8181
This command has one optional argument: the title of the new note. If not given, the selected text will be used as the title.
8282

83-
- `:ObsidianLinks` to collect all links within the current buffer into a picker window.
83+
- `:Obsidian links` to collect all links within the current buffer into a picker window.
8484

85-
- `:ObsidianExtractNote [TITLE]` to extract the visually selected text into a new note and link to it.
85+
- `:Obsidian extract_note [TITLE]` to extract the visually selected text into a new note and link to it.
8686

87-
- `:ObsidianWorkspace [NAME]` to switch to another workspace.
87+
- `:Obsidian workspace [NAME]` to switch to another workspace.
8888

89-
- `:ObsidianPasteImg [IMGNAME]` to paste an image from the clipboard into the note at the cursor position by saving it to the vault and adding a markdown image link. You can configure the default folder to save images to with the `attachments.img_folder` option.
89+
- `:Obsidian paste_img [IMGNAME]` to paste an image from the clipboard into the note at the cursor position by saving it to the vault and adding a markdown image link. You can configure the default folder to save images to with the `attachments.img_folder` option.
9090

91-
- `:ObsidianRename [NEWNAME] [--dry-run]` to rename the note of the current buffer or reference under the cursor, updating all backlinks across the vault. Since this command is still relatively new and could potentially write a lot of changes to your vault, I highly recommend committing the current state of your vault (if you're using version control) before running it, or doing a dry-run first by appending "--dry-run" to the command, e.g. `:ObsidianRename new-id --dry-run`.
91+
- `:Obsidian rename [NEWNAME] [--dry-run]` to rename the note of the current buffer or reference under the cursor, updating all backlinks across the vault. Since this command is still relatively new and could potentially write a lot of changes to your vault, I highly recommend committing the current state of your vault (if you're using version control) before running it, or doing a dry-run first by appending "--dry-run" to the command, e.g. `:Obsidian rename new-id --dry-run`.
9292

93-
- `:ObsidianToggleCheckbox` to cycle through checkbox options.
93+
- `:Obsidian toggle_checkbox` to cycle through checkbox options.
9494

95-
- `:ObsidianNewFromTemplate [TITLE]` to create a new note from a template in the templates folder. Selecting from a list using your preferred picker.
95+
- `:Obsidian new_from_template [TITLE]` to create a new note from a template in the templates folder. Selecting from a list using your preferred picker.
9696
This command has one optional argument: the title of the new note.
9797

98-
- `:ObsidianTOC` to load the table of contents of the current note into a picker list.
98+
- `:Obsidian toc` to load the table of contents of the current note into a picker list.
9999

100100
### Demo
101101

@@ -111,11 +111,11 @@ The fork aims to stay close to the original, but fix bugs, include and merge use
111111

112112
Specific operating systems also require additional dependencies in order to use all of obsidian.nvim's functionality:
113113

114-
- **Windows WSL** users need [`wsl-open`](https://gitlab.com/4U6U57/wsl-open) for the `:ObsidianOpen` command.
115-
- **MacOS** users need [`pngpaste`](https://github.com/jcsalterego/pngpaste) (`brew install pngpaste`) for the `:ObsidianPasteImg` command.
116-
- **Linux** users need xclip (X11) or wl-clipboard (Wayland) for the `:ObsidianPasteImg` command.
114+
- **Windows WSL** users need [`wsl-open`](https://gitlab.com/4U6U57/wsl-open) for the `:Obsidian open` command.
115+
- **MacOS** users need [`pngpaste`](https://github.com/jcsalterego/pngpaste) (`brew install pngpaste`) for the `:Obsidian pasteimg` command.
116+
- **Linux** users need xclip (X11) or wl-clipboard (Wayland) for the `:Obsidian pasteimg` command.
117117

118-
Search functionality (e.g. via the `:ObsidianSearch` and `:ObsidianQuickSwitch` commands) also requires a picker such [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim) (see [plugin dependencies](#plugin-dependencies) below).
118+
Search functionality (e.g. via the `:Obsidian search` and `:Obsidian quickswitch` commands) also requires a picker such [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim) (see [plugin dependencies](#plugin-dependencies) below).
119119

120120
### Install and configure
121121

@@ -424,7 +424,7 @@ This is a complete list of all of the options that can be passed to `require("ob
424424
substitutions = {},
425425
},
426426

427-
-- Optional, by default when you use `:ObsidianFollowLink` on a link to an external
427+
-- Optional, by default when you use `:Obsidian followlink` on a link to an external
428428
-- URL it will be ignored but you can customize this behavior here.
429429
---@param url string
430430
follow_url_func = function(url)
@@ -435,7 +435,7 @@ This is a complete list of all of the options that can be passed to `require("ob
435435
-- vim.ui.open(url) -- need Neovim 0.10.0+
436436
end,
437437

438-
-- Optional, by default when you use `:ObsidianFollowLink` on a link to an image
438+
-- Optional, by default when you use `:Obsidian followlink` on a link to an image
439439
-- file it will be ignored but you can customize this behavior here.
440440
---@param img string
441441
follow_img_func = function(img)
@@ -448,7 +448,7 @@ This is a complete list of all of the options that can be passed to `require("ob
448448
-- https://github.com/Vinzent03/obsidian-advanced-uri
449449
use_advanced_uri = false,
450450

451-
-- Optional, set to true to force ':ObsidianOpen' to bring the app to the foreground.
451+
-- Optional, set to true to force ':Obsidian open' to bring the app to the foreground.
452452
open_app_foreground = false,
453453

454454
picker = {
@@ -472,7 +472,7 @@ This is a complete list of all of the options that can be passed to `require("ob
472472

473473
-- Optional, sort search results by "path", "modified", "accessed", or "created".
474474
-- The recommend value is "modified" and `true` for `sort_reversed`, which means, for example,
475-
-- that `:ObsidianQuickSwitch` will show the notes sorted by latest modified time
475+
-- that `:Obsidian quickswitch` will show the notes sorted by latest modified time
476476
sort_by = "modified",
477477
sort_reversed = true,
478478

@@ -559,7 +559,7 @@ This is a complete list of all of the options that can be passed to `require("ob
559559

560560
-- Specify how to handle attachments.
561561
attachments = {
562-
-- The default folder to place images in via `:ObsidianPasteImg`.
562+
-- The default folder to place images in via `:Obsidian pasteimg`.
563563
-- If this is a relative path it will be interpreted as relative to the vault root.
564564
-- You can always override this per image by passing a full path to the command instead of just a filename.
565565
img_folder = "assets/imgs", -- This is the default

after/ftplugin/markdown.lua

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
local obsidian = require "obsidian"
2+
local buf = vim.api.nvim_get_current_buf()
3+
local buf_dir = vim.fs.dirname(vim.api.nvim_buf_get_name(buf))
4+
5+
local client = obsidian.get_client()
6+
7+
local workspace = obsidian.Workspace.get_workspace_for_dir(buf_dir, client.opts.workspaces)
8+
if not workspace then
9+
return -- if not in any workspace.
10+
end
11+
12+
vim.o.commentstring = "%%%s%%"

after/syntax/markdown.vim

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
" Match %%...%% as comment
2+
syntax match Comment /%%\_.\{-}%%/

0 commit comments

Comments
 (0)