This commit is contained in:
2025-08-04 17:36:35 +02:00
parent 9800f5d265
commit ecaf50a044
11 changed files with 71 additions and 31 deletions

View File

@@ -84,29 +84,21 @@ I hope you enjoy your Neovim journey,
P.S. You can delete this when you're done too. It's your config now! :)
--]]
-- Set <space> as the leader key
-- See `:help mapleader`
-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used)
vim.g.mapleader = ';'
vim.g.maplocalleader = ';'
-- Set to true if you have a Nerd Font installed and selected in the terminal
vim.g.have_nerd_font = true
-- [[ Setting options ]]
require 'options'
-- [[ Keymaps ]]
require 'keymaps'
-- [[ Basic Autocommands ]]
require 'autocommands'
-- [[ Core options ]]
require 'kickstart.core.options'
-- [[ Install `lazy.nvim` plugin manager ]]
require 'lazy-bootstrap'
require 'kickstart.core.lazy-bootstrap'
-- [[ Configure and install plugins ]]
require 'lazy-plugins'
require 'kickstart.core.lazy-plugins'
-- [[ Basic Autocommands ]]
require 'kickstart.core.autocommands'
-- [[ Keymaps ]]
require 'kickstart.core.keymaps'
require 'custom.keymaps'
-- The line beneath this is called `modeline`. See `:help modeline`
-- vim: ts=2 sts=2 sw=2 et

View File

@@ -0,0 +1,2 @@
-- load which-key mappings
require 'custom.keymaps.neotree'

View File

@@ -0,0 +1,7 @@
local wk = require 'which-key'
local neotree = require 'custom.plugins.neotree'
wk.add({
{ "<leader>f", group = "file" }, -- group
{ '<leader>fe', neotree.smart_open(), desc = 'Fichiers...', mode = 'n' },
})

View File

@@ -0,0 +1,24 @@
local M = {}
function M.smart_open()
local bufname = vim.api.nvim_buf_get_name(0)
local is_real_file = vim.fn.filereadable(bufname) == 1
local cwd = vim.fn.getcwd()
local target_path = "~"
if is_real_file then
target_path = vim.fn.fnamemodify(bufname, ":p:h")
elseif bufname ~= "" then
-- buffer avec un nom mais fichier inexistant (ex: nouveau buffer)
target_path = "~"
elseif vim.bo.filetype == "starter" then
-- buffer mini.starter
target_path = "~"
end
-- Appel de Neotree avec le bon dossier
vim.cmd("Neotree toggle reveal=true position=float dir=" .. target_path)
end
return M

View File

@@ -1,7 +0,0 @@
-- local wk = require 'kickstart.plugins.which-key'
-- load neovim standard mappings
require 'keymaps.base'
-- load which-key mappings
--require 'keymaps.neotree'

View File

@@ -1,5 +0,0 @@
local wk = require 'kickstart.plugins.which-key'
wk.register {
{ '<leader>e', '<cmd>Neotree toggle reveal<cr>', desc = 'Fichiers...', mode = 'n' },
}

View File

@@ -12,5 +12,22 @@ vim.api.nvim_create_autocmd('TextYankPost', {
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 == "starter" then
-- neotree_utils.smart_open()
-- end
-- end, 100) -- délai pour laisser mini.starter s'afficher
-- end,
-- })
-- The line beneath this is called `modeline`. See `:help modeline`
-- vim: ts=2 sts=2 sw=2 et

View File

@@ -1,3 +1,13 @@
-- [[ Global settings ]]
-- Set <space> as the leader key
-- See `:help mapleader`
-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used)
vim.g.mapleader = ';'
vim.g.maplocalleader = ';'
-- Set to true if you have a Nerd Font installed and selected in the terminal
vim.g.have_nerd_font = true
-- [[ Setting options ]]
-- See `:help vim.o`
-- NOTE: You can change these options as you wish!