-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
76 lines (53 loc) · 2.28 KB
/
init.lua
File metadata and controls
76 lines (53 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
-------------------------------------------------------------------------------
-- Neovim main configuration file.
-- This file is loaded by Neovim when it starts.
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-- Helpers
vim.opt.runtimepath:append("~/.config/nvim/lua/plugins") -- Set runtime path early (before any plugin loading).
local function require_safely(module)
local success, result = pcall(require, module)
if not success then
vim.notify("Problem loading " .. module .. ": " .. result, vim.log.levels.ERROR)
return false
end
return true
end
-------------------------------------------------------------------------------
-- VS Code and Neovim loaders
if vim.g.vscode then -- VSCode Neovim Extension.
require_safely("vs-code.options") -- Load options for Neovim VSCode extension.
require_safely("vs-code.keymaps") -- Load key mappings for Neovim VSCode extension.
if not require_safely("vs-code.lazy") then -- Load lazy.nvim plugins for VSCode.
vim.notify("VSCode plugins in /lua/vs-code/lazy.lua failed to load", vim.log.levels.ERROR)
end
else -- Ordinary Neovim
if not require_safely("core.options") then -- Load core options. Stops if it fails.
vim.notify("Core options in /lua/core/options.lua failed to load", vim.log.levels.ERROR)
return
end
require_safely("core.keymaps")
require_safely("core.autocmds")
if not require_safely("core.lazy") then
vim.notify("Plugins in /lua/core/lazy.lua failed to load", vim.log.levels.ERROR)
end
end
-------------------------------------------------------------------------------
-- Platform specific settings
local function setup_platform_settings()
local has = function(x)
return vim.fn.has(x) == 1
end
local is_mac = has ("macunix")
local is_win = has ("win32") or has ("win64")
if is_mac then
vim.opt.clipboard = { "unnamedplus" }
elseif is_win then
vim.opt.clipboard = { "unnamed", "unnamedplus" }
end
end
-- Apply platform settings with error handling
local platform_success = pcall(setup_platform_settings)
if not platform_success then
vim.notify("Platform specific settings failed to load", vim.log.levels.WARN)
end