diff --git a/lazy-lock.json b/lazy-lock.json index a07cd6d9b..72c4fb5ea 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -5,7 +5,7 @@ }, "LuaSnip": { "branch": "master", - "commit": "0b4950a237ce441a6a3a947d501622453f6860ea" + "commit": "e81cbe6004051c390721d8570a4a0541ceb0df10" }, "accelerated-jk.nvim": { "branch": "main", @@ -29,7 +29,7 @@ }, "bufferline.nvim": { "branch": "main", - "commit": "d24378edc14a675c820a303b4512af3bbc5761e9" + "commit": "99f0932365b34e22549ff58e1bea388465d15e99" }, "catppuccin": { "branch": "refactor/syntax-highlighting", @@ -55,6 +55,10 @@ "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, + "cmp-pandoc-references": { + "branch": "master", + "commit": "0f84af3682be2845775f811b82251edeadb8faf6" + }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" @@ -109,11 +113,11 @@ }, "focus.nvim": { "branch": "master", - "commit": "31f41d91b6b331faa07f0a513adcbc37087d028d" + "commit": "a994282f957840ee3419ad62a36be9d4e155560c" }, "friendly-snippets": { "branch": "main", - "commit": "4aed1a0ca605cb1c87f59799a0cc4afe00a40272" + "commit": "bc38057e513458cb2486b6cd82d365fa294ee398" }, "fzy-lua-native": { "branch": "master", @@ -121,27 +125,31 @@ }, "gitsigns.nvim": { "branch": "main", - "commit": "adcf2c7f2f495f5df148683764bf7cba6a70f34c" + "commit": "11b80e7eea249affc8776483272bcfc627b5552a" }, "hop.nvim": { "branch": "master", - "commit": "31e0e42e629bf16affea747132d9c54f55fb17c8" + "commit": "e41c04125fab05406be576640749352ad3eafcdb" }, "indent-blankline.nvim": { "branch": "master", "commit": "4541d690816cb99a7fc248f1486aa87f3abce91c" }, + "knap": { + "branch": "main", + "commit": "503010f541696e99ed5c62f658620e546cebf8b0" + }, "lazy.nvim": { "branch": "main", "commit": "3ad55ae678876516156cca2f361c51f7952a924b" }, "lsp_signature.nvim": { "branch": "master", - "commit": "b36080555e393402bc9484ce0e60d8b6cd23d426" + "commit": "58d4e810801da74c29313da86075d6aea537501f" }, "lspsaga.nvim": { "branch": "main", - "commit": "d3ac8b98f207ef355ab968726996702f7ce41b99" + "commit": "23a481f0b142f4498e2fc2dd80e7a404079833e6" }, "lualine.nvim": { "branch": "master", @@ -165,7 +173,7 @@ }, "mason.nvim": { "branch": "main", - "commit": "3f6b544c75c01549f7a2a9e395e0f1cea42b25dd" + "commit": "fe9e34a9ab4d64321cdc3ecab4ea1809239bb73f" }, "neodim": { "branch": "master", @@ -197,7 +205,7 @@ }, "nvim-dap": { "branch": "master", - "commit": "d17d1bba23ec72a157bd183c57840c39e323f515" + "commit": "0a02ed103e4da1928dc88428248dec7bb5ee6f34" }, "nvim-dap-ui": { "branch": "master", @@ -205,7 +213,7 @@ }, "nvim-lspconfig": { "branch": "master", - "commit": "dd11ba7b3c8f82d51b6d4dd7d68fce2d78bf78a0" + "commit": "b6091272422bb0fbd729f7f5d17a56d37499c54f" }, "nvim-notify": { "branch": "master", @@ -213,7 +221,7 @@ }, "nvim-scrollview": { "branch": "main", - "commit": "c0dc4822e0b87d10569c55d7189c6147ad03538b" + "commit": "dc236a2e6503f46598554d0955fe897dbcfa4807" }, "nvim-tree.lua": { "branch": "master", @@ -225,7 +233,7 @@ }, "nvim-treesitter": { "branch": "master", - "commit": "7b04e8b67eec7d92daadf9f0717dd272ddfc81a3" + "commit": "736a672afe852dbad4199002c89b7461b285c47f" }, "nvim-treesitter-context": { "branch": "master", @@ -233,7 +241,7 @@ }, "nvim-treesitter-textobjects": { "branch": "master", - "commit": "ef32a5c24b767d165ed63fd2b24ac8dc52742521" + "commit": "9e519b6146512c8e2e702faf8ac48420f4f5deec" }, "nvim-ts-autotag": { "branch": "main", @@ -249,7 +257,7 @@ }, "obsidian.nvim": { "branch": "main", - "commit": "1982447bd8481bf5b8e6e033519d54feb77a4e41" + "commit": "1534187b4e3eee40053918388460c739d2b76da4" }, "paint.nvim": { "branch": "main", @@ -257,7 +265,7 @@ }, "persisted.nvim": { "branch": "main", - "commit": "b03c863731eafacd973912383297ea5d8fdb006a" + "commit": "c1c4bbff8a4e9b9f66812b2daa9d3338916e8da2" }, "plenary.nvim": { "branch": "master", @@ -281,7 +289,7 @@ }, "sniprun": { "branch": "master", - "commit": "4762952f3d206d41eedb789e10741de75d1391a3" + "commit": "6f9025bf475799bc0fbe8b338b3912f4a701ff81" }, "specs.nvim": { "branch": "main", @@ -299,6 +307,10 @@ "branch": "master", "commit": "0d275c8d25f32457e67b5c66d6ae43f26a61bce5" }, + "telescope-bibtex.nvim": { + "branch": "master", + "commit": "0b01f5c457f208ff2e12ce4dae89a61eec1ed69d" + }, "telescope-frecency.nvim": { "branch": "master", "commit": "62d3381a32ae541233b03a129ece0aeced30ad5e" @@ -329,7 +341,7 @@ }, "trouble.nvim": { "branch": "main", - "commit": "0e6703c1d37d2d34ed029ab54f9bd66e3f2ecbf7" + "commit": "fc4bb22b1d2cd5eb46fe61a9f6d6416d742beb5c" }, "vim-cool": { "branch": "master", @@ -361,7 +373,7 @@ }, "vimtex": { "branch": "master", - "commit": "5e50cc0e96e8a8ffc6fd10d627d65b8d1354b5da" + "commit": "877de3ba5de5f766e5bfa1c3fb0d2ecfcd18f868" }, "which-key.nvim": { "branch": "main", diff --git a/lua/keymap/tool.lua b/lua/keymap/tool.lua index 6ff95a782..08b2de2bc 100644 --- a/lua/keymap/tool.lua +++ b/lua/keymap/tool.lua @@ -123,6 +123,10 @@ local plug_map = { :with_noremap() :with_silent() :with_desc("ui: Change colorscheme for current session"), + ["n|fC"] = map_cu("Telescope bibtex") + :with_noremap() + :with_silent() + :with_desc("cite: Insert citation from bibtex"), ["n|fn"] = map_cu(":enew"):with_noremap():with_silent():with_desc("buffer: New"), ["n|fg"] = map_cu("Telescope git_files") :with_noremap() diff --git a/lua/modules/configs/completion/cmp.lua b/lua/modules/configs/completion/cmp.lua index 0cb8ba3c6..614549857 100644 --- a/lua/modules/configs/completion/cmp.lua +++ b/lua/modules/configs/completion/cmp.lua @@ -86,6 +86,7 @@ return function() treesitter = "[TS]", luasnip = "[SNIP]", spell = "[SPELL]", + pandoc_references = "[PANDOC]", }, { __index = function() return "[BTN]" -- builtin/unknown source names @@ -153,6 +154,7 @@ return function() { name = "buffer" }, { name = "latex_symbols" }, { name = "copilot" }, + { name = "pandoc_references" }, -- { name = "codeium" }, -- { name = "cmp_tabnine" }, }, diff --git a/lua/modules/configs/editor/treesitter.lua b/lua/modules/configs/editor/treesitter.lua index 2ee63f399..5eda6b215 100644 --- a/lua/modules/configs/editor/treesitter.lua +++ b/lua/modules/configs/editor/treesitter.lua @@ -37,7 +37,7 @@ return vim.schedule_wrap(function() local ok, is_large_file = pcall(vim.api.nvim_buf_get_var, bufnr, "bigfile_disable_treesitter") return ok and is_large_file end, - additional_vim_regex_highlighting = { "c", "cpp" }, + additional_vim_regex_highlighting = { "c", "cpp", "markdown" }, }, textobjects = { select = { diff --git a/lua/modules/configs/tool/obsidian.lua b/lua/modules/configs/tool/obsidian.lua index 69f78c312..c784b7055 100644 --- a/lua/modules/configs/tool/obsidian.lua +++ b/lua/modules/configs/tool/obsidian.lua @@ -1,3 +1,44 @@ -return function(_, opts) - require("obsidian").setup(opts) +return function() + require("obsidian").setup({ + dir = "/Users/tonywu/Library/Mobile Documents/com~apple~CloudDocs/MPhil/Work/Final_thesis", + completion = { + -- If using nvim-cmp, otherwise set to false + nvim_cmp = true, + -- Trigger completion at 2 chars + min_chars = 2, + -- Where to put new notes created from completion. Valid options are + -- * "current_dir" - put new notes in same directory as the current buffer. + -- * "notes_subdir" - put new notes in the default notes subdirectory. + new_notes_location = "current_dir", + prepend_note_id = false, + }, + note_id_func = function(title) + -- Create note IDs in a Zettelkasten format with a timestamp and a suffix. + -- In this case a note with the title 'My new note' will given an ID that looks + -- like '1657296016-my-new-note', and therefore the file name '1657296016-my-new-note.md' + local suffix = "" + if title ~= nil then + -- If title is given, transform it into valid file name. + suffix = title:gsub(" ", "-"):gsub("[^A-Za-z0-9-]", ""):lower() + else + -- If title is nil, just add 4 random uppercase letters to the suffix. + for _ = 1, 4 do + suffix = suffix .. string.char(math.random(65, 90)) + end + end + return tostring(os.time()) .. "-" .. suffix + end, + note_frontmatter_func = function(note) + -- This is equivalent to the default frontmatter function. + local out = { id = note.id, aliases = note.aliases, tags = note.tags, todos = note.todos } + -- `note.metadata` contains any manually added fields in the frontmatter. + -- So here we just make sure those fields are kept in the frontmatter. + if note.metadata ~= nil and require("obsidian").util.table_length(note.metadata) > 0 then + for k, v in pairs(note.metadata) do + out[k] = v + end + end + return out + end, + }) end diff --git a/lua/modules/configs/tool/telescope.lua b/lua/modules/configs/tool/telescope.lua index cdd38cea6..f42f74fdd 100644 --- a/lua/modules/configs/tool/telescope.lua +++ b/lua/modules/configs/tool/telescope.lua @@ -90,4 +90,5 @@ return function() require("telescope").load_extension("undo") require("telescope").load_extension("zoxide") require("telescope").load_extension("persisted") + require("telescope").load_extension("bibtex") end diff --git a/lua/modules/plugins/completion.lua b/lua/modules/plugins/completion.lua index db882eb47..b96d5be73 100644 --- a/lua/modules/plugins/completion.lua +++ b/lua/modules/plugins/completion.lua @@ -48,6 +48,7 @@ completion["hrsh7th/nvim-cmp"] = { { "hrsh7th/cmp-buffer" }, { "kdheepak/cmp-latex-symbols" }, { "ray-x/cmp-treesitter", commit = "c8e3a74" }, + { "TonyWu20/cmp-pandoc-references" }, -- { "tzachar/cmp-tabnine", build = "./install.sh", config = require("completion.tabnine") }, -- { -- "jcdickinson/codeium.nvim", diff --git a/lua/modules/plugins/tool.lua b/lua/modules/plugins/tool.lua index 3b5dd88b1..18ccac251 100644 --- a/lua/modules/plugins/tool.lua +++ b/lua/modules/plugins/tool.lua @@ -98,6 +98,7 @@ tool["nvim-telescope/telescope.nvim"] = { } }, { "jvgrootveld/telescope-zoxide" }, { "nvim-telescope/telescope-live-grep-args.nvim" }, + { "nvim-telescope/telescope-bibtex.nvim" }, }, }