From d2f6073cb4e9c4026041288cd5cab2b2a0337c5a Mon Sep 17 00:00:00 2001 From: iurii plugatarov Date: Sat, 3 Aug 2024 00:14:43 +0300 Subject: move to lua dir --- lua/config.lua | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 lua/config.lua (limited to 'lua/config.lua') diff --git a/lua/config.lua b/lua/config.lua new file mode 100644 index 0000000..999245d --- /dev/null +++ b/lua/config.lua @@ -0,0 +1,88 @@ +local M = {} + +-- Default configuration +M.defaults = { + notes_directory = "~/notes", + templates_directory = "~/notes/templates/", + keymaps = { + create_note = "tnn", + update_index = "tui", + search_notes = "tns", + select_template = "ttn", + toggle_quick_note = "qc", + create_quick_note = "nq", + open_entire_quick_note = "qo", + commit_notes = "tgc", + push_notes = "tgp", -- New keymap for pushing notes + }, +} + +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() +end + +function M.set_keymaps() + local keymaps = M.config.keymaps + + vim.api.nvim_set_keymap( + "n", + keymaps.create_note, + ':lua require("sketchbook.create_note").create_new_note()', + { 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()', + { noremap = true, silent = true, desc = "Update notes index" } + ) + vim.api.nvim_set_keymap( + "n", + keymaps.search_notes, + ':lua require("sketchbook.search_notes").search_notes()', + { noremap = true, silent = true, desc = "Search notes" } + ) + vim.api.nvim_set_keymap( + "n", + keymaps.select_template, + ':lua require("sketchbook.select_template").select_template()', + { 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()', + { 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()', + { 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()', + { 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()', + { 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()', + { noremap = true, silent = true, desc = "Push notes to remote Git repository" } + ) +end + +return M -- cgit 1.4.1-2-gfad0