Compare commits
5 Commits
fix-treesi
...
main
| Author | SHA1 | Date |
|---|---|---|
|
|
a111e23eec | |
|
|
ccecc89a42 | |
|
|
3d690c9da1 | |
|
|
a3311a1b86 | |
|
|
75c9a73bfd |
|
|
@ -93,7 +93,7 @@ I don't provide links for each of these plugins as they are easy to be found.
|
||||||
- `vim-speeddating` to increment dates, times, etc.
|
- `vim-speeddating` to increment dates, times, etc.
|
||||||
- `vim-surround` to improve surroundings management.
|
- `vim-surround` to improve surroundings management.
|
||||||
- `autopairs.nvim`.
|
- `autopairs.nvim`.
|
||||||
- `Comment.nvim` to comment lines and blocs.
|
- `mini.comment` to comment lines and blocs.
|
||||||
- `ident-blankline.nvim` to improve readability of indentation.
|
- `ident-blankline.nvim` to improve readability of indentation.
|
||||||
- `zen-mode.nvim` for a good zen mode.
|
- `zen-mode.nvim` for a good zen mode.
|
||||||
- `toggleterm.nvim` to quickly get a terminal. Might find a better one.
|
- `toggleterm.nvim` to quickly get a terminal. Might find a better one.
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
vim.opt.textwidth = 0
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
-- Deactivate fold for python files
|
||||||
|
|
||||||
|
vim.opt.foldlevel = 99
|
||||||
|
|
||||||
|
-- Ruff import sorting and formatting
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||||
|
buffer = 0,
|
||||||
|
callback = function()
|
||||||
|
-- Tri des imports via code action Ruff
|
||||||
|
local clients = vim.lsp.get_clients({ bufnr = 0 })
|
||||||
|
for _, c in ipairs(clients) do
|
||||||
|
if c.name == "ruff" then
|
||||||
|
vim.lsp.buf.code_action({
|
||||||
|
context = { only = { "source.organizeImports.ruff" } },
|
||||||
|
apply = true,
|
||||||
|
})
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- Formatage du code
|
||||||
|
vim.lsp.buf.format({ async = false })
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
vim.treesitter.language.register('markdown', 'qmd')
|
||||||
|
|
||||||
|
vim.wo[0][0].foldexpr = 'v:lua.vim.treesitter.foldexpr()'
|
||||||
|
vim.wo[0][0].foldmethod = 'expr'
|
||||||
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
vim.opt.foldmethod = "expr"
|
|
||||||
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
|
|
||||||
|
|
@ -44,7 +44,7 @@ return {
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.lsp.config.marksman = {
|
vim.lsp.config.marksman = {
|
||||||
filetypes = { "markdown", "quarto" },
|
filetypes = { "markdown", "quarto", "qmd" },
|
||||||
root_dir = vim.fs.root(0, {
|
root_dir = vim.fs.root(0, {
|
||||||
".git",
|
".git",
|
||||||
".marksman.toml",
|
".marksman.toml",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
-- Install and configure Comment.nvim
|
-- Install and configure Comment.nvim
|
||||||
-- "gc" to comment visual regions/lines
|
-- "gc" to comment visual regions/lines
|
||||||
return {
|
return {
|
||||||
'numToStr/Comment.nvim',
|
'nvim-mini/mini.comment'
|
||||||
opts = {}
|
|
||||||
}
|
}
|
||||||
|
|
@ -49,6 +49,7 @@ return {
|
||||||
},
|
},
|
||||||
luasnip.filetype_extend("pandoc", {"markdown"}),
|
luasnip.filetype_extend("pandoc", {"markdown"}),
|
||||||
luasnip.filetype_extend("quarto", {"markdown"}),
|
luasnip.filetype_extend("quarto", {"markdown"}),
|
||||||
|
luasnip.filetype_extend("qmd", {"markdown"}),
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Load snippets from ~/.config/nvim/my_snippets/
|
-- Load snippets from ~/.config/nvim/my_snippets/
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ return {
|
||||||
lazy = true,
|
lazy = true,
|
||||||
ft = {
|
ft = {
|
||||||
"quarto",
|
"quarto",
|
||||||
|
"qmd",
|
||||||
},
|
},
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"jmbuhr/otter.nvim",
|
"jmbuhr/otter.nvim",
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
-- Diagnostic keymaps
|
-- Diagnostic keymaps
|
||||||
|
|
||||||
vim.keymap.set(
|
vim.keymap.set(
|
||||||
|
|
@ -17,15 +18,16 @@ vim.keymap.set(
|
||||||
-- Install and configure treesitter
|
-- Install and configure treesitter
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"nvim-treesitter/nvim-treesitter",
|
"nvim-treesitter/nvim-treesitter",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||||
},
|
branch = "main", -- ← nécessaire aussi pour textobjects
|
||||||
|
},
|
||||||
lazy = false,
|
lazy = false,
|
||||||
|
branch = "main",
|
||||||
build = ":TSUpdate",
|
build = ":TSUpdate",
|
||||||
|
|
||||||
-- Configure treesitter
|
config = function()
|
||||||
config = function ()
|
|
||||||
local treesitter = require('nvim-treesitter')
|
local treesitter = require('nvim-treesitter')
|
||||||
treesitter.setup()
|
treesitter.setup()
|
||||||
treesitter.install({
|
treesitter.install({
|
||||||
|
|
@ -46,6 +48,7 @@ return {
|
||||||
'typescript',
|
'typescript',
|
||||||
'vim',
|
'vim',
|
||||||
'vimdoc',
|
'vimdoc',
|
||||||
|
'xml',
|
||||||
'yaml',
|
'yaml',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -68,18 +71,19 @@ return {
|
||||||
'typescript',
|
'typescript',
|
||||||
'vim',
|
'vim',
|
||||||
'vimdoc',
|
'vimdoc',
|
||||||
|
'xml',
|
||||||
'yaml',
|
'yaml',
|
||||||
},
|
},
|
||||||
callback = function()
|
callback = function()
|
||||||
-- syntax highlighting, provided by Neovim
|
-- syntax highlighting, provided by Neovim
|
||||||
vim.treesitter.start()
|
pcall(vim.treesitter.start) -- ← pcall: évite l'erreur si pas de parser
|
||||||
-- folds, provided by Neovim
|
-- folds, provided by Neovim
|
||||||
vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
|
vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
|
||||||
vim.wo.foldmethod = 'expr'
|
vim.wo.foldmethod = 'expr'
|
||||||
-- indentation, provided by nvim-treesitter
|
-- indentation, provided by nvim-treesitter (expérimental)
|
||||||
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
|
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue