-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
166 lines (134 loc) · 4.54 KB
/
init.lua
File metadata and controls
166 lines (134 loc) · 4.54 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
--[[
_ __ __ _| |_| |__ ___ _ __ _____ _(_)_ __ ___
| '_ \ / _` | __| '_ \ / _ \| '_ ` _ \ \ / / | '_ ` _ \
| | | | (_| | |_| | | | (_) | | | | | \ V /| | | | | | |
|_| |_|\__,_|\__|_| |_|\___/|_| |_| |_|\_/ |_|_| |_| |_|
--]]
-- Disable built-in plugins for faster startup
local disabled_built_ins = {
"gzip",
"matchit",
"matchparen",
"tarPlugin",
"tar",
"zipPlugin",
"zip",
"netrwPlugin",
"2html_plugin",
"tutor",
"tohtml",
"spellfile",
"rplugin",
"editorconfig",
}
for _, plugin in ipairs(disabled_built_ins) do
vim.g["loaded_" .. plugin] = 1
end
require("nixCatsUtils").setup({
non_nix_value = true,
})
vim.g.mapleader = " "
vim.g.maplocalleader = ","
-- Set to true if you have a Nerd Font installed and selected in the terminal
-- NOTE: nixCats: we asked nix if we have it instead of setting it here.
-- because nix is more likely to know if we have a nerd font or not.
vim.g.have_nerd_font = nixCats("have_nerd_font")
-- [[ Setting options ]]
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.mouse = "a"
vim.opt.swapfile = false
vim.opt.showmode = false
vim.opt.clipboard = "unnamedplus"
vim.opt.breakindent = true
vim.opt.undofile = true
vim.opt.ignorecase = true
vim.opt.smartcase = true
vim.opt.signcolumn = "yes"
vim.opt.updatetime = 250
vim.opt.timeoutlen = 300
vim.opt.splitright = true
vim.opt.splitbelow = true
vim.opt.list = true
vim.opt.listchars = { tab = "» ", trail = "·", nbsp = "␣" }
vim.opt.inccommand = "split"
vim.opt.cursorline = true
vim.opt.scrolloff = 10
-- Auto-reload files when changed externally
-- If there are unsaved changes, Neovim will prompt before reloading
vim.opt.autoread = true
vim.api.nvim_create_autocmd({ "FocusGained", "BufEnter", "CursorHold", "CursorHoldI" }, {
desc = "Check if file changed externally and reload",
group = vim.api.nvim_create_augroup("checktime", { clear = true }),
command = "checktime",
})
-- [[ Basic Keymaps ]]
vim.opt.hlsearch = true
vim.keymap.set("n", "<Esc>", "<cmd>nohlsearch<CR>")
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, { desc = "Go to previous [D]iagnostic message" })
vim.keymap.set("n", "]d", vim.diagnostic.goto_next, { desc = "Go to next [D]iagnostic message" })
vim.keymap.set("n", "L", vim.diagnostic.open_float, { desc = "Show diagnostic [E]rror messages" })
vim.keymap.set("n", "<leader>q", vim.diagnostic.setloclist, { desc = "Open diagnostic [Q]uickfix list" })
vim.keymap.set("n", "<localleader>w", function()
vim.cmd([[w!]])
end, { desc = "Open diagnostic [Q]uickfix list" })
vim.cmd([[command! Q qa!]])
vim.keymap.set("t", "<Esc><Esc>", "<C-\\><C-n>", { desc = "Exit terminal mode" })
vim.keymap.set("n", "<localleader>q", "<cmd>Sayonara<cr>")
-- [[ Basic Autocommands ]]
vim.api.nvim_create_autocmd("TextYankPost", {
desc = "Highlight when yanking (copying) text",
group = vim.api.nvim_create_augroup("kickstart-highlight-yank", { clear = true }),
callback = function()
vim.highlight.on_yank()
end,
})
vim.opt.autowriteall = true
-- Write all modified real files when Neovim loses focus (e.g., you switch tmux panes)
local grp = vim.api.nvim_create_augroup("AutosaveOnBlur", { clear = true })
vim.api.nvim_create_autocmd("FocusLost", {
group = grp,
callback = function()
pcall(vim.cmd, "silent! wall") -- no noise on special buffers
end,
})
local function getlockfilepath()
if require("nixCatsUtils").isNixCats and type(nixCats.settings.unwrappedCfgPath) == "string" then
return nixCats.settings.unwrappedCfgPath .. "/lazy-lock.json"
else
return vim.fn.stdpath("config") .. "/lazy-lock.json"
end
end
local lazyOptions = {
lockfile = getlockfilepath(),
ui = {
icons = vim.g.have_nerd_font and {} or {
cmd = "⌘",
config = "🛠",
event = "📅",
ft = "📂",
init = "⚙",
keys = "🗝",
plugin = "🔌",
runtime = "💻",
require = "🌙",
source = "📄",
start = "🚀",
task = "📌",
lazy = "💤 ",
},
},
}
-- [[ Configure and install plugins ]]
-- NOTE: nixCats: this the lazy wrapper. Use it like require('lazy').setup() but with an extra
-- argument, the path to lazy.nvim as downloaded by nix, or nil, before the normal arguments.
require("nixCatsUtils.lazyCat").setup(nixCats.pawsible({ "allPlugins", "start", "lazy.nvim" }), {
{ import = "plugins.core" },
{ import = "plugins.navigation" },
{ import = "plugins.git" },
{ import = "plugins.development" },
{ import = "plugins.latex" },
{ import = "plugins.ai" },
{ import = "plugins.debug" },
{ import = "plugins.autopairs" },
}, lazyOptions)