This commit is contained in:
2025-08-05 17:01:27 +02:00
parent 3929be281b
commit f80e1dd013
13 changed files with 128 additions and 43 deletions

View File

@@ -0,0 +1,14 @@
-- Display mappings
--
local wk = require 'which-key'
wk.add {
mode = { 'n', 'v', 'i' },
{ '<leader>E', group = 'Affichage' }, -- group
{ '<C-PageUp>', '<CMD>bprevious<CR>', desc = 'Buffer précédent', silent = true },
{ '<C-PageDown>', '<CMD>bnext<CR>', desc = 'Buffer suivant', silent = true },
}
-- The line beneath this is called `modeline`. See `:help modeline`
-- vim: ts=2 sts=2 sw=2 et

View File

@@ -0,0 +1,16 @@
-- Edition mappings
--
local wk = require 'which-key'
local header = require 'header'
wk.add {
mode = { 'n', 'v', 'i' },
{ '<leader>E', group = 'Édition' }, -- group
{ '<leader>Eah', header.add_headers, desc = 'Ajouter en-tête', silent = true },
{ '<leader>Eal', header.add_license_header 'gpl3', desc = 'Ajouter license', silent = true },
{ '<C-z>', '<CMD>undo<CR>', desc = 'Défaire', silent = true },
}
-- The line beneath this is called `modeline`. See `:help modeline`
-- vim: ts=2 sts=2 sw=2 et

View File

@@ -0,0 +1,22 @@
-- Neo-tree mappings
--
local wk = require 'which-key'
local neotree_utils = require 'custom.plugins.neotree'
local bufremove = require 'mini.bufremove'
wk.add {
mode = { 'n', 'v' },
{ '<leader>F', group = 'Fichier' }, -- group
{ '<leader>Fo', neotree_utils.smart_open, desc = 'Fichiers...' },
{ '<leader>Fc', bufremove.delete, desc = 'Fermer buffer', silent = true },
{ '<leader>Fr', '<CMD>source %<CR>', desc = 'Recharger buffer', silent = true },
{ '<leader>Fs', '<CMD>w<CR>', desc = 'Sauver buffer', silent = true },
{ '<F5>', '<CMD>source %<CR>', desc = 'Recharger buffer', silent = true },
{ '<C-s>', '<CMD>w<CR>', desc = 'Sauver buffer', silent = true },
{ '<C-c>', bufremove.delete, desc = 'Fermer buffer', silent = true },
{ '<C-o>', neotree_utils.smart_open, desc = 'Fichiers...' },
}
-- The line beneath this is called `modeline`. See `:help modeline`
-- vim: ts=2 sts=2 sw=2 et

View File

@@ -1,2 +1,9 @@
-- load which-key mappings -- load which-key mappings
--
require 'custom.keymaps.buffers'
require 'custom.keymaps.edit'
require 'custom.keymaps.neotree' require 'custom.keymaps.neotree'
-- The line beneath this is called `modeline`. See `:help modeline`
-- vim: ts=2 sts=2 sw=2 et

View File

@@ -1,7 +0,0 @@
local wk = require 'which-key'
local neotree_utils = require 'custom.plugins.neotree'
wk.add({
{ "<leader>f", group = "file" }, -- group
{ '<leader>fe', '<CMD>Neotree toggle position=right reveal_force_cwd ~<CR>', desc = 'Fichiers...', mode = 'n' },
})

View File

@@ -3,3 +3,6 @@
-- --
-- See the kickstart.nvim README for more information -- See the kickstart.nvim README for more information
return {} return {}
-- The line beneath this is called `modeline`. See `:help modeline`
-- vim: ts=2 sts=2 sw=2 et

View File

@@ -1,27 +1,27 @@
-- Neo-tree helper module
--
local M = {} local M = {}
function M.smart_open() function M.smart_open()
local bufname = vim.api.nvim_buf_get_name(0) local bufname = vim.api.nvim_buf_get_name(0)
local filetype = vim.bo.filetype
local is_real_file = vim.fn.filereadable(bufname) == 1 local is_real_file = vim.fn.filereadable(bufname) == 1
local cwd = vim.fn.getcwd()
local target_path = "~" -- Si c'est le dashboard ministarter, ouvrir dans le home
if filetype == 'ministarter' then
if is_real_file then vim.cmd('Neotree toggle reveal=false position=float dir=' .. vim.fn.expand '~')
target_path = vim.fn.fnamemodify(bufname, ":p:h") -- Si c'est un fichier réel, révéler le fichier dans l'arborescence
vim.cmd("Neotree toggle position=left reveal_file=" .. target_path) elseif is_real_file and bufname ~= '' then
elseif bufname ~= "" then vim.cmd 'Neotree toggle position=left reveal=true'
-- buffer avec un nom mais fichier inexistant (ex: nouveau buffer) -- Sinon, ouvrir dans le répertoire de travail courant
target_path = "~" else
vim.cmd("Neotree toggle position=right reveal_force_cwd reveal_file=" .. target_path) vim.cmd('Neotree toggle position=left reveal_force_cwd=true dir=' .. vim.fn.getcwd())
elseif vim.bo.filetype == "ministarter" then
-- buffer mini.starter
target_path = "~"
vim.cmd("Neotree toggle reveal=true position=float dir=" .. target_path)
end end
-- Appel de Neotree avec le bon dossier
-- vim.cmd("Neotree toggle reveal=true dir=" .. target_path)
end end
return M return M
-- The line beneath this is called `modeline`. See `:help modeline`
-- vim: ts=2 sts=2 sw=2 et

View File

@@ -12,22 +12,5 @@ vim.api.nvim_create_autocmd('TextYankPost', {
end, end,
}) })
-- -- Delay start of neotree smart open command
-- --
-- local ok, neotree_utils = pcall(require, "custom.plugins.neotree")
-- if not ok then
-- return
-- end
-- vim.api.nvim_create_autocmd("VimEnter", {
-- callback = function()
-- vim.defer_fn(function()
-- if vim.bo.filetype == "ministarter" then
-- neotree_utils.smart_open()
-- end
-- end, 0) -- délai pour laisser mini.starter s'afficher
-- end,
-- })
-- The line beneath this is called `modeline`. See `:help modeline` -- The line beneath this is called `modeline`. See `:help modeline`
-- vim: ts=2 sts=2 sw=2 et -- vim: ts=2 sts=2 sw=2 et

View File

@@ -13,13 +13,13 @@ require('lazy').setup({
-- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link). -- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
'NMAC427/guess-indent.nvim', -- Detect tabstop and shiftwidth automatically 'NMAC427/guess-indent.nvim', -- Detect tabstop and shiftwidth automatically
require 'kickstart.plugins.mini',
require 'kickstart.plugins.noice', require 'kickstart.plugins.noice',
require 'kickstart.plugins.gitsigns', require 'kickstart.plugins.gitsigns',
require 'kickstart.plugins.telescope', require 'kickstart.plugins.telescope',
require 'kickstart.plugins.lsp', require 'kickstart.plugins.lsp',
require 'kickstart.plugins.autoformat', require 'kickstart.plugins.autoformat',
require 'kickstart.plugins.autocompletion', require 'kickstart.plugins.autocompletion',
require 'kickstart.plugins.tokyonight',
require 'kickstart.plugins.todo-comments', require 'kickstart.plugins.todo-comments',
-- require 'kickstart.plugins.debug', -- require 'kickstart.plugins.debug',
-- require 'kickstart.plugins.indent_line', -- use alternative mini module -- require 'kickstart.plugins.indent_line', -- use alternative mini module
@@ -27,10 +27,13 @@ require('lazy').setup({
require 'kickstart.plugins.autopairs', require 'kickstart.plugins.autopairs',
require 'kickstart.plugins.neo-tree', require 'kickstart.plugins.neo-tree',
-- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps -- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps
require 'kickstart.plugins.mini',
require 'kickstart.plugins.treesitter', require 'kickstart.plugins.treesitter',
require 'kickstart.plugins.header',
require 'kickstart.plugins.which-key', require 'kickstart.plugins.which-key',
-- Themes
require 'kickstart.themes.onedark',
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
-- This is the easiest way to modularize your config. -- This is the easiest way to modularize your config.
-- --

View File

@@ -0,0 +1,9 @@
-- header
-- https://github.com/attilarepka/header.nvim
return {
{
'attilarepka/header.nvim',
config = true,
},
}

View File

@@ -72,6 +72,26 @@ return {
local commenter = require 'mini.comment' local commenter = require 'mini.comment'
commenter.setup {} commenter.setup {}
-- Minimal and fast tabline showing listed buffers
local tabline = require 'mini.tabline'
tabline.setup {}
-- Work with trailing whitespace
local trailspace = require 'mini.trailspace'
trailspace.setup {}
-- Highlight word under cursor
local cursorword = require 'mini.cursorword'
cursorword.setup {}
-- Animate common Neovim actions
local animate = require 'mini.animate'
animate.setup {}
-- Buffer removing (unshow, delete, wipeout), which saves window layout
local bufremove = require 'mini.bufremove'
bufremove.setup {}
-- ... and there is more! -- ... and there is more!
-- Check out: https://github.com/echasnovski/mini.nvim -- Check out: https://github.com/echasnovski/mini.nvim
end, end,

View File

@@ -0,0 +1,15 @@
-- Themes
--
return {
{
'navarasu/onedark.nvim',
priority = 1000, -- make sure to load this before all the other start plugins
config = function()
require('onedark').setup {
style = 'darker',
}
require('onedark').load()
end,
},
}