[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")) keymap.set("n", "<leader>m", ":!chmod +x %:p<CR>", opts("make current file executable"))
-- script setup -- 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")) 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 -- select all

View File

@ -1,5 +1,8 @@
return { return {
"nvimtools/none-ls.nvim", "nvimtools/none-ls.nvim",
dependencies = {
'nvimtools/none-ls-extras.nvim'
},
config = function() config = function()
local null_ls = require("null-ls") local null_ls = require("null-ls")
@ -7,31 +10,41 @@ return {
sources = { sources = {
null_ls.builtins.formatting.stylua, null_ls.builtins.formatting.stylua,
null_ls.builtins.formatting.prettier.with({ null_ls.builtins.formatting.prettier.with({
filetypes = {
"css",
"scss",
"less",
"html",
"json",
"yaml",
"markdown",
"graphql",
},
extra_args = { extra_args = {
"--print-width", "--print-width",
"120", "120",
"--tab-width", "--tab-width",
"4", "4",
"--bracket-spacing", "--bracket-spacing",
"true", "true",
"--arrow-parens", "--arrow-parens",
"avoid", "avoid",
"--jsx-single-quote", "--jsx-single-quote",
"true", "true",
"--trailing-comma", "--trailing-comma",
"es5", "es5",
"--no-semi", "--no-semi",
"false", "false",
"--single-quote", "--single-quote",
"true", "true",
"--bracket-same-line", "--bracket-same-line",
"true", "true",
"--vue-indent-script-and-style", "--vue-indent-script-and-style",
"true" "true",
}, },
}), }),
null_ls.builtins.formatting.shfmt, null_ls.builtins.formatting.shfmt,
null_ls.builtins.diagnostics.eslint, require( 'none-ls.formatting.eslint' ),
null_ls.builtins.formatting.black, null_ls.builtins.formatting.black,
}, },
}) })