mirror of
https://github.com/dam9000/kickstart-modular.nvim.git
synced 2026-05-14 16:33:48 +00:00
Compare commits
No commits in common. "16dd8f50078701fce4e2387c437b80d219b554e0" and "0619d89884dec2fa911430fdc42796420421fd6b" have entirely different histories.
16dd8f5007
...
0619d89884
32
init.lua
32
init.lua
@ -874,13 +874,15 @@ require('lazy').setup({
|
|||||||
branch = 'main',
|
branch = 'main',
|
||||||
-- [[ Configure Treesitter ]] See `:help nvim-treesitter-intro`
|
-- [[ Configure Treesitter ]] See `:help nvim-treesitter-intro`
|
||||||
config = function()
|
config = function()
|
||||||
-- ensure basic parser are installed
|
|
||||||
local parsers = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }
|
local parsers = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }
|
||||||
require('nvim-treesitter').install(parsers)
|
require('nvim-treesitter').install(parsers)
|
||||||
|
vim.api.nvim_create_autocmd('FileType', {
|
||||||
|
callback = function(args)
|
||||||
|
local buf, filetype = args.buf, args.match
|
||||||
|
|
||||||
|
local language = vim.treesitter.language.get_lang(filetype)
|
||||||
|
if not language then return end
|
||||||
|
|
||||||
---@param buf integer
|
|
||||||
---@param language string
|
|
||||||
local function treesitter_try_attach(buf, language)
|
|
||||||
-- check if parser exists and load it
|
-- check if parser exists and load it
|
||||||
if not vim.treesitter.language.add(language) then return end
|
if not vim.treesitter.language.add(language) then return end
|
||||||
-- enables syntax highlighting and other treesitter features
|
-- enables syntax highlighting and other treesitter features
|
||||||
@ -893,28 +895,6 @@ require('lazy').setup({
|
|||||||
|
|
||||||
-- enables treesitter based indentation
|
-- enables treesitter based indentation
|
||||||
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
|
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
|
||||||
end
|
|
||||||
|
|
||||||
local available_parsers = require('nvim-treesitter').get_available()
|
|
||||||
vim.api.nvim_create_autocmd('FileType', {
|
|
||||||
callback = function(args)
|
|
||||||
local buf, filetype = args.buf, args.match
|
|
||||||
|
|
||||||
local language = vim.treesitter.language.get_lang(filetype)
|
|
||||||
if not language then return end
|
|
||||||
|
|
||||||
local installed_parsers = require('nvim-treesitter').get_installed 'parsers'
|
|
||||||
|
|
||||||
if vim.tbl_contains(installed_parsers, language) then
|
|
||||||
-- enable the parser if it is installed
|
|
||||||
treesitter_try_attach(buf, language)
|
|
||||||
elseif vim.tbl_contains(available_parsers, language) then
|
|
||||||
-- if a parser is available in `nvim-treesitter` auto install it, and enable it after the installation is done
|
|
||||||
require('nvim-treesitter').install(language):await(function() treesitter_try_attach(buf, language) end)
|
|
||||||
else
|
|
||||||
-- try to enable treesitter features in case the parser exists but is not available from `nvim-treesitter`
|
|
||||||
treesitter_try_attach(buf, language)
|
|
||||||
end
|
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
|
|||||||
@ -44,20 +44,15 @@ return {
|
|||||||
map('n', '<leader>hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' })
|
map('n', '<leader>hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' })
|
||||||
map('n', '<leader>hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' })
|
map('n', '<leader>hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' })
|
||||||
map('n', '<leader>hS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer' })
|
map('n', '<leader>hS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer' })
|
||||||
|
map('n', '<leader>hu', gitsigns.stage_hunk, { desc = 'git [u]ndo stage hunk' })
|
||||||
map('n', '<leader>hR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' })
|
map('n', '<leader>hR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' })
|
||||||
map('n', '<leader>hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' })
|
map('n', '<leader>hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' })
|
||||||
map('n', '<leader>hi', gitsigns.preview_hunk_inline, { desc = 'git preview hunk [i]nline' })
|
map('n', '<leader>hb', gitsigns.blame_line, { 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', gitsigns.setqflist)
|
|
||||||
-- 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>tD', gitsigns.preview_hunk_inline, { desc = '[T]oggle git show [D]eleted' })
|
||||||
|
|
||||||
-- Text object
|
|
||||||
map({ 'o', 'x' }, 'ih', gitsigns.select_hunk)
|
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,7 +8,7 @@ return {
|
|||||||
config = function()
|
config = function()
|
||||||
local lint = require 'lint'
|
local lint = require 'lint'
|
||||||
lint.linters_by_ft = {
|
lint.linters_by_ft = {
|
||||||
markdown = { 'markdownlint' }, -- Make sure to install `markdownlint` via mason / npm
|
markdown = { 'markdownlint' },
|
||||||
}
|
}
|
||||||
|
|
||||||
-- To allow other plugins to add linters to require('lint').linters_by_ft,
|
-- To allow other plugins to add linters to require('lint').linters_by_ft,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user