Add files via upload

This commit is contained in:
Pgolik 2024-12-16 07:44:33 +01:00 committed by GitHub
parent b98a370a30
commit af21c78d94
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 36 additions and 26 deletions

View file

@ -477,15 +477,6 @@ require('lazy').setup({
local servers = {
clangd = {},
-- gopls = {},
ruff = {
trace = 'messages',
on_attach = on_attach,
init_options = {
settings = {
logLevel = 'info',
},
},
},
-- rust_analyzer = {},
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
--
@ -493,7 +484,7 @@ require('lazy').setup({
-- https://github.com/pmizio/typescript-tools.nvim
--
-- But for many setups, the LSP (`tsserver`) will work just fine
tsserver = {
ts_ls = {
init_options = {
plugins = {
{
@ -511,8 +502,15 @@ require('lazy').setup({
},
},
},
--
pylsp = {},
pylsp = {
plugins = {
ruff = {
enabled = true,
formatEnabled = true,
},
autopep8 = { enabled = false },
},
},
cmake = {},
lua_ls = {
-- cmd = {...},
@ -567,31 +565,29 @@ require('lazy').setup({
cmd = { 'ConformInfo' },
keys = {
{
'<leader>f',
'<leader>ff',
function()
require('conform').format { async = true, lsp_format = 'fallback' }
end,
mode = '',
desc = '[F]ormat buffer',
desc = '[F]ormat [F]ile buffer',
},
},
opts = {
notify_on_error = false,
notify_on_error = true,
format_on_save = function(bufnr)
-- Disable "format_on_save lsp_fallback" for languages that don't
-- have a well standardized coding style. You can add additional
-- languages here or re-enable it for the disabled ones.
local disable_filetypes = { c = true, cpp = true, py = true, ts = true, vue = true }
local lsp_format_opt
if disable_filetypes[vim.bo[bufnr].filetype] then
lsp_format_opt = 'never'
if disable_filetypes[vim.bo[bufnr].filetype] or vim.g.disable_autoformat then
return
else
lsp_format_opt = 'fallback'
return {
timeout_ms = 500,
lsp_format = 'fallback',
}
end
return {
timeout_ms = 500,
lsp_format = lsp_format_opt,
}
end,
formatters_by_ft = {
cmake = { 'cmakelang' },
@ -599,7 +595,8 @@ require('lazy').setup({
json = { 'clang-format-15' },
lua = { 'stylua' },
-- Conform can also run multiple formatters sequentially
python = { 'ruff_format', 'ruff_fix' },
python = { 'ruff_format', 'ruff_fix', 'ruff_organize_imports' },
['*'] = { 'codespell' },
--
-- You can use a sub-list to tell conform to run *until* a formatter
-- is found.
@ -818,7 +815,7 @@ require('lazy').setup({
end,
},
-- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the
-- The following comments only work if you have downloaded the kickstart repo, not just copy pasted thefals
-- init.lua. If you want these files, they are in the repository, so you can just download them and
-- place them in the correct locations.

View file

@ -11,3 +11,13 @@ vim.api.nvim_create_autocmd('TextYankPost', {
vim.highlight.on_yank()
end,
})
vim.api.nvim_create_user_command('FormatDisable', function()
vim.g.disable_autoformat = true
end, {
desc = 'Disable autoformat-on-save',
})
vim.api.nvim_create_user_command('FormatEnable', function()
vim.g.disable_autoformat = false
end, {
desc = 'Re-enable autoformat-on-save',
})

View file

@ -12,6 +12,9 @@ vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Show diagn
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
vim.keymap.set('n', '<leader>z', require('telescope').extensions.zoxide.list, { desc = '[Z]oxide to different dir' })
vim.keymap.set('n', '<leader>jl', require('telescope.builtin').jumplist, { desc = '[J]ump [L]ist' })
vim.keymap.set('n', '<leader>ft', function()
vim.g.disable_format = not vim.g.disable_autoformat
end, { desc = 'Auto[F]ormat [T]oggle ' })
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
-- for people to discover. Otherwise, you normally need to press <C-\><C-n>, which
-- is not what someone will guess without a bit more experience.

View file

@ -6,7 +6,7 @@ return {
config = function()
local lint = require 'lint'
lint.linters_by_ft = {
python = { 'pylint' },
python = { 'ruff' },
markdown = { 'markdownlint' },
}
-- To allow other plugins to add linters to require('lint').linters_by_ft,