diff --git a/lua/chadrc.lua b/lua/chadrc.lua index 9f9eecc..2004539 100644 --- a/lua/chadrc.lua +++ b/lua/chadrc.lua @@ -20,5 +20,7 @@ M.base46 = { -- lazyload = false -- } --} - +vim.defer_fn(function() + pcall(require, "custom.filetype") +end, 0) return M diff --git a/lua/configs/conform.lua b/lua/configs/conform.lua index 7f04e8b..e53b575 100644 --- a/lua/configs/conform.lua +++ b/lua/configs/conform.lua @@ -4,6 +4,7 @@ local options = { css = { "prettier" }, html = { "prettier" }, python = { "ruff" }, + markdown = { "prettier" }, }, format_on_save = { diff --git a/lua/custom/filetype.lua b/lua/custom/filetype.lua new file mode 100644 index 0000000..2ed4822 --- /dev/null +++ b/lua/custom/filetype.lua @@ -0,0 +1,10 @@ +vim.api.nvim_create_autocmd("FileType", { + pattern = "markdown", + callback = function() + vim.opt_local.textwidth = 60 -- soft wrap guide + vim.opt_local.wrap = true -- enable visual wrapping + vim.opt_local.linebreak = true -- wrap at word boundaries + vim.opt_local.spell = true -- optional: spell check + vim.opt_local.spelllang = "fr" -- optional: French spell check + end, +}) diff --git a/lua/options.lua b/lua/options.lua index ad34c19..c9d1e42 100644 --- a/lua/options.lua +++ b/lua/options.lua @@ -1,7 +1,17 @@ require "nvchad.options" -vim.opt.spelllang = fr -vim.opt.spell =true +vim.opt.spelllang = {"fr"} +vim.opt.spell = true + +vim.textwidth = 80 +vim.api.nvim_create_autocmd("FileType", { + pattern = "markdown", + callback = function() + vim.opt_local.textwidth = 80 -- set line wrap at 60 characters + vim.opt_local.wrap = true -- enable visual line wrapping + vim.opt_local.linebreak = true -- wrap at word boundaries + end, +}) -- add yours here! -- local o = vim.o diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index a1767ff..f05d2c7 100644 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -92,4 +92,31 @@ return { require("render-markdown").setup(opts) end, }, + { + "f3fora/cmp-spell", + dependencies = { "hrsh7th/nvim-cmp" }, + event = "InsertEnter", + config = function() + local cmp = require("cmp") + + cmp.setup({ + sources = cmp.config.sources({ + { name = "spell" }, -- Add spell source + { name = "buffer" }, + { name = "path" }, + { name = "nvim_lsp" }, + -- ... your other sources + }), + -- Optional: enable spelling suggestions only in relevant filetypes + enabled = function() + local ft = vim.bo.filetype + return vim.o.spell and (ft == "markdown" or ft == "text" or ft == "tex") + end, + }) + end, + }, + { + "liuchengxu/vista.vim", + lazy = false, + }, }