From 0ef267297eaaa41653fb6ca7cc5c94f909a5b7f1 Mon Sep 17 00:00:00 2001 From: Roman Date: Fri, 10 Jul 2026 20:32:07 +0200 Subject: [PATCH] better markdown defaults --- nvim/.config/nvim/README.md | 10 ++++++++-- nvim/.config/nvim/after/ftplugin/markdown.lua | 8 ++++++++ nvim/.config/nvim/lua/romanzy/keymaps.lua | 20 +++++++++++-------- 3 files changed, 28 insertions(+), 10 deletions(-) create mode 100644 nvim/.config/nvim/after/ftplugin/markdown.lua diff --git a/nvim/.config/nvim/README.md b/nvim/.config/nvim/README.md index ec8e8ca..98d6dac 100644 --- a/nvim/.config/nvim/README.md +++ b/nvim/.config/nvim/README.md @@ -44,6 +44,12 @@ Git shortcuts: - `:Git` to run commands directly (`:Git status`, `:Git log --oneline`) - `lg` open LazyGit +Toggle shortcuts: + +- `tw` toggle soft wrap +- `ti` toggle inline diagnostics +- `tv` toggle virtual diagnostics + Oil usage: - `dl` opens the file browser @@ -104,8 +110,8 @@ Diagnostics: - `g.` open diagnostic float - `gl` send diagnostics to the location list - `gld` display diagnostic information -- `gid` toggle inline diagnostics -- `gvd` toggle virtual line diagnostics +- `ti` toggle inline diagnostics +- `tv` toggle virtual diagnostics - `]g` jump to next warning or error - `[g` jump to previous warning or error diff --git a/nvim/.config/nvim/after/ftplugin/markdown.lua b/nvim/.config/nvim/after/ftplugin/markdown.lua new file mode 100644 index 0000000..9e73cee --- /dev/null +++ b/nvim/.config/nvim/after/ftplugin/markdown.lua @@ -0,0 +1,8 @@ +local o = vim.opt_local + +o.wrap = true +o.linebreak = true +o.breakindent = true +o.textwidth = 0 +o.colorcolumn = "" +o.formatoptions:remove({ "t" }) diff --git a/nvim/.config/nvim/lua/romanzy/keymaps.lua b/nvim/.config/nvim/lua/romanzy/keymaps.lua index d19096e..e66f17a 100644 --- a/nvim/.config/nvim/lua/romanzy/keymaps.lua +++ b/nvim/.config/nvim/lua/romanzy/keymaps.lua @@ -26,12 +26,18 @@ map("n", "fg", telescope_picker("live_grep"), { desc = "live grep" }) map("n", "fb", telescope_picker("buffers"), { desc = "find buffers" }) map("n", "fh", telescope_picker("help_tags"), { desc = "help tags" }) map("n", "lg", "LazyGit", { desc = "open lazygit" }) +map("n", "tw", function() + local wrap = not vim.wo.wrap + vim.wo.wrap = wrap + vim.wo.linebreak = wrap + vim.wo.breakindent = wrap +end, { desc = "toggle soft wrap" }) --- map("n", "s", ":set spell!", { desc = "toggle spell" }) map("n", "sv", "vs", { desc = "split vertical" }) map("n", "sh", "sp", { desc = "split horizontal" }) map("n", "se", "=", { desc = "equalize splits" }) map("n", "sc", "c", { desc = "close split" }) + map("n", "rh", "vertical resize -10", { desc = "make buffer narrower" }) map("n", "rl", "vertical resize +10", { desc = "make buffer wider" }) map("n", "rj", "resize -5", { desc = "make buffer shorter" }) @@ -47,10 +53,8 @@ map("n", "Y", '"+Y', { desc = "yank line to system clipboard" }) map("n", "p", '"+p', { desc = "paste from system clipboard" }) map("n", "P", '"+P', { desc = "paste before from system clipboard" }) -map("t", "\\\\", "", { desc = "exit terminal" }) -map("t", "", "", { desc = "exit terminal" }) -map("t", "", "", { desc = "exit terminal" }) -map("t", "\\", "", { desc = "exit terminal" }) +-- experimenting +map("t", { "\\\\", "", "", "\\" }, "", { desc = "exit terminal" }) map("n", "", "h", { desc = "window left" }) map("n", "", "j", { desc = "window down" }) @@ -145,9 +149,9 @@ map("n", "[g", function() end, { desc = "prev warning/error" }) map("n", "gld", vim.diagnostic.setloclist, { desc = "display diagnostic information" }) -map("n", "gid", function() +map("n", "ti", function() vim.diagnostic.config({ virtual_text = not vim.diagnostic.config().virtual_text }) end, { desc = "toggle inline diagnostics" }) -map("n", "gvd", function() +map("n", "tv", function() vim.diagnostic.config({ virtual_lines = not vim.diagnostic.config().virtual_lines }) -end, { desc = "toggle virtual line diagnostics" }) +end, { desc = "toggle virtual diagnostics" })