-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
365 lines (325 loc) · 10.5 KB
/
init.lua
File metadata and controls
365 lines (325 loc) · 10.5 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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
-------------------------------
--- Global variables
-------------------------------
-- Leader key
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
-- Nerd font icons
vim.g.have_nerd_font = true
-------------------------------
--- Options
-------------------------------
-- line numbers
vim.opt.number = true
-- relative line number
vim.opt.relativenumber = true
-- showmode (already in statusline)
vim.opt.showmode = false
-- Line wrapping
vim.opt.wrap = true
-- prevent words splitting
vim.opt.linebreak = true
-- line break indicator
vim.opt.showbreak = "➥"
-- Enable break indent
vim.opt.breakindent = true
-- Save undo history
vim.opt.undofile = true
-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term
vim.opt.ignorecase = true
vim.opt.smartcase = true
-- border
vim.opt.winborder = 'rounded'
-- Signcolumn (scale/line on the side)
vim.opt.signcolumn = 'yes'
-- Decrease update time
vim.opt.updatetime = 250
-- Decrease mapped sequence wait time
vim.opt.timeoutlen = 300
-- background
vim.opt.background = "dark"
-- Sets how neovim will display certain whitespace characters in the editor.
-- See `:help 'list'`
-- and `:help 'listchars'`
vim.opt.list = true
vim.opt.listchars = {
tab = '⇔ ',
trail = '●',
extends = '❱',
precedes = '❰',
nbsp = '␣'
}
-- Preview substitutions live, as you type!
vim.opt.inccommand = 'split'
-- Show which line cursor is on
vim.opt.cursorline = true
-- omnicompletion
vim.opt.completeopt = 'menuone,noselect,noinsert,longest,preview'
-- Minimal number of screen lines to keep above and below the cursor.
vim.opt.scrolloff = 10
vim.schedule(function()
-- Sync clipboard between OS and Neovim
-- vim.opt.clipboard = 'unnamedplus'
end)
-- enable lua bitecode caching
vim.loader.enable()
-------------------------------
-- Diagnostic
-------------------------------
vim.diagnostic.config {
signs = true,
severity_sort = true,
underline = true,
float = {
border = 'rounded',
severity_sort = true,
source = 'if_many',
}
}
-------------------------------
-- Keymaps
-------------------------------
-- Clear highlights on search when pressing <Esc> in normal mode
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
vim.keymap.set('n', '<C-h>', '<C-w><C-h>', { desc = 'Move focus to the left window' })
vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' })
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
require("config.keymap").global()
-------------------------------
-- Plugins
-------------------------------
--- convert short github links into full links
-- ---@param str string
-- ---@return string
-- local gh = function(str) return "https://github.com/" .. str end
vim.pack.add {
-- gh "maxmx03/fluoromachine.nvim",
"https://github.com/folke/lazy.nvim.git",
}
-- ---@type fluoromachine
-- require("fluoromachine").setup {
-- glow = true,
-- theme = "delta",
-- transparent = true,
-- overrides = {
-- ['@comment'] = { italic = false },
-- ['@constant'] = { italic = false },
-- ['@constant.builtin'] = { italic = false },
-- ['@constant.macro'] = { italic = false },
-- ['@constructor'] = { italic = false },
-- ['@function'] = { italic = false },
-- ['@function.builtin'] = { italic = false },
-- ['@function.macro'] = { italic = false },
-- ['@keyword'] = { italic = false },
-- ['@keyword.function'] = { italic = false },
-- ['@keyword.operator'] = { italic = false },
-- ['@keyword.return'] = { italic = false },
-- ['@parameter'] = { italic = false },
-- ['@string'] = { italic = false },
-- ['@string.regex'] = { italic = false },
-- ['@tag'] = { italic = false },
-- ['@type'] = { italic = false },
-- ['@type.definition'] = { italic = false },
-- ['@variable'] = { italic = false },
-- ['@variable.builtin'] = { italic = false },
-- }
-- }
-- vim.cmd.colorscheme "fluoromachine"
-- [[ `lazy.nvim` plugin manager ]]
-- local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
-- if not (vim.uv or vim.loop).fs_stat(lazypath) then
-- local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
-- local out = vim.fn.system {
-- 'git',
-- 'clone',
-- '--filter=blob:none',
-- '--branch=stable',
-- lazyrepo,
-- lazypath
-- }
-- if vim.v.shell_error ~= 0 then
-- error('Error cloning lazy.nvim:\n' .. out)
-- end
-- end ---@diagnostic disable-next-line: undefined-field
-- vim.opt.rtp:prepend(lazypath)
-- [[ lazy.nvim and plugins setup ]]
require('lazy').setup({
---- [[ plugins ]] ----
'tpope/vim-sleuth',
-- PERF: Theme
{
"catppuccin/nvim",
name = "catppuccin",
priority = 1000,
enabled = false,
lazy = false,
opts = {
transparent_background = true,
no_italic = true,
float = { transparent = true },
},
config = function(_, opts)
require("catppuccin").setup(opts)
vim.cmd.colorscheme "catppuccin-mocha"
end,
},
{
"maxmx03/fluoromachine.nvim",
priority = 1000,
lazy = false,
opts = {
glow = true,
theme = "delta",
transparent = true,
overrides = {
['@comment'] = { italic = false },
['@constant'] = { italic = false },
['@constant.builtin'] = { italic = false },
['@constant.macro'] = { italic = false },
['@constructor'] = { italic = false },
['@function'] = { italic = false },
['@function.builtin'] = { italic = false },
['@function.macro'] = { italic = false },
['@keyword'] = { italic = false },
['@keyword.function'] = { italic = false },
['@keyword.operator'] = { italic = false },
['@keyword.return'] = { italic = false },
['@parameter'] = { italic = false },
['@string'] = { italic = false },
['@string.regex'] = { italic = false },
['@tag'] = { italic = false },
['@type'] = { italic = false },
['@type.definition'] = { italic = false },
['@variable'] = { italic = false },
['@variable.builtin'] = { italic = false },
}
},
config = function(_, opts)
require("fluoromachine").setup(opts)
vim.cmd.colorscheme "fluoromachine"
end,
},
-- PERF: Icons
{ 'nvim-tree/nvim-web-devicons', lazy = true },
-- PERF: Highlight comments
{
"folke/todo-comments.nvim",
event = 'VimEnter',
dependencies = { "nvim-lua/plenary.nvim" },
opts = { signs = true }
},
-- PERF: Completion
{
'saghen/blink.cmp',
dependencies = { 'rafamadriz/friendly-snippets' },
version = '1.*',
---@module 'blink.cmp'
---@type blink.cmp.Config
opts = {
keymap = { preset = 'default' },
appearance = {
nerd_font_variant = 'mono'
},
completion = { documentation = { auto_show = true } },
sources = {
default = { 'lsp', 'path', 'snippets', 'buffer' },
},
fuzzy = { implementation = "prefer_rust_with_warning" }
},
opts_extend = { "sources.default" }
}
,
-- PERF: Syntex Parsing
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
-- main = "nvim-treesitter.configs",
opts = {
auto_install = true,
ensure_installed = { 'bash', 'c', 'diff', 'html', 'css', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' },
-- PERF: Syntax highlighting
highlight = {
enable = true,
additional_vim_regex_highlighting = { 'ruby' },
},
-- PREF: Indentation
indent = { enable = true, disable = { 'ruby' } },
},
},
-- PERF: LSP
{
'neovim/nvim-lspconfig',
dependencies = {
{
'williamboman/mason.nvim',
opts = {},
dependencies = {
'williamboman/mason-lspconfig.nvim',
'WhoIsSethDaniel/mason-tool-installer.nvim',
{
'j-hui/fidget.nvim',
enabled = false,
opts = {
notification = {
window = {
border = "rounded",
winblend = 0,
},
},
}
},
},
},
{
"folke/lazydev.nvim",
ft = "lua", -- only load on lua files
opts = {
library = {
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
}
}
}
},
config = function()
vim.lsp.enable("lua_ls")
require "config.lspconfig"
end
},
-- PERF: showing available keybindings in a popup as you type
{
"folke/which-key.nvim",
event = "VeryLazy",
opts = {},
keys = {
{
"<leader>?",
function()
require("which-key").show({ global = false })
end,
desc = "Buffer Local Keymaps (which-key)",
}
}
},
-- PERF: import other plugins form lua/plugins dir
{ import = "plugins" },
---- [[ config ]] ----
checker = {
enabled = true,
frequency = 21600, -- check every 6hr
auto_install = true,
},
ui = {}
})
-- require("lazy").update({ show = true })
-------------------------------
-- Autocommands
-------------------------------
-- Highlight when yanking (copying) text
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
})