Add completion, cli on nvim session and others functions
This commit is contained in:
17
lua/plugins/alpha.lua
Normal file
17
lua/plugins/alpha.lua
Normal file
@@ -0,0 +1,17 @@
|
||||
return {
|
||||
'goolord/alpha-nvim',
|
||||
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||
config = function ()
|
||||
local dashboard = require'alpha.themes.startify'
|
||||
-- Tu peux personnaliser le header ici avec un ASCII art de ton choix
|
||||
dashboard.section.header.val = {
|
||||
[[ __ ]],
|
||||
[[ ___ ___ ___ __ __ /\_\ ___ ___ ]],
|
||||
[[ /' _ `\ /'__`\ / __`\/\ \/\ \\/\ \ /' __` __`\ ]],
|
||||
[[ /\ \/\ \/\ __//\ \_\ \ \ \_/ |\ \ \ /\ \/\ \/\ \ ]],
|
||||
[[ \ \_\ \_\ \____\ \____/\ \___/ \ \_\\ \_\ \_\ \_\]],
|
||||
[[ \/_/\/_/\/____/\/___/ \/__/ \/_/ \/_/\/_/\/_/]],
|
||||
}
|
||||
require'alpha'.setup(dashboard.config)
|
||||
end
|
||||
};
|
||||
26
lua/plugins/completion.lua
Normal file
26
lua/plugins/completion.lua
Normal file
@@ -0,0 +1,26 @@
|
||||
return {
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp", -- Source LSP
|
||||
"hrsh7th/cmp-buffer", -- Source mots du buffer actuel
|
||||
"hrsh7th/cmp-path", -- Source chemins de fichiers
|
||||
"L3MON4D3/LuaSnip", -- Moteur de snippets
|
||||
},
|
||||
config = function()
|
||||
local cmp = require("cmp")
|
||||
cmp.setup({
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Entrée pour valider
|
||||
['<Tab>'] = cmp.mapping.select_next_item(), -- Tab pour descendre
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim-lsp' },
|
||||
{ name = 'buffer' },
|
||||
{ name = 'path' },
|
||||
})
|
||||
})
|
||||
end
|
||||
}
|
||||
13
lua/plugins/persistence.lua
Normal file
13
lua/plugins/persistence.lua
Normal file
@@ -0,0 +1,13 @@
|
||||
return {
|
||||
"folke/persistence.nvim",
|
||||
event = "BufReadPre", -- Charge le plugin au besoin
|
||||
opts = { options = { "buffers", "curdir", "tabpages", "winsize" } },
|
||||
keys = {
|
||||
-- Charger la session du répertoire actuel
|
||||
{ "<leader>qs", function() require("persistence").load() end, desc = "Restore Session" },
|
||||
-- Charger la dernière session (même si on est ailleurs)
|
||||
{ "<leader>ql", function() require("persistence").load({ last = true }) end, desc = "Restore Last Session" },
|
||||
-- Ne pas sauvegarder la session actuelle
|
||||
{ "<leader>qd", function() require("persistence").stop() end, desc = "Don't Save Current Session" },
|
||||
},
|
||||
}
|
||||
29
lua/plugins/terminal.lua
Normal file
29
lua/plugins/terminal.lua
Normal file
@@ -0,0 +1,29 @@
|
||||
return {
|
||||
'akinsho/toggleterm.nvim',
|
||||
version = "*",
|
||||
config = function()
|
||||
require("toggleterm").setup({
|
||||
size = 20,
|
||||
open_mapping = [[<c-\>]], -- Ctrl + \ pour ouvrir/fermer
|
||||
hide_numbers = true,
|
||||
shade_terminals = true,
|
||||
direction = 'float', -- 'vertical', 'horizontal' ou 'float'
|
||||
float_opts = {
|
||||
border = 'curved',
|
||||
winblend = 3,
|
||||
},
|
||||
})
|
||||
|
||||
-- Raccourcis pratiques une fois DANS le terminal
|
||||
function _G.set_terminal_keymaps()
|
||||
local opts = {buffer = 0}
|
||||
vim.keymap.set('t', '<esc>', [[<C-\><C-n>]], opts) -- Esc pour sortir du mode insertion terminal
|
||||
vim.keymap.set('t', '<C-h>', [[<Cmd>wincmd h<CR>]], opts)
|
||||
vim.keymap.set('t', '<C-j>', [[<Cmd>wincmd j<CR>]], opts)
|
||||
vim.keymap.set('t', '<C-k>', [[<Cmd>wincmd k<CR>]], opts)
|
||||
vim.keymap.set('t', '<C-l>', [[<Cmd>wincmd l<CR>]], opts)
|
||||
end
|
||||
|
||||
vim.cmd('autocmd! TermOpen term://* lua set_terminal_keymaps()')
|
||||
end
|
||||
}
|
||||
Reference in New Issue
Block a user