Skip to content

Commit 4033128

Browse files
feat: Option for no title or name in the node filename (#58)
* add node_no_name to not put the note title in the filename, just get the hash * copy the same modification to other conditions * update the documentation witn node_no_name
1 parent ec3fe9e commit 4033128

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ return {
6060
fuzzy_finder = "Telescope", -- OR "Fzf" OR "Snacks". Defaults to "Telescope"
6161
fuzzy_backlinks = false, -- Set to "true" for backlinks in fuzzy finder instead of buffer
6262
roam_base_directory = "", -- Directory in current workspace to store roam nodes
63+
node_no_name = false, -- no suffix name in node filename
6364
node_name_randomiser = false, -- Tokenise node name suffix for more randomisation
6465
node_name_snake_case = false, -- snake_case the names if node_name_randomiser = false
6566
}

lua/neorg/modules/external/roam/module.lua

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ module.config.public = {
1717
fuzzy_finder = "Telescope", -- or "Fzf" or "Snacks"
1818
fuzzy_backlinks = false,
1919
roam_base_directory = "",
20+
node_no_name = false,
2021
node_name_randomiser = false,
2122
node_name_snake_case = false,
2223
}
@@ -355,7 +356,9 @@ module.public = {
355356
vim.fn.mkdir(vault_dir, "p")
356357

357358
-- Create and open a new Neorg file with the generated title token
358-
vim.cmd("edit " .. vault_dir .. os.date("%Y%m%d%H%M%S-") .. title_token .. ".norg")
359+
title_token = module.config.public.node_no_name and "" or "-" .. title_token
360+
361+
vim.cmd("edit " .. vault_dir .. os.date("%Y%m%d%H%M%S") .. title_token .. ".norg")
359362
vim.cmd([[Neorg inject-metadata]])
360363

361364
-- Update the title in the newly created buffer
@@ -452,7 +455,9 @@ module.public = {
452455

453456
-- Create and open a new Neorg file with the generated title token
454457
vim.cmd("q")
455-
vim.cmd("edit " .. vault_dir .. "/" .. os.date("%Y%m%d%H%M%S-") .. title_token .. ".norg")
458+
title_token = module.config.public.node_no_name and "" or "-" .. title_token
459+
460+
vim.cmd("edit " .. vault_dir .. os.date("%Y%m%d%H%M%S") .. title_token .. ".norg")
456461
vim.cmd([[Neorg inject-metadata]])
457462

458463
-- Update the title in the newly created buffer
@@ -526,7 +531,9 @@ module.public = {
526531
vim.fn.mkdir(vault_dir, "p")
527532

528533
-- Create and open a new Neorg file with the generated title token
529-
vim.cmd("edit " .. vault_dir .. "/" .. os.date("%Y%m%d%H%M%S-") .. title_token .. ".norg")
534+
title_token = module.config.public.node_no_name and "" or "-" .. title_token
535+
536+
vim.cmd("edit " .. vault_dir .. os.date("%Y%m%d%H%M%S") .. title_token .. ".norg")
530537
vim.cmd([[Neorg inject-metadata]])
531538

532539
-- Update the title in the newly created buffer

0 commit comments

Comments
 (0)