Compare commits

..

5 Commits

Author SHA1 Message Date
iGor milhit a111e23eec
filetypes: set rules for python filetype
- Disables forlding.
- Lets Ruff sort imports and format file content on save.

Co-Authored-by: iGor milhit <igor@milhit.ch>
2026-08-13 07:32:40 +02:00
iGor milhit ccecc89a42
plugins: update treesitter, replace comment.nvim
- Updates nvim-treesitter since the neovim 0.12 version, as it is
  archived.
- Replaces comment.nvim by mini.comment.

Co-Authored-by: iGor milhit <igor@milhit.ch>
2026-06-12 14:57:29 +02:00
iGor milhit 3d690c9da1
filetype: improve csv managment
Co-Authored-by: iGor milhit <igor@milhit.ch>
2026-06-05 11:44:48 +02:00
iGor milhit a3311a1b86
filetype: support the qmd filetype for quarto
Co-Authored-by: iGor milhit <igor@milhit.ch>
2026-06-05 11:44:42 +02:00
iGor milhit 75c9a73bfd
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>
2026-02-19 16:11:08 +01:00
10 changed files with 49 additions and 15 deletions

View File

@ -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-surround` to improve surroundings management.
- `autopairs.nvim`.
- `Comment.nvim` to comment lines and blocs.
- `mini.comment` to comment lines and blocs.
- `ident-blankline.nvim` to improve readability of indentation.
- `zen-mode.nvim` for a good zen mode.
- `toggleterm.nvim` to quickly get a terminal. Might find a better one.

View File

@ -0,0 +1 @@
vim.opt.textwidth = 0

View File

@ -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,
})

View File

@ -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'

View File

@ -1,2 +0,0 @@
vim.opt.foldmethod = "expr"
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"

View File

@ -44,7 +44,7 @@ return {
})
vim.lsp.config.marksman = {
filetypes = { "markdown", "quarto" },
filetypes = { "markdown", "quarto", "qmd" },
root_dir = vim.fs.root(0, {
".git",
".marksman.toml",

View File

@ -1,6 +1,5 @@
-- Install and configure Comment.nvim
-- "gc" to comment visual regions/lines
return {
'numToStr/Comment.nvim',
opts = {}
'nvim-mini/mini.comment'
}

View File

@ -49,6 +49,7 @@ return {
},
luasnip.filetype_extend("pandoc", {"markdown"}),
luasnip.filetype_extend("quarto", {"markdown"}),
luasnip.filetype_extend("qmd", {"markdown"}),
}
-- Load snippets from ~/.config/nvim/my_snippets/

View File

@ -7,6 +7,7 @@ return {
lazy = true,
ft = {
"quarto",
"qmd",
},
dependencies = {
"jmbuhr/otter.nvim",

View File

@ -1,3 +1,4 @@
-- Diagnostic keymaps
vim.keymap.set(
@ -20,12 +21,13 @@ return {
"nvim-treesitter/nvim-treesitter",
dependencies = {
"nvim-treesitter/nvim-treesitter-textobjects",
branch = "main", -- ← nécessaire aussi pour textobjects
},
lazy = false,
branch = "main",
build = ":TSUpdate",
-- Configure treesitter
config = function ()
config = function()
local treesitter = require('nvim-treesitter')
treesitter.setup()
treesitter.install({
@ -46,6 +48,7 @@ return {
'typescript',
'vim',
'vimdoc',
'xml',
'yaml',
})
@ -68,18 +71,19 @@ return {
'typescript',
'vim',
'vimdoc',
'xml',
'yaml',
},
callback = function()
-- syntax highlighting, provided by Neovim
vim.treesitter.start()
pcall(vim.treesitter.start) -- ← pcall: évite l'erreur si pas de parser
-- folds, provided by Neovim
vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
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()"
end,
})
end
}