From 896f0e456c6e2f60dffc1d06009fefd90147208b Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 20 Mar 2021 17:22:44 -0400 Subject: update formatters --- lua/lsp/efm-general-ls.lua | 19 ++++++++++++++++--- lua/nv-utils/init.lua | 6 +++++- 2 files changed, 21 insertions(+), 4 deletions(-) (limited to 'lua') diff --git a/lua/lsp/efm-general-ls.lua b/lua/lsp/efm-general-ls.lua index faac9f4d..f9eac7ac 100644 --- a/lua/lsp/efm-general-ls.lua +++ b/lua/lsp/efm-general-ls.lua @@ -36,12 +36,25 @@ local shfmt = { formatStdin = true } +local markdownlint = { + -- TODO default to global lintrc + -- lintcommand = 'markdownlint -s -c ./markdownlintrc', + lintCommand = 'markdownlint -s', + lintStdin = true, + lintFormats = { '%f:%l %m', '%f:%l:%c %m', '%f: %l: %m' } +} + +local markdownPandocFormat = { + formatCommand = 'pandoc -f markdown -t gfm -sp --tab-stop=2', + formatStdin = true +} + require"lspconfig".efm.setup { -- init_options = {initializationOptions}, init_options = {documentFormatting = true, codeAction = false}, - filetypes = {"lua", "python", "javascriptreact", "javascript", "sh", "html", "css", "json", "yaml"}, + filetypes = {"lua", "python", "javascriptreact", "javascript", "sh", "html", "css", "json", "yaml", "markdown"}, settings = { rootMarkers = {".git/"}, languages = { @@ -54,11 +67,11 @@ require"lspconfig".efm.setup { css = {prettier}, json = {prettier}, yaml = {prettier_yaml}, + -- markdown = {markdownPandocFormat, markdownlint}, + markdown = {markdownPandocFormat}, } } } --- TODO turn these eslint and prettier examples into something good --- TODO also shellcheck and shell formatting -- Also find way to toggle format on save -- maybe this will help: https://superuser.com/questions/439078/how-to-disable-autocmd-or-augroup-in-vim diff --git a/lua/nv-utils/init.lua b/lua/nv-utils/init.lua index 901a1a71..59388093 100644 --- a/lua/nv-utils/init.lua +++ b/lua/nv-utils/init.lua @@ -32,7 +32,11 @@ nv_utils.define_augroups({ {'FileType', 'java', 'luafile ~/.config/nvim/lua/lsp/java-ls.lua'}, {'FileType', 'java', 'nnoremap ca lua require(\'jdtls\').code_action()'}, {'FileType', 'java', 'nnoremap ca lua require(\'jdtls\').code_action()'}, - {'FileType', 'markdown', 'set wrap'} + {'FileType', 'markdown', 'setlocal wrap'}, + -- {'BufWinEnter', '.sol', 'setlocal filetype=solidity'}, + {'BufRead', '*.sol', 'setlocal filetype=solidity'}, + {'BufNewFile', '*.sol', 'setlocal filetype=solidity'} + -- autocmd! BufRead,BufNewFile *.{jsx,jx,js} setlocal filetype=javascript.jsx -- {'User', 'GoyoLeave', 'lua require(\'galaxyline\').disable_galaxyline()'}, -- {'User', 'GoyoEnter', 'lua require(\'galaxyline\').galaxyline_augroup()'}, } -- cgit v1.2.3