diff --git a/README.md b/README.md index 11a2935..60faa86 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ + # 从零开始打造属于自己的nvim --- ## 文件结构 diff --git a/coc-settings.json b/coc-settings.json index 1648d6b..7a52e90 100644 --- a/coc-settings.json +++ b/coc-settings.json @@ -1,5 +1,7 @@ { "snippets.ultisnips.pythonPrompt": false, "explorer.icon.enableNerdfont": true, - "explorer.toggle": true + "explorer.toggle": true, + "markdown-preview-enhanced.previewTheme":"github-dark.css", + "markdown-preview-enhanced.latexEngine": "pdflatex" } diff --git a/lua/Filetype/Html.lua b/lua/Filetype/Html.lua new file mode 100644 index 0000000..649545e --- /dev/null +++ b/lua/Filetype/Html.lua @@ -0,0 +1,6 @@ +local map = vim.api.nvim_set_keymap +local openPreview = ":CocCommand markdown-preview-enhanced.openPreview:CocCommand markdown-preview-enhanced.openPreviewBackground" + +map('n', 'rr', openPreview, {noremap = false}) + +print("markdown sourced") diff --git a/lua/Filetype/markdown.lua b/lua/Filetype/markdown.lua new file mode 100644 index 0000000..649545e --- /dev/null +++ b/lua/Filetype/markdown.lua @@ -0,0 +1,6 @@ +local map = vim.api.nvim_set_keymap +local openPreview = ":CocCommand markdown-preview-enhanced.openPreview:CocCommand markdown-preview-enhanced.openPreviewBackground" + +map('n', 'rr', openPreview, {noremap = false}) + +print("markdown sourced") diff --git a/lua/Plugin/coc.lua b/lua/Plugin/coc.lua index 5955895..0a04591 100644 --- a/lua/Plugin/coc.lua +++ b/lua/Plugin/coc.lua @@ -82,5 +82,3 @@ keyset("v", "tt", "(coc-translator-pv)") -- translator-releader keyset("n", "tr", "(coc-translator-r)") keyset("v", "tr", "(coc-translator-rv)") - - diff --git a/lua/core/options.lua b/lua/core/options.lua index b82f4dc..04f1294 100644 --- a/lua/core/options.lua +++ b/lua/core/options.lua @@ -41,7 +41,7 @@ vim.cmd("colorscheme gruvbox") vim.cmd([[ au InsertLeave * :silent !fcitx5-remote -c ]]) -- 文件判断 -vim.cmd([[ filetype plugin on ]]) +vim.cmd([[ filetype plugin indent on ]]) -- 取消换行注释 vim.api.nvim_create_autocmd({ "BufEnter" }, { @@ -54,6 +54,14 @@ vim.api.nvim_create_autocmd({ "BufEnter" }, { end, }) +local require_markdown = function() require('Filetype.markdown') end +local require_html = function() require('Filetype.Html') end + +vim.api.nvim_create_autocmd({ +{"FileType"}, { pattern = "markdown", callback = require_markdown }, +{"FileType"}, { pattern = "html", callback = require_html } +}) + @@ -71,7 +79,5 @@ vim.api.nvim_create_autocmd({ "BufEnter" }, { - -