[None-LS] Improve formatting for JS/TS/etc

This commit is contained in:
Admin 2025-04-27 10:01:33 +02:00
parent b18160a61b
commit 67363070e3
2 changed files with 29 additions and 16 deletions

View File

@ -90,7 +90,7 @@ keymap.set("n", "<leader><leader>r", ":!%:p", opts("run current file with argume
keymap.set("n", "<leader>m", ":!chmod +x %:p<CR>", opts("make current file executable"))
-- script setup
keymap.set("n", "<leader>#", ":set syntax=sh<CR>:w<CR>:!chmod +x %:p<CR>:LspStart bashls<CR>i#!/bin/sh<CR><CR>", opts("setup sh script"))
keymap.set("n", "<leader>#", ":w<CR>:!chmod +x %:p<CR>ggi#!/bin/sh<CR><CR><Esc>:setfiletype bash<CR>", opts("setup sh script"))
keymap.set("n", "<leader><leader>#", ":set syntax=python<CR>:w<CR>:!chmod +x %:p<CR>:LspStart pyright<CR>i#!/usr/bin/env python3<CR><CR>", opts("setup python script"))
-- select all

View File

@ -1,5 +1,8 @@
return {
"nvimtools/none-ls.nvim",
dependencies = {
'nvimtools/none-ls-extras.nvim'
},
config = function()
local null_ls = require("null-ls")
@ -7,6 +10,16 @@ return {
sources = {
null_ls.builtins.formatting.stylua,
null_ls.builtins.formatting.prettier.with({
filetypes = {
"css",
"scss",
"less",
"html",
"json",
"yaml",
"markdown",
"graphql",
},
extra_args = {
"--print-width",
"120",
@ -27,11 +40,11 @@ return {
"--bracket-same-line",
"true",
"--vue-indent-script-and-style",
"true"
"true",
},
}),
null_ls.builtins.formatting.shfmt,
null_ls.builtins.diagnostics.eslint,
require( 'none-ls.formatting.eslint' ),
null_ls.builtins.formatting.black,
},
})