45 lines
1.4 KiB
Lua
45 lines
1.4 KiB
Lua
-- ======================================================================
|
|
-- init.lua — Neovim configuration with modular structure
|
|
-- ======================================================================
|
|
|
|
-- Set leader keys before lazy.nvim
|
|
vim.g.mapleader = " "
|
|
vim.g.maplocalleader = " "
|
|
|
|
-- Bootstrap lazy.nvim
|
|
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
|
if not vim.loop.fs_stat(lazypath) then
|
|
vim.fn.system({
|
|
"git", "clone", "--filter=blob:none",
|
|
"https://github.com/folke/lazy.nvim.git", "--branch=stable",
|
|
lazypath,
|
|
})
|
|
end
|
|
vim.opt.rtp:prepend(lazypath)
|
|
|
|
-- Load configuration modules
|
|
require("options")
|
|
require("keymaps")
|
|
|
|
-- Load plugins
|
|
require("lazy").setup("plugins", {
|
|
change_detection = { notify = false },
|
|
})
|
|
|
|
-- Load utilities and create commands
|
|
local utils = require("utils")
|
|
vim.api.nvim_create_user_command("ShowFileNameRight", utils.show_filename_right, {})
|
|
|
|
-- MCP Server Integration - Start socket if not already listening
|
|
if vim.fn.serverstart then
|
|
local socket_path = "/tmp/nvim"
|
|
-- Only start server if not already listening
|
|
if vim.v.servername == "" or vim.v.servername ~= socket_path then
|
|
-- Try to start server, ignore if address already in use
|
|
local ok, err = pcall(vim.fn.serverstart, socket_path)
|
|
if not ok and not string.match(err or "", "address already in use") then
|
|
vim.notify("Failed to start MCP server: " .. tostring(err), vim.log.levels.WARN)
|
|
end
|
|
end
|
|
end
|