diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-09-27 18:03:36 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-09-27 18:03:36 +0900 |
| commit | ed7bbe9a9bfa703533e812e4f5d1e56a489d73af (patch) | |
| tree | 2f942ac91c1dfac4787c6299d1d9836efe9fbdf0 | |
| parent | 6edeeaeb1cdaac6b3ce0cff366aa82f3db13d6b3 (diff) | |
updated nvim configurations and created snippet for journal
| -rw-r--r-- | mac/.config/TheSiahxyz/ftplugin/markdown.lua | 17 | ||||
| -rw-r--r-- | mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/lsp.lua | 15 | ||||
| -rw-r--r-- | mac/.config/TheSiahxyz/lua/TheSiahxyz/snippets/journal.lua | 85 |
3 files changed, 110 insertions, 7 deletions
diff --git a/mac/.config/TheSiahxyz/ftplugin/markdown.lua b/mac/.config/TheSiahxyz/ftplugin/markdown.lua index 49cf4ee..9088e68 100644 --- a/mac/.config/TheSiahxyz/ftplugin/markdown.lua +++ b/mac/.config/TheSiahxyz/ftplugin/markdown.lua @@ -250,7 +250,7 @@ vim.api.nvim_create_autocmd("FileType", { -- 로컬 옵션 vim.bo.textwidth = tw - vim.bo.formatoptions = vim.bo.formatoptions .. "a" -- 자동 줄바꿈 활성화 + vim.bo.formatoptions = vim.bo.formatoptions:gsub("a", "") vim.opt_local.wrap = true vim.opt_local.linebreak = true vim.opt_local.breakindent = true @@ -462,6 +462,21 @@ vim.keymap.set( -- preview vim.keymap.set("n", "<leader>mp", ":MarkdownPreview<CR>", { desc = "Markdown preview" }) +-- snippet +local ls = require("luasnip") + +vim.keymap.set({ "i", "s" }, "<C-n>", function() + if ls.choice_active() then + ls.change_choice(1) + end +end, { silent = true, desc = "LuaSnip next choice" }) + +vim.keymap.set({ "i", "s" }, "<C-p>", function() + if ls.choice_active() then + ls.change_choice(-1) + end +end, { silent = true, desc = "LuaSnip prev choice" }) + -- traversal vim.keymap.set("n", "<Tab>", "<Plug>Markdown_Fold", { desc = "Tab is for moving around only" }) diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/lsp.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/lsp.lua index da49976..4520597 100644 --- a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/lsp.lua +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/lsp.lua @@ -230,7 +230,10 @@ return { lint.linters_by_ft = { dockerfile = { "hadolint" }, javascript = { "eslint_d" }, + typescript = { "eslint_d" }, javascriptreact = { "eslint_d" }, + typescriptreact = { "eslint_d" }, + svelte = { "eslint_d" }, python = { "pylint" }, sh = { "shellcheck" }, sql = { "sqlfluff" }, @@ -333,12 +336,12 @@ return { require("conform").setup({ formatters_by_ft = { bash = { "shfmt" }, - css = { "prettier" }, + -- css = { "prettier" }, graphql = { "prettier" }, html = { "prettier" }, - javascript = { "prettier" }, - javascriptreact = { "prettier" }, - json = { "prettier" }, + -- javascript = { "prettier" }, + -- javascriptreact = { "prettier" }, + -- json = { "prettier" }, liquid = { "prettier" }, lua = { "stylua" }, markdown = { "prettier" }, @@ -346,8 +349,8 @@ return { sh = { "shfmt" }, sql = { "sql-formatter" }, svelte = { "prettier" }, - typescript = { "prettier" }, - typescriptreact = { "prettier" }, + -- typescript = { "prettier" }, + -- typescriptreact = { "prettier" }, vimwiki = { "prettier" }, yaml = { "prettier" }, zsh = { "beautysh" }, diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/snippets/journal.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/snippets/journal.lua new file mode 100644 index 0000000..e966924 --- /dev/null +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/snippets/journal.lua @@ -0,0 +1,85 @@ +local ls = require("luasnip") + +local s = ls.snippet +local i = ls.insert_node +local t = ls.text_node +local c = ls.choice_node +local f = ls.function_node + +local fmt = require("luasnip.extras.fmt").fmta + +-- get weather from wttr.in +local function get_weather() + local q = os.getenv("JOURNAL_WEATHER_QUERY") + local url = q and ("wttr.in/" .. q .. "?format=1") or "wttr.in/?format=1" + local handle = io.popen(("curl -m 2 -s '%s'"):format(url)) + if not handle then + return "" + end + local result = handle:read("*a") or "" + handle:close() + return (result:gsub("[\r\n]", "")) +end + +local journal_snippet = s( + "journal", + fmt( + [[--- +title: <title> +date: <date> +tags: [diary, journal] +mood: <mood> +weather: <weather> +--- + +# Daily Journal + +## Diary (Personal Events & Feelings) +- What happened today? +- How did I feel? +- Memorable moments + +## Journal (Learning & Reflections) +- What I learned today +- Challenges faced +- Ideas & inspirations + +## Plans for Tomorrow +- <plans> + +## Gratitude +- <gratitude> +]], + { + title = i(1, "My Journal"), + date = f(function() + return os.date("%Y-%m-%d") + end, {}), + mood = c(2, { + i(nil, ""), -- default: manual input + t("😊 happy"), + t("😢 sad"), + t("😴 tired"), + t("😤 stressed"), + t("😌 relaxed"), + t("🤩 excited"), + t("😟 anxious"), + t("🎯 focused"), + t("😐 neutral"), + t("🙏 grateful"), + t("🤒 sick"), + t("😡 angry"), + t("🌊 calm"), + t("😵 overwhelmed"), + t("💪 motivated"), + t("🥱 bored"), + }), + weather = f(get_weather, {}), + plans = i(3), + gratitude = i(4), + } + ) +) + +ls.add_snippets("markdown", { journal_snippet }) +ls.add_snippets("quarto", { journal_snippet }) |
