@@ -477,23 +477,14 @@ require('lazy').setup({
477477 local servers = {
478478 clangd = {},
479479 -- gopls = {},
480- ruff = {
481- trace = ' messages' ,
482- on_attach = on_attach ,
483- init_options = {
484- settings = {
485- logLevel = ' info' ,
486- },
487- },
488- },
489480 -- rust_analyzer = {},
490481 -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
491482 --
492483 -- Some languages (like typescript) have entire language plugins that can be useful:
493484 -- https://github.com/pmizio/typescript-tools.nvim
494485 --
495486 -- But for many setups, the LSP (`tsserver`) will work just fine
496- tsserver = {
487+ ts_ls = {
497488 init_options = {
498489 plugins = {
499490 {
@@ -511,8 +502,15 @@ require('lazy').setup({
511502 },
512503 },
513504 },
514- --
515- pylsp = {},
505+ pylsp = {
506+ plugins = {
507+ ruff = {
508+ enabled = true ,
509+ formatEnabled = true ,
510+ },
511+ autopep8 = { enabled = false },
512+ },
513+ },
516514 cmake = {},
517515 lua_ls = {
518516 -- cmd = {...},
@@ -567,39 +565,38 @@ require('lazy').setup({
567565 cmd = { ' ConformInfo' },
568566 keys = {
569567 {
570- ' <leader>f ' ,
568+ ' <leader>ff ' ,
571569 function ()
572570 require (' conform' ).format { async = true , lsp_format = ' fallback' }
573571 end ,
574572 mode = ' ' ,
575- desc = ' [F]ormat buffer' ,
573+ desc = ' [F]ormat [F]ile buffer' ,
576574 },
577575 },
578576 opts = {
579- notify_on_error = false ,
577+ notify_on_error = true ,
580578 format_on_save = function (bufnr )
581579 -- Disable "format_on_save lsp_fallback" for languages that don't
582580 -- have a well standardized coding style. You can add additional
583581 -- languages here or re-enable it for the disabled ones.
584582 local disable_filetypes = { c = true , cpp = true , py = true , ts = true , vue = true }
585- local lsp_format_opt
586- if disable_filetypes [vim .bo [bufnr ].filetype ] then
587- lsp_format_opt = ' never'
583+ if disable_filetypes [vim .bo [bufnr ].filetype ] or vim .g .disable_autoformat then
584+ return
588585 else
589- lsp_format_opt = ' fallback'
586+ return {
587+ timeout_ms = 500 ,
588+ lsp_format = ' fallback' ,
589+ }
590590 end
591- return {
592- timeout_ms = 500 ,
593- lsp_format = lsp_format_opt ,
594- }
595591 end ,
596592 formatters_by_ft = {
597593 cmake = { ' cmakelang' },
598594 cpp = { ' clang-format-15' },
599595 json = { ' clang-format-15' },
600596 lua = { ' stylua' },
601597 -- Conform can also run multiple formatters sequentially
602- python = { ' ruff_format' , ' ruff_fix' },
598+ python = { ' ruff_format' , ' ruff_fix' , ' ruff_organize_imports' },
599+ [' *' ] = { ' codespell' },
603600 --
604601 -- You can use a sub-list to tell conform to run *until* a formatter
605602 -- is found.
@@ -818,7 +815,7 @@ require('lazy').setup({
818815 end ,
819816 },
820817
821- -- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the
818+ -- The following comments only work if you have downloaded the kickstart repo, not just copy pasted thefals
822819 -- init.lua. If you want these files, they are in the repository, so you can just download them and
823820 -- place them in the correct locations.
824821
0 commit comments