From 94adb9ba823ffbe219293a20bacd8bcc9187de1e Mon Sep 17 00:00:00 2001 From: iGor milhit Date: Tue, 30 May 2023 20:55:59 +0200 Subject: [PATCH] markdown: configure the markdown environment - Adds the `markdown-preview.nvim` plugin. - Adds the two `vim-pandoc` and `vim-pandoc-syntax` for the support of markdown syntax and for file conversions with pandoc. - Sets basic options (max width of 79 chars). - Restores the `.gitignore` rules of the kickstart.nvim project. - Adds and configures the Nordic colorscheme plugin. - Sets the English, French and German spelling. - Adds the `mkdnflow` plugin to get notebook features. Co-Authored-by: iGor milhit --- .gitignore | 6 +++++ init.lua | 27 ++++++++++++++++++---- lazy-lock.json | 31 -------------------------- lua/custom/plugins/markdownpreview.lua | 9 +++++--- lua/custom/plugins/mkdnflow.lua | 19 ++++++++++++++++ lua/custom/plugins/pandoc.lua | 26 +++++++++++++++++++++ 6 files changed, 80 insertions(+), 38 deletions(-) delete mode 100644 lazy-lock.json create mode 100644 lua/custom/plugins/mkdnflow.lua create mode 100644 lua/custom/plugins/pandoc.lua diff --git a/.gitignore b/.gitignore index 36b4321..17f6b2a 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,9 @@ autoload # spell *.spl spell/fr.utf-8.add.spl + +tags +test.sh +.luarc.json +nvim +lazy-lock.json diff --git a/init.lua b/init.lua index d1ecfc2..c157436 100644 --- a/init.lua +++ b/init.lua @@ -130,11 +130,17 @@ require('lazy').setup({ }, { - -- Theme inspired by Atom - 'navarasu/onedark.nvim', + -- Nordic Theme + 'andersevenrud/nordic.nvim', priority = 1000, config = function() - vim.cmd.colorscheme 'onedark' + require('nordic').colorscheme({ + underline_option = 'none', + italic = true, + italic_comments = false, + minimal_mode = false, + alternate_backgrounds = false + }) end, }, @@ -145,7 +151,7 @@ require('lazy').setup({ opts = { options = { icons_enabled = true, - theme = 'onedark', + theme = 'nord', component_separators = '|', section_separators = '/', }, @@ -205,6 +211,10 @@ require('lazy').setup({ { import = 'custom.plugins' }, }, {}) +-- Restore the site folder of .local/share/nvim/ in the runtime rewritten by +-- lazy. See https://github.com/neovim/neovim/issues/23082#issuecomment-1510812311 +vim.opt.rtp:append (vim.fn.stdpath ('data') .. '/site') + -- [[ Setting options ]] -- See `:help vim.o` -- NOTE: You can change these options as you wish! @@ -215,6 +225,12 @@ vim.o.hlsearch = false -- Make line numbers default vim.wo.number = true +-- Set the maximum width of a line +vim.opt.textwidth = 79 + +-- Set text formatting options +-- vim.opt.formatoptions:append('a') + -- Enable mouse mode vim.o.mouse = 'a' @@ -247,6 +263,9 @@ vim.o.completeopt = 'menuone,noselect' -- NOTE: You should make sure your terminal supports this vim.o.termguicolors = true +-- Set the spelling for English, French and German. +vim.opt.spelllang = 'en,fr,de' + -- [[ Basic Keymaps ]] -- Keymaps for better default experience diff --git a/lazy-lock.json b/lazy-lock.json deleted file mode 100644 index 12f375e..0000000 --- a/lazy-lock.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "Comment.nvim": { "branch": "master", "commit": "e1fe53117aab24c378d5e6deaad786789c360123" }, - "LuaSnip": { "branch": "master", "commit": "a83e4b1ba7edc6fecdad09e39753a7d5eee1d01c" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "0e6b2ed705ddcff9738ec4ea838141654f12eeef" }, - "cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" }, - "fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" }, - "friendly-snippets": { "branch": "main", "commit": "8875cccf779160303bf2bed7d422717676f214fd" }, - "gitsigns.nvim": { "branch": "main", "commit": "f868d82a36f7f7f5e110eb0a9659993984f59875" }, - "indent-blankline.nvim": { "branch": "master", "commit": "ceaf730b13e332cd76600d9795722413c236c684" }, - "lazy.nvim": { "branch": "main", "commit": "ebdd0499551765e6a7aba220cc8ae4e0cdb6be69" }, - "lualine.nvim": { "branch": "master", "commit": "05d78e9fd0cdfb4545974a5aa14b1be95a86e9c9" }, - "markdown-preview.nvim": { "branch": "master", "commit": "02cc3874738bc0f86e4b91f09b8a0ac88aef8e96" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "f0ce33f4794a2364eb08d09d09380e8b04ec5e6a" }, - "mason.nvim": { "branch": "main", "commit": "08b2fd308e0107eab9f0b59d570b69089fd0b522" }, - "neo-tree.nvim": { "branch": "v2.x", "commit": "8c89efb93b8383666a6f989762c2f610f5f2c930" }, - "neodev.nvim": { "branch": "main", "commit": "da3e9e05c60250984f1bf069d517d9fca5315453" }, - "nui.nvim": { "branch": "main", "commit": "2b2732528e4a79eb8542568bd51d25f710395bd6" }, - "nvim-cmp": { "branch": "main", "commit": "b43bfaf3229d6b39d8baaa567b13c6be0623bf12" }, - "nvim-lspconfig": { "branch": "master", "commit": "9166622781a39a829878d1fd24c174529d996838" }, - "nvim-treesitter": { "branch": "master", "commit": "e23d5493cf14401ef02ec2e4e99b65f199869966" }, - "nvim-treesitter-textobjects": { "branch": "master", "commit": "95b76b95eff25e1e64f363938cd853852355d70a" }, - "nvim-web-devicons": { "branch": "master", "commit": "2a125024a137677930efcfdf720f205504c97268" }, - "onedark.nvim": { "branch": "master", "commit": "f6e82074761473d30a722f5d90c60282de1ac41d" }, - "plenary.nvim": { "branch": "master", "commit": "52544825d6b8be677eb395983515ad5e30ae1f2e" }, - "telescope-fzf-native.nvim": { "branch": "main", "commit": "9bc8237565ded606e6c366a71c64c0af25cd7a50" }, - "telescope.nvim": { "branch": "0.1.x", "commit": "533c7fb1b3fb412a16e1c1c9cf6d2b1ac130f1b7" }, - "vim-fugitive": { "branch": "master", "commit": "5f0d280b517cacb16f59316659966c7ca5e2bea2" }, - "vim-rhubarb": { "branch": "master", "commit": "ee69335de176d9325267b0fd2597a22901d927b1" }, - "vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" }, - "which-key.nvim": { "branch": "main", "commit": "e271c28118998c93a14d189af3395812a1aa646c" } -} \ No newline at end of file diff --git a/lua/custom/plugins/markdownpreview.lua b/lua/custom/plugins/markdownpreview.lua index 2ac37fc..384fa10 100644 --- a/lua/custom/plugins/markdownpreview.lua +++ b/lua/custom/plugins/markdownpreview.lua @@ -1,11 +1,14 @@ -- makdown-preview.nvim -- installed with code found at https://github.com/iamcco/markdown-preview.nvim/issues/558#issuecomment-1514701537 +-- Force the light theme, no matter the system option is. +vim.cmd([[ let g:mkdp_theme = 'light' ]]) + return { { "iamcco/markdown-preview.nvim", - ft = "markdown", + ft = "pandoc", lazy = true, - build = "cd app && npm install && git reset --hard", - } + build = "cd app && yarn install", + }, } diff --git a/lua/custom/plugins/mkdnflow.lua b/lua/custom/plugins/mkdnflow.lua new file mode 100644 index 0000000..1bc50e8 --- /dev/null +++ b/lua/custom/plugins/mkdnflow.lua @@ -0,0 +1,19 @@ +-- Mkdownflow plugin. +-- Allows to follow links, anchors, create links, and many more. +-- https://github.com/jakewvincent/mkdnflow.nvim + +-- Keymaps for mkdnflow. +-- Table +vim.keymap.set({'n','x','v'}, 'tf', 'MkdnTableFormat', {desc = 'Format table under cursor'}) + +return { + { + "jakewvincent/mkdnflow.nvim", + ft = 'pandoc', + lazy = true, + config = function () + require('mkdnflow').setup({ + }) + end + } +} diff --git a/lua/custom/plugins/pandoc.lua b/lua/custom/plugins/pandoc.lua new file mode 100644 index 0000000..5c1956e --- /dev/null +++ b/lua/custom/plugins/pandoc.lua @@ -0,0 +1,26 @@ +-- Pandoc plugins: vim-pandoc, vim-pandoc-syntax + +-- Defines the filetypes that have to be recognize by vim-pandoc. Allows +-- mardown-preview to be available with pandoc filetype. +vim.cmd([[ let g:mkdp_filetypes = ['markdown', 'pandoc', 'pandoc.markdown'] ]]) + +-- Sets the pandoc formatting mode to hardwrap +vim.cmd([[ let g:pandoc#formatting#mode="hA" ]]) + +-- Keymaps to switch to soft or hardwarp, or to toggle. +vim.keymap.set('n', 'sw', 'call pandoc#formatting#UseSoftWraps()', {desc = 'Switch to softwrap'}) +vim.keymap.set('n', 'hw', 'call pandoc#formatting#UseHardWraps()', {desc = 'Switch to hardwrap'}) +vim.keymap.set('n', 'tw', 'call pandoc#formatting#ToggleAutoformat()', {desc = 'Toggle autoformat, to deactivate it'}) + +return { + { + "vim-pandoc/vim-pandoc", + ft = "pandoc", + lazy = true, + }, + { + "vim-pandoc/vim-pandoc-syntax", + ft = "pandoc", + lazy = true, + }, +}