Merge branch 'master' into master
This commit is contained in:
commit
5e660f92ba
42
init.lua
42
init.lua
|
|
@ -688,6 +688,8 @@ require('lazy').setup({
|
|||
-- Special Lua Config, as recommended by neovim help docs
|
||||
lua_ls = {
|
||||
on_init = function(client)
|
||||
client.server_capabilities.documentFormattingProvider = false -- Disable formatting (formatting is done by stylua)
|
||||
|
||||
if client.workspace_folders then
|
||||
local path = client.workspace_folders[1].name
|
||||
if path ~= vim.fn.stdpath 'config' and (vim.uv.fs_stat(path .. '/.luarc.json') or vim.uv.fs_stat(path .. '/.luarc.jsonc')) then return end
|
||||
|
|
@ -709,8 +711,11 @@ require('lazy').setup({
|
|||
},
|
||||
})
|
||||
end,
|
||||
---@type lspconfig.settings.lua_ls
|
||||
settings = {
|
||||
Lua = {},
|
||||
Lua = {
|
||||
format = { enable = false }, -- Disable formatting (formatting is done by stylua)
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -744,7 +749,7 @@ require('lazy').setup({
|
|||
keys = {
|
||||
{
|
||||
'<leader>f',
|
||||
function() require('conform').format { async = true, lsp_format = 'fallback' } end,
|
||||
function() require('conform').format { async = true } end,
|
||||
mode = '',
|
||||
desc = '[F]ormat buffer',
|
||||
},
|
||||
|
|
@ -754,19 +759,21 @@ require('lazy').setup({
|
|||
opts = {
|
||||
notify_on_error = false,
|
||||
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 }
|
||||
if disable_filetypes[vim.bo[bufnr].filetype] then
|
||||
return nil
|
||||
-- You can specify filetypes to autoformat on save here:
|
||||
local enabled_filetypes = {
|
||||
-- lua = true,
|
||||
-- python = true,
|
||||
}
|
||||
if enabled_filetypes[vim.bo[bufnr].filetype] then
|
||||
return { timeout_ms = 500 }
|
||||
else
|
||||
return {
|
||||
timeout_ms = 500,
|
||||
lsp_format = 'fallback',
|
||||
}
|
||||
return nil
|
||||
end
|
||||
end,
|
||||
default_format_opts = {
|
||||
lsp_format = 'fallback', -- Use external formatters if configured below, otherwise use LSP formatting. Set to `false` to disable LSP formatting entirely.
|
||||
},
|
||||
-- You can also specify external formatters in here.
|
||||
formatters_by_ft = {
|
||||
lua = { 'stylua' },
|
||||
javascript = { 'prettier', stop_after_first = true },
|
||||
|
|
@ -904,9 +911,16 @@ require('lazy').setup({
|
|||
--
|
||||
-- Examples:
|
||||
-- - va) - [V]isually select [A]round [)]paren
|
||||
-- - yinq - [Y]ank [I]nside [N]ext [Q]uote
|
||||
-- - yiiq - [Y]ank [I]nside [I]+1 [Q]uote
|
||||
-- - ci' - [C]hange [I]nside [']quote
|
||||
require('mini.ai').setup { n_lines = 500 }
|
||||
require('mini.ai').setup {
|
||||
-- NOTE: Avoid conflicts with the built-in incremental selection mappings on Neovim>=0.12 (see `:help treesitter-incremental-selection`)
|
||||
mappings = {
|
||||
around_next = 'aa',
|
||||
inside_next = 'ii',
|
||||
},
|
||||
n_lines = 500,
|
||||
}
|
||||
|
||||
-- Add/delete/replace surroundings (brackets, quotes, etc.)
|
||||
--
|
||||
|
|
|
|||
Loading…
Reference in New Issue