mirror of
https://github.com/dam9000/kickstart-modular.nvim.git
synced 2026-05-14 08:23:48 +00:00
Compare commits
6 Commits
c0cc054155
...
9b4fbc5021
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9b4fbc5021 | ||
|
|
f5b0e497c6 | ||
|
|
ce353a9b0e | ||
|
|
459b86865e | ||
|
|
648471c9eb | ||
|
|
f27810d1bd |
46
init.lua
46
init.lua
@ -616,6 +616,8 @@ require('lazy').setup({
|
|||||||
-- Special Lua Config, as recommended by neovim help docs
|
-- Special Lua Config, as recommended by neovim help docs
|
||||||
lua_ls = {
|
lua_ls = {
|
||||||
on_init = function(client)
|
on_init = function(client)
|
||||||
|
client.server_capabilities.documentFormattingProvider = false -- Disable formatting (formatting is done by stylua)
|
||||||
|
|
||||||
if client.workspace_folders then
|
if client.workspace_folders then
|
||||||
local path = client.workspace_folders[1].name
|
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
|
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
|
||||||
@ -637,8 +639,11 @@ require('lazy').setup({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
|
---@type lspconfig.settings.lua_ls
|
||||||
settings = {
|
settings = {
|
||||||
Lua = {},
|
Lua = {
|
||||||
|
format = { enable = false }, -- Disable formatting (formatting is done by stylua)
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -671,7 +676,7 @@ require('lazy').setup({
|
|||||||
keys = {
|
keys = {
|
||||||
{
|
{
|
||||||
'<leader>f',
|
'<leader>f',
|
||||||
function() require('conform').format { async = true, lsp_format = 'fallback' } end,
|
function() require('conform').format { async = true } end,
|
||||||
mode = '',
|
mode = '',
|
||||||
desc = '[F]ormat buffer',
|
desc = '[F]ormat buffer',
|
||||||
},
|
},
|
||||||
@ -681,21 +686,23 @@ require('lazy').setup({
|
|||||||
opts = {
|
opts = {
|
||||||
notify_on_error = false,
|
notify_on_error = false,
|
||||||
format_on_save = function(bufnr)
|
format_on_save = function(bufnr)
|
||||||
-- Disable "format_on_save lsp_fallback" for languages that don't
|
-- You can specify filetypes to autoformat on save here:
|
||||||
-- have a well standardized coding style. You can add additional
|
local enabled_filetypes = {
|
||||||
-- languages here or re-enable it for the disabled ones.
|
-- lua = true,
|
||||||
local disable_filetypes = { c = true, cpp = true }
|
-- python = true,
|
||||||
if disable_filetypes[vim.bo[bufnr].filetype] then
|
|
||||||
return nil
|
|
||||||
else
|
|
||||||
return {
|
|
||||||
timeout_ms = 500,
|
|
||||||
lsp_format = 'fallback',
|
|
||||||
}
|
}
|
||||||
|
if enabled_filetypes[vim.bo[bufnr].filetype] then
|
||||||
|
return { timeout_ms = 500 }
|
||||||
|
else
|
||||||
|
return nil
|
||||||
end
|
end
|
||||||
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 = {
|
formatters_by_ft = {
|
||||||
lua = { 'stylua' },
|
-- rust = { 'rustfmt' },
|
||||||
-- Conform can also run multiple formatters sequentially
|
-- Conform can also run multiple formatters sequentially
|
||||||
-- python = { "isort", "black" },
|
-- python = { "isort", "black" },
|
||||||
--
|
--
|
||||||
@ -838,9 +845,16 @@ require('lazy').setup({
|
|||||||
--
|
--
|
||||||
-- Examples:
|
-- Examples:
|
||||||
-- - va) - [V]isually select [A]round [)]paren
|
-- - va) - [V]isually select [A]round [)]paren
|
||||||
-- - yinq - [Y]ank [I]nside [N]ext [Q]uote
|
-- - yinq - [Y]ank [I]nside [I]next [Q]uote
|
||||||
-- - ci' - [C]hange [I]nside [']quote
|
-- - 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.)
|
-- Add/delete/replace surroundings (brackets, quotes, etc.)
|
||||||
--
|
--
|
||||||
@ -893,7 +907,7 @@ require('lazy').setup({
|
|||||||
|
|
||||||
-- check if treesitter indentation is available for this language, and if so enable it
|
-- check if treesitter indentation is available for this language, and if so enable it
|
||||||
-- in case there is no indent query, the indentexpr will fallback to the vim's built in one
|
-- in case there is no indent query, the indentexpr will fallback to the vim's built in one
|
||||||
local has_indent_query = vim.treesitter.query.get(language, 'indent') ~= nil
|
local has_indent_query = vim.treesitter.query.get(language, 'indents') ~= nil
|
||||||
|
|
||||||
-- enables treesitter based indentation
|
-- enables treesitter based indentation
|
||||||
if has_indent_query then vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" end
|
if has_indent_query then vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" end
|
||||||
|
|||||||
@ -50,11 +50,11 @@ return {
|
|||||||
map('n', '<leader>hb', function() gitsigns.blame_line { full = true } end, { desc = 'git [b]lame line' })
|
map('n', '<leader>hb', function() gitsigns.blame_line { full = true } end, { desc = 'git [b]lame line' })
|
||||||
map('n', '<leader>hd', gitsigns.diffthis, { desc = 'git [d]iff against index' })
|
map('n', '<leader>hd', gitsigns.diffthis, { desc = 'git [d]iff against index' })
|
||||||
map('n', '<leader>hD', function() gitsigns.diffthis '@' end, { desc = 'git [D]iff against last commit' })
|
map('n', '<leader>hD', function() gitsigns.diffthis '@' end, { desc = 'git [D]iff against last commit' })
|
||||||
map('n', '<leader>hQ', function() gitsigns.setqflist 'all' end)
|
map('n', '<leader>hQ', function() gitsigns.setqflist 'all' end, { desc = 'git hunk [Q]uickfix list (all files in repo)' })
|
||||||
map('n', '<leader>hq', gitsigns.setqflist)
|
map('n', '<leader>hq', gitsigns.setqflist, { desc = 'git hunk [q]uickfix list (all changes in this file)' })
|
||||||
-- Toggles
|
-- Toggles
|
||||||
map('n', '<leader>tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' })
|
map('n', '<leader>tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' })
|
||||||
map('n', '<leader>tw', gitsigns.toggle_word_diff)
|
map('n', '<leader>tw', gitsigns.toggle_word_diff, { desc = '[T]oggle git intra-line [w]ord diff' })
|
||||||
|
|
||||||
-- Text object
|
-- Text object
|
||||||
map({ 'o', 'x' }, 'ih', gitsigns.select_hunk)
|
map({ 'o', 'x' }, 'ih', gitsigns.select_hunk)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user