about summary refs log tree commit diff
path: root/lua/sketchbook
diff options
context:
space:
mode:
Diffstat (limited to 'lua/sketchbook')
-rw-r--r--lua/sketchbook/config.lua151
-rw-r--r--lua/sketchbook/init.lua6
-rw-r--r--lua/sketchbook/list_notes.lua12
3 files changed, 91 insertions, 78 deletions
diff --git a/lua/sketchbook/config.lua b/lua/sketchbook/config.lua
index 999245d..c3d8854 100644
--- a/lua/sketchbook/config.lua
+++ b/lua/sketchbook/config.lua
@@ -2,87 +2,94 @@ local M = {}
 
 -- Default configuration
 M.defaults = {
-  notes_directory = "~/notes",
-  templates_directory = "~/notes/templates/",
-  keymaps = {
-    create_note = "<leader>tnn",
-    update_index = "<leader>tui",
-    search_notes = "<leader>tns",
-    select_template = "<leader>ttn",
-    toggle_quick_note = "<leader>qc",
-    create_quick_note = "<leader>nq",
-    open_entire_quick_note = "<leader>qo",
-    commit_notes = "<leader>tgc",
-    push_notes = "<leader>tgp", -- New keymap for pushing notes
-  },
+	notes_directory = "~/notes",
+	templates_directory = "~/notes/templates/",
+	keymaps = {
+		create_note = "<leader>tnn",
+		update_index = "<leader>tui",
+		search_notes = "<leader>tns",
+		select_template = "<leader>tmp",
+		toggle_quick_note = "<leader>qc",
+		create_quick_note = "<leader>nq",
+		open_entire_quick_note = "<leader>qo",
+		commit_notes = "<leader>tgc",
+		push_notes = "<leader>tgp",
+		list_notes = "<leader>tln",
+	},
 }
 
 M.config = {}
 
 function M.setup(user_config)
-  M.config = vim.tbl_deep_extend("force", {}, M.defaults, user_config or {})
-  vim.g.notes_directory = M.config.notes_directory
-  vim.g.notes_templates_dir = M.config.templates_directory
-  M.set_keymaps()
+	M.config = vim.tbl_deep_extend("force", {}, M.defaults, user_config or {})
+	vim.g.notes_directory = M.config.notes_directory
+	vim.g.notes_templates_dir = M.config.templates_directory
+	M.set_keymaps()
 end
 
 function M.set_keymaps()
-  local keymaps = M.config.keymaps
+	local keymaps = M.config.keymaps
 
-  vim.api.nvim_set_keymap(
-    "n",
-    keymaps.create_note,
-    ':lua require("sketchbook.create_note").create_new_note()<CR>',
-    { noremap = true, silent = true, desc = "Create a new note" }
-  )
-  vim.api.nvim_set_keymap(
-    "n",
-    keymaps.update_index,
-    ':lua require("sketchbook.update_index").update_index()<CR>',
-    { noremap = true, silent = true, desc = "Update notes index" }
-  )
-  vim.api.nvim_set_keymap(
-    "n",
-    keymaps.search_notes,
-    ':lua require("sketchbook.search_notes").search_notes()<CR>',
-    { noremap = true, silent = true, desc = "Search notes" }
-  )
-  vim.api.nvim_set_keymap(
-    "n",
-    keymaps.select_template,
-    ':lua require("sketchbook.select_template").select_template()<CR>',
-    { noremap = true, silent = true, desc = "Select a note template" }
-  )
-  vim.api.nvim_set_keymap(
-    "n",
-    keymaps.create_quick_note,
-    ':lua require("sketchbook.quick_note").create_quick_note_window()<CR>',
-    { noremap = true, silent = true, desc = "Create a quick note buffer" }
-  )
-  vim.api.nvim_set_keymap(
-    "n",
-    keymaps.toggle_quick_note,
-    ':lua require("sketchbook.quick_note").toggle_quick_note_window()<CR>',
-    { noremap = true, silent = true, desc = "Toggle quick note window" }
-  )
-  vim.api.nvim_set_keymap(
-    "n",
-    keymaps.open_entire_quick_note,
-    ':lua require("sketchbook.quick_note").open_entire_quick_note()<CR>',
-    { noremap = true, silent = true, desc = "Open entire quick note" }
-  )
-  vim.api.nvim_set_keymap(
-    "n",
-    keymaps.commit_notes,
-    ':lua require("sketchbook.git_sync").commit_notes()<CR>',
-    { noremap = true, silent = true, desc = "Commit notes to Git" }
-  )
-  vim.api.nvim_set_keymap(
-    "n",
-    keymaps.push_notes,
-    ':lua require("sketchbook.git_sync").push_notes()<CR>',
-    { noremap = true, silent = true, desc = "Push notes to remote Git repository" }
-  )
+	vim.api.nvim_set_keymap(
+		"n",
+		keymaps.create_note,
+		':lua require("sketchbook.create_note").create_new_note()<CR>',
+		{ noremap = true, silent = true, desc = "Create a new note" }
+	)
+	vim.api.nvim_set_keymap(
+		"n",
+		keymaps.update_index,
+		':lua require("sketchbook.update_index").update_index()<CR>',
+		{ noremap = true, silent = true, desc = "Update notes index" }
+	)
+	vim.api.nvim_set_keymap(
+		"n",
+		keymaps.search_notes,
+		':lua require("sketchbook.search_notes").search_notes()<CR>',
+		{ noremap = true, silent = true, desc = "Search notes" }
+	)
+	vim.api.nvim_set_keymap(
+		"n",
+		keymaps.select_template,
+		':lua require("sketchbook.select_template").select_template()<CR>',
+		{ noremap = true, silent = true, desc = "Select a note template" }
+	)
+	vim.api.nvim_set_keymap(
+		"n",
+		keymaps.create_quick_note,
+		':lua require("sketchbook.quick_note").create_quick_note_window()<CR>',
+		{ noremap = true, silent = true, desc = "Create a quick note buffer" }
+	)
+	vim.api.nvim_set_keymap(
+		"n",
+		keymaps.toggle_quick_note,
+		':lua require("sketchbook.quick_note").toggle_quick_note_window()<CR>',
+		{ noremap = true, silent = true, desc = "Toggle quick note window" }
+	)
+	vim.api.nvim_set_keymap(
+		"n",
+		keymaps.open_entire_quick_note,
+		':lua require("sketchbook.quick_note").open_entire_quick_note()<CR>',
+		{ noremap = true, silent = true, desc = "Open entire quick note" }
+	)
+	vim.api.nvim_set_keymap(
+		"n",
+		keymaps.commit_notes,
+		':lua require("sketchbook.git_sync").commit_notes()<CR>',
+		{ noremap = true, silent = true, desc = "Commit notes to Git" }
+	)
+	vim.api.nvim_set_keymap(
+		"n",
+		keymaps.push_notes,
+		':lua require("sketchbook.git_sync").push_notes()<CR>',
+		{ noremap = true, silent = true, desc = "Push notes to remote Git repository" }
+	)
+	vim.api.nvim_set_keymap(
+		"n",
+		keymaps.list_notes,
+		':lua require("plugins.sketchbook.list_notes").list_all_notes()<CR>',
+		{ noremap = true, silent = true, desc = "List all notes" }
+	)
 end
 
 return M
diff --git a/lua/sketchbook/init.lua b/lua/sketchbook/init.lua
index 421ae4c..de47142 100644
--- a/lua/sketchbook/init.lua
+++ b/lua/sketchbook/init.lua
@@ -1,10 +1,4 @@
 local config = require("sketchbook.config")
-local create_note = require("sketchbook.create_note")
-local update_index = require("sketchbook.update_index")
-local search_notes = require("sketchbook.search_notes")
-local select_template = require("sketchbook.select_template")
-local quick_note = require("sketchbook.quick_note")
-local git_support = require("sketchbook.git_sync")
 
 local M = {}
 
diff --git a/lua/sketchbook/list_notes.lua b/lua/sketchbook/list_notes.lua
new file mode 100644
index 0000000..c590fee
--- /dev/null
+++ b/lua/sketchbook/list_notes.lua
@@ -0,0 +1,12 @@
+local M = {}
+
+function M.list_all_notes()
+	local notes_dir = vim.g.notes_directory or "~/notes/"
+	require("telescope.builtin").find_files({
+		prompt_title = "Find Notes",
+		cwd = notes_dir,
+		hidden = true,
+	})
+end
+
+return M