From ae9fc10678100fbecf3af1165cbf725297a34f85 Mon Sep 17 00:00:00 2001 From: Omixxx Date: Tue, 28 Feb 2023 16:42:55 +0100 Subject: [PATCH] add markdown preview --- README.md | 1 + init.lua | 3 +- lua/custom/plugins/folding.lua | 68 ++++++++++++------------- lua/custom/plugins/markdown_preview.lua | 11 ++++ 4 files changed, 47 insertions(+), 36 deletions(-) create mode 100644 lua/custom/plugins/markdown_preview.lua diff --git a/README.md b/README.md index 75c24d84..d756c1be 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ Additional system requirements: ### Configuration And Extension + * Inside of your fork, feel free to modify any file you like! It's your fork! * Then there are two primary configuration options available: * Include the `lua/kickstart/plugins/*` files in your configuration. diff --git a/init.lua b/init.lua index b2702c63..96f6d544 100644 --- a/init.lua +++ b/init.lua @@ -74,8 +74,7 @@ require('lazy').setup({ }, -- Git related plugins - 'tpope/vim-fugitive', - 'tpope/vim-rhubarb', + 'tpope/vim-fugitive', 'tpope/vim-rhubarb', -- Detect tabstop and shiftwidth automatically 'tpope/vim-sleuth', diff --git a/lua/custom/plugins/folding.lua b/lua/custom/plugins/folding.lua index d9a72882..e868bdf2 100644 --- a/lua/custom/plugins/folding.lua +++ b/lua/custom/plugins/folding.lua @@ -1,34 +1,34 @@ -return { - { 'kevinhwang91/nvim-ufo', - dependecies = { 'kevinhwang91/promise-async' }, - config = function() - vim.o.foldcolumn = "1" -- '0' is not bad - vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value - vim.o.foldlevelstart = 99 - vim.o.foldenable = true - vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]] - - -- Using ufo provider need remap `zR` and `zM`. If Neovim is 0.6.1, remap yourself - vim.keymap.set('n', 'zR', require('ufo').openAllFolds) - vim.keymap.set('n', 'zM', require('ufo').closeAllFolds) - - - -- Option 2: nvim lsp as LSP client - -- Tell the server the capability of foldingRange, - -- Neovim hasn't added foldingRange to default capabilities, users must add it manually - local capabilities = vim.lsp.protocol.make_client_capabilities() - capabilities.textDocument.foldingRange = { - dynamicRegistration = false, - lineFoldingOnly = true - } - local language_servers = require("lspconfig").util.available_servers() -- or list servers manually like {'gopls', 'clangd'} - for _, ls in ipairs(language_servers) do - require('lspconfig')[ls].setup({ - capabilities = capabilities - -- you can add other fields for setting up lsp server in this table - }) - end - require('ufo').setup() - end, - } -} +-- return { +-- { 'kevinhwang91/nvim-ufo', +-- dependecies = { 'kevinhwang91/promise-async' }, +-- config = function() +-- vim.o.foldcolumn = "2" -- '0' is not bad +-- vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value +-- vim.o.foldlevelstart = 99 +-- vim.o.foldenable = true +-- vim.o.fillchars = [[eob: ,fold: ,foldopen:,foldsep: ,foldclose:]] +-- +-- -- Using ufo provider need remap `zR` and `zM`. If Neovim is 0.6.1, remap yourself +-- vim.keymap.set('n', 'zR', require('ufo').openAllFolds) +-- vim.keymap.set('n', 'zM', require('ufo').closeAllFolds) +-- +-- +-- -- Option 2: nvim lsp as LSP client +-- -- Tell the server the capability of foldingRange, +-- -- Neovim hasn't added foldingRange to default capabilities, users must add it manually +-- local capabilities = vim.lsp.protocol.make_client_capabilities() +-- capabilities.textDocument.foldingRange = { +-- dynamicRegistration = false, +-- lineFoldingOnly = true +-- } +-- local language_servers = require("lspconfig").util.available_servers() -- or list servers manually like {'gopls', 'clangd'} +-- for _, ls in ipairs(language_servers) do +-- require('lspconfig')[ls].setup({ +-- capabilities = capabilities +-- -- you can add other fields for setting up lsp server in this table +-- }) +-- end +-- require('ufo').setup() +-- end, +-- } +-- } diff --git a/lua/custom/plugins/markdown_preview.lua b/lua/custom/plugins/markdown_preview.lua new file mode 100644 index 00000000..5e14058b --- /dev/null +++ b/lua/custom/plugins/markdown_preview.lua @@ -0,0 +1,11 @@ +-- if does not work, go manually in the folder .local/share/nvim/site/pack/packer/start/markdown-preview.nvim/app and run yarn install + +return { + "iamcco/markdown-preview.nvim", + run = "cd app && yarn install", + setup = function() + vim.g.mkdp_filetypes = { + "markdown" } + end, + ft = { "markdown" } +}