diff options
| author | Robert Günzler <r@gnzler.io> | 2024-11-25 13:30:37 +0100 |
|---|---|---|
| committer | Robert Günzler <r@gnzler.io> | 2024-11-25 13:58:25 +0100 |
| commit | 23de12baba9fbfc4ca24581b37c374aa5345cc25 (patch) | |
| tree | e4b3c421bad572eb85a1089eaad44dc3059ab6e6 /.vim/after/ftplugin/markdown.lua | |
| parent | 18e3848110da0a59843058927ea04b496f5db2a5 (diff) | |
update nvim config
Signed-off-by: Robert Günzler <r@gnzler.io>
Diffstat (limited to '.vim/after/ftplugin/markdown.lua')
| -rw-r--r-- | .vim/after/ftplugin/markdown.lua | 74 |
1 files changed, 6 insertions, 68 deletions
diff --git a/.vim/after/ftplugin/markdown.lua b/.vim/after/ftplugin/markdown.lua index 7e6b22e..9b98392 100644 --- a/.vim/after/ftplugin/markdown.lua +++ b/.vim/after/ftplugin/markdown.lua @@ -1,68 +1,6 @@ --- require('internal.spell') -vim.opt_local.foldenable = false -vim.opt_local.foldlevel = 1 - -vim.fn.matchadd('Conceal', '- \\[ \\]\\&- \\zs\\[ ', 0, -1, { conceal = '☐ ' }) --- vim.fn.matchadd('Conceal', '\\[x\\]', 0, -1, { conceal = '☑ ' }) --- vim.fn.matchadd('Conceal', '\\[-\\]', 0, -1, { conceal = '☒ ' }) -vim.fn.matchadd('Conceal', '- \\[x\\]\\&- \\zs\\[x', 0, -1, { conceal = '🞕 ' }) -vim.fn.matchadd('Conceal', '- \\[[ x]\\zs\\]', 0, -1, { conceal = ' ' }) - -vim.keymap.set('n', '<Plug>Markdown_OpenUrlUnderCursor', vim.ui.open) - -vim.keymap.set( - 'n', - '<localleader>l', - require('internal.misc').link_preview, - { desc = 'link preview' } -) - -local function toggle_checkbox() - local ln, n = vim.api.nvim_get_current_line(), 0 - ln, n = string.gsub(ln, '%[ %]', '[x]', 1) - if n > 0 then - goto set_line - end - ln, n = string.gsub(ln, '%[x%]', '[ ]', 1) - if n > 0 then - goto set_line - end - ln, n = string.gsub(ln, 'TODO', 'DONE', 1) - if n > 0 then - goto set_line - end - ln, n = string.gsub(ln, 'DONE', 'TODO', 1) - if n > 0 then - goto set_line - end - - ::set_line:: - vim.api.nvim_set_current_line(ln) -end - -vim.keymap.set('n', '<space><space>', toggle_checkbox, { desc = 'toggle checkbox', buffer = true }) -vim.keymap.set('i', '<c-space>', toggle_checkbox, { desc = 'toggle checkbox', buffer = true }) - --- vim.keymap.set('n', 'o', function() --- local cursor = vim.api.nvim_win_get_cursor(0) --- -- need to decrement the row number here, to account for 0 indexing --- local node = vim.treesitter.get_node({ --- bufnr = 0, --- pos = { cursor[1] - 1, cursor[2] }, --- }) --- while node do --- if node:type() == 'list_item' then --- local ln = vim.treesitter.get_node_text(node:child(0), 0, {}) --- local ln_start = string.match(ln, '^(%d+)%.') --- if ln_start ~= nil then --- ln = ln:gsub(ln_start, tonumber(ln_start) + 1) --- end --- vim.api.nvim_buf_set_lines(0, cursor[1], cursor[1], false, { ln }) --- vim.api.nvim_feedkeys('jA', 'n', false) --- return --- end --- node = node:parent() --- end --- --- vim.api.nvim_feedkeys('o', 'n', false) --- end, { desc = 'smart-o', buffer = true }) +-- TODO: no idea if this is the best way to do this +-- the part that makes this work lives in ../../../after/ftplugin/markdown.lua +require('null-ls').disable('vale') +vim.keymap.set('n', '<leader>v', function() + require('null-ls').toggle('vale') +end) |