plugins: update the treesitter configuration
- Updates the treesitter configruation according to the API documentation. - Adds XML to the treesitter configuration. - Updates the mkdnflow configuration according to the documentation. - Forces the filetype of *.md files before mkdnflow is loaded. Co-Authored-by: iGor milhit <igor@milhit.ch>main
parent
f38196b573
commit
75c9a73bfd
|
|
@ -3,4 +3,3 @@
|
||||||
-- See :h awa
|
-- See :h awa
|
||||||
|
|
||||||
vim.opt.awa=true
|
vim.opt.awa=true
|
||||||
vim.opt.foldlevel = 1
|
|
||||||
|
|
|
||||||
|
|
@ -3,5 +3,3 @@
|
||||||
-- See :h awa
|
-- See :h awa
|
||||||
|
|
||||||
vim.opt.awa=true
|
vim.opt.awa=true
|
||||||
-- vim.opt.foldlevel = 1
|
|
||||||
-- vim.opt.conceallevel = 2
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
-- Load all module files
|
-- Load all module files
|
||||||
|
require("core.set-md-filetype")
|
||||||
require("core.keymaps")
|
require("core.keymaps")
|
||||||
require("core.options")
|
require("core.options")
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
-- Ensure vim-pandoc sets the filetype
|
||||||
|
-- This is a workaround to avoid that during the mkdnflow loading, neovim
|
||||||
|
-- sets the filetype to .md files to markdown
|
||||||
|
-- "Solution" provided by the Quick assistant of Kagi.
|
||||||
|
vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
|
||||||
|
pattern = "*.md",
|
||||||
|
command = "set filetype=pandoc"
|
||||||
|
})
|
||||||
|
|
||||||
|
|
@ -28,9 +28,13 @@ return {
|
||||||
qmd = true,
|
qmd = true,
|
||||||
rmd = true,
|
rmd = true,
|
||||||
},
|
},
|
||||||
perspective = {
|
modules = {
|
||||||
|
folds = false,
|
||||||
|
foldtext = false,
|
||||||
|
},
|
||||||
|
path_resolution = {
|
||||||
-- Ensure that paths are relative to the current file
|
-- Ensure that paths are relative to the current file
|
||||||
priority = "current"
|
primary = "current"
|
||||||
},
|
},
|
||||||
links = {
|
links = {
|
||||||
conceal = true,
|
conceal = true,
|
||||||
|
|
|
||||||
|
|
@ -48,14 +48,9 @@ return {
|
||||||
'markdown',
|
'markdown',
|
||||||
'pandoc'
|
'pandoc'
|
||||||
},
|
},
|
||||||
|
dependencies = {
|
||||||
|
"vim-pandoc/vim-pandoc-syntax",
|
||||||
|
},
|
||||||
lazy = true,
|
lazy = true,
|
||||||
},
|
}
|
||||||
{
|
|
||||||
"vim-pandoc/vim-pandoc-syntax",
|
|
||||||
ft = {
|
|
||||||
'markdown',
|
|
||||||
'pandoc'
|
|
||||||
},
|
|
||||||
lazy = true,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,109 +21,67 @@ return {
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||||
},
|
},
|
||||||
build = ":TSUpdate",
|
lazy = false,
|
||||||
|
build = ":TSUpdate",
|
||||||
|
|
||||||
-- Configure treesitter
|
-- Configure treesitter
|
||||||
config = function()
|
config = function ()
|
||||||
---@diagnostic disable-next-line: missing-fields
|
local treesitter = require('nvim-treesitter')
|
||||||
local config = require("nvim-treesitter.config")
|
treesitter.setup()
|
||||||
|
treesitter.install({
|
||||||
|
'bash',
|
||||||
|
'css',
|
||||||
|
'dot',
|
||||||
|
'gitignore',
|
||||||
|
'html',
|
||||||
|
'javascript',
|
||||||
|
'json',
|
||||||
|
'julia',
|
||||||
|
'latex',
|
||||||
|
'lua',
|
||||||
|
'mermaid',
|
||||||
|
'python',
|
||||||
|
'query',
|
||||||
|
'r',
|
||||||
|
'typescript',
|
||||||
|
'vim',
|
||||||
|
'vimdoc',
|
||||||
|
'xml',
|
||||||
|
'yaml',
|
||||||
|
})
|
||||||
|
|
||||||
config.setup({
|
vim.api.nvim_create_autocmd('FileType', {
|
||||||
-- Enable color syntax
|
pattern = {
|
||||||
highlight = {
|
'bash',
|
||||||
enable = true,
|
'css',
|
||||||
disable = {
|
'dot',
|
||||||
"markdown"
|
'gitignore',
|
||||||
},
|
'html',
|
||||||
},
|
'javascript',
|
||||||
-- Enable better indentation management
|
'json',
|
||||||
indent = { enable = true },
|
'julia',
|
||||||
|
'latex',
|
||||||
|
'lua',
|
||||||
|
'mermaid',
|
||||||
|
'python',
|
||||||
|
'query',
|
||||||
|
'r',
|
||||||
|
'typescript',
|
||||||
|
'vim',
|
||||||
|
'vimdoc',
|
||||||
|
'xml',
|
||||||
|
'yaml',
|
||||||
|
},
|
||||||
|
callback = function()
|
||||||
|
-- syntax highlighting, provided by Neovim
|
||||||
|
vim.treesitter.start()
|
||||||
|
-- folds, provided by Neovim
|
||||||
|
vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
|
||||||
|
vim.wo.foldmethod = 'expr'
|
||||||
|
-- indentation, provided by nvim-treesitter
|
||||||
|
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
-- Installed and configured languages
|
end
|
||||||
ensure_installed = {
|
|
||||||
"bash",
|
|
||||||
"css",
|
|
||||||
"dot",
|
|
||||||
"gitignore",
|
|
||||||
"html",
|
|
||||||
"javascript",
|
|
||||||
"json",
|
|
||||||
"julia",
|
|
||||||
"latex",
|
|
||||||
"lua",
|
|
||||||
"markdown",
|
|
||||||
"markdown_inline",
|
|
||||||
"mermaid",
|
|
||||||
"norg",
|
|
||||||
"python",
|
|
||||||
"query",
|
|
||||||
"r",
|
|
||||||
"typescript",
|
|
||||||
"vim",
|
|
||||||
"vimdoc",
|
|
||||||
"yaml",
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Do not install parses synchronously
|
|
||||||
sync_install = false,
|
|
||||||
|
|
||||||
-- Do not install automatically missing parsers
|
|
||||||
auto_install = false,
|
|
||||||
|
|
||||||
-- <Ctrl-space> select the current bloc
|
|
||||||
incremental_selection = {
|
|
||||||
enable = true,
|
|
||||||
keymaps = {
|
|
||||||
init_selection = "<C-space>",
|
|
||||||
node_incremental = "<C-space>",
|
|
||||||
scope_incremental = false,
|
|
||||||
node_decremental = "<bs>",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
textobjects = {
|
|
||||||
select = {
|
|
||||||
enable = true,
|
|
||||||
lookahead = true, -- Automatically jump forward to textobj
|
|
||||||
keymaps = {
|
|
||||||
-- You can use the capture groups defined in textobjects.scm
|
|
||||||
['aa'] = '@parameter.outer',
|
|
||||||
['ia'] = '@parameter.inner',
|
|
||||||
['af'] = '@function.outer',
|
|
||||||
['if'] = '@function.inner',
|
|
||||||
['ac'] = '@class.outer',
|
|
||||||
['ic'] = '@class.inner',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
move = {
|
|
||||||
enable = true,
|
|
||||||
set_jumps = true, -- whether to set jumps in the jumplist
|
|
||||||
goto_next_start = {
|
|
||||||
[']m'] = '@function.outer',
|
|
||||||
[']]'] = '@class.outer',
|
|
||||||
},
|
|
||||||
goto_next_end = {
|
|
||||||
[']M'] = '@function.outer',
|
|
||||||
[']['] = '@class.outer',
|
|
||||||
},
|
|
||||||
goto_previous_start = {
|
|
||||||
['[m'] = '@function.outer',
|
|
||||||
['[['] = '@class.outer',
|
|
||||||
},
|
|
||||||
goto_previous_end = {
|
|
||||||
['[M'] = '@function.outer',
|
|
||||||
['[]'] = '@class.outer',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
swap = {
|
|
||||||
enable = true,
|
|
||||||
swap_next = {
|
|
||||||
['<leader>a'] = '@parameter.inner',
|
|
||||||
},
|
|
||||||
swap_previous = {
|
|
||||||
['<leader>A'] = '@parameter.inner',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue