Repository navigation
Expand file tree
/
Copy pathinit.lua
More file actions
298 lines (258 loc) · 9.91 KB
/
Copy pathinit.lua
File metadata and controls
298 lines (258 loc) · 9.91 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
-- Cache Lua modules to reduce startup time.
vim.loader.enable()
-- 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
-- disable netrw at the very start of your init.lua
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
-- [[ General Settings ]]
-- NOTE: You can change these settings as you wish!
-- GoLang specific settings
vim.g.go_fmt_command = 'gofumpt'
vim.g.go_auto_type_info = 1
-- Disable border highlights background for Neotree
-- Force floating windows to have a transparent background
vim.api.nvim_set_hl(0, 'NormalFloat', { bg = 'NONE', ctermbg = 'NONE' })
vim.api.nvim_set_hl(0, 'FloatBorder', { bg = 'NONE', ctermbg = 'NONE' })
-- [[ Setting options ]]
-- See `:help vim.opt`
-- NOTE: You can change these options as you wish!
-- For more options, you can see `:help option-list`
-- Make line numbers default
vim.opt.number = true
-- You can also add relative line numbers, to help with jumping.
-- Experiment for yourself to see if you like it!
vim.opt.relativenumber = true
-- Enabling termguicolors
vim.opt.termguicolors = true
-- Enable mouse mode, can be useful for resizing splits for example!
vim.opt.mouse = 'a'
-- Don't show the mode, since it's already in the status line
vim.opt.showmode = false
-- Sync clipboard between OS and Neovim.
-- Schedule the setting after `UiEnter` because it can increase startup-time.
-- Remove this option if you want your OS clipboard to remain independent.
-- See `:help 'clipboard'`
vim.schedule(function()
vim.opt.clipboard = 'unnamedplus'
end)
-- 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
-- Keep signcolumn on by default
vim.opt.signcolumn = 'yes'
-- Decrease update time
vim.opt.updatetime = 250
-- Decrease mapped sequence wait time
vim.opt.timeoutlen = 300
-- Configure how new splits should be opened
vim.opt.splitright = true
vim.opt.splitbelow = true
-- 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 = '·', nbsp = '␣' }
-- Preview substitutions live, as you type!
vim.opt.inccommand = 'split'
-- Show which line your cursor is on
vim.opt.cursorline = true
-- Minimal number of screen lines to keep above and below the cursor.
vim.opt.scrolloff = 10
-- Diagnostic signs
if vim.g.have_nerd_font then
local diagnostic_signs = {
[vim.diagnostic.severity.ERROR] = ' ',
[vim.diagnostic.severity.WARN] = ' ',
[vim.diagnostic.severity.INFO] = ' ',
[vim.diagnostic.severity.HINT] = '',
}
vim.diagnostic.config { signs = { text = diagnostic_signs } }
end
-- [[ Basic Keymaps ]]
-- See `:help vim.keymap.set()`
-- Clear highlights on search when pressing <Esc> in normal mode
-- See `:help hlsearch`
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
-- Diagnostic keymaps
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
-- for people to discover. Otherwise, you normally need to press <C-\><C-n>, which
-- is not what someone will guess without a bit more experience.
--
-- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping
-- or just use <C-\><C-n> to exit terminal mode
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })
-- TIP: Disable arrow keys in normal mode
-- vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
-- vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
-- vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
-- vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
-- Keybinds to make split navigation easier.
-- Use CTRL+<hjkl> to switch between windows
--
-- See `:help wincmd` for a list of all window commands
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' })
-- [[ Basic Autocommands ]]
-- See `:help lua-guide-autocommands`
-- Highlight when yanking (copying) text
-- Try it with `yap` in normal mode
-- See `:help vim.hl.on_yank()`
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.hl.on_yank()
end,
})
-- [[ Default Tab Width ]]
-- Set the default tab width to 4 spaces
vim.opt.tabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = true
vim.opt.autoindent = true
-- [[ Go-specific Indentation Setting ]]
-- See `:help lua-guide-autocommands`
--
-- This line adds an autocommand that sets the tabstop, shiftwidth, and expandtab for Go files.
vim.api.nvim_create_autocmd('FileType', {
pattern = 'go',
callback = function()
vim.opt_local.tabstop = 4
vim.opt_local.shiftwidth = 4
vim.opt_local.expandtab = false
end,
})
-- [[ Basic Keybind Navigation ]]
-- A custom keybind to ease navigation in the editor.
-- [[ Custom Functions ]]
-- A custom function to randomize the color of the silicon image.
-- Plugin is installed later in the config.
vim.api.nvim_get_silicon_color = function()
local hex = '0123456789ABCDEF'
local color = '#'
for i = 1, 6 do
local index = math.random(1, #hex)
color = color .. hex:sub(index, index)
end
return color
end
-- [[ Install `lazy.nvim` plugin manager ]]
-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info
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)
-- [[ Configure and install plugins ]]
--
-- To check the current status of your plugins, run
-- :Lazy
--
-- You can press `?` in this menu for help. Use `:q` to close the window
--
-- To update plugins you can run
-- :Lazy update
--
-- NOTE: Here is where you install your plugins.
--
-- Every plugin is modularized into its own file under `lua/plugins/`,
-- imported below with `{ import = 'plugins.<name>' }`. Each file returns
-- either a single plugin spec or a list of specs.
--
-- To add a new plugin:
-- 1. Create `lua/plugins/<name>.lua` returning a plugin spec
-- (see `:help lazy.nvim-structuring-your-plugins`).
-- 2. Add a matching `{ import = 'plugins.<name>' }` line to the list below.
require('lazy').setup({
{ import = 'plugins.startuptime' },
{ import = 'plugins.snacks-nvim' },
{ import = 'plugins.sleuth' },
{ import = 'plugins.gitsigns' },
-- NOTE: Copilot is disabled by default (requires a paid GitHub Copilot
-- subscription and a Copilot license).
-- Uncomment these two lines and run `:Lazy install` to enable them.
-- { import = 'plugins.copilot' },
-- { import = 'plugins.copilot-chat' },
{ import = 'plugins.obsidian' },
{ import = 'plugins.silicon' },
-- { import = 'plugins.live-share' },
{ import = 'plugins.hexokinase' },
{ import = 'plugins.tmux-navigator' },
{ import = 'plugins.presence' },
{ import = 'plugins.none-ls' },
{ import = 'plugins.lualine' },
{ import = 'plugins.mini-bufremove' },
{ import = 'plugins.harpoon' },
{ import = 'plugins.neo-tree' },
{ import = 'plugins.nvim-lsp-file-operations' },
{ import = 'plugins.aerial' },
{ import = 'plugins.comment' },
{ import = 'plugins.lazygit' },
{ import = 'plugins.autopairs' },
{ import = 'plugins.autotag' },
{ import = 'plugins.render-markdown' },
{ import = 'plugins.which-key' },
{ import = 'plugins.notify' },
{ import = 'plugins.noice' },
{ import = 'plugins.refactoring' },
{ import = 'plugins.neorg' },
{ import = 'plugins.telescope' },
{ import = 'plugins.lazydev' },
{ import = 'plugins.luvit-meta' },
{ import = 'plugins.lspconfig' },
{ import = 'plugins.dap' },
{ import = 'plugins.dap-ui' },
{ import = 'plugins.conform' },
{ import = 'plugins.cmp' },
-- NOTE: Theme-testing plugins kept for experimentation. All disabled by default.
-- Uncomment the line(s) below and run `:Lazy install` to try them out.
-- { import = 'plugins.transparent' }, -- Transparent background
-- { import = 'plugins.thorn' }, -- Different theme testing
-- { import = 'plugins.catppuccin' }, -- Different colorscheme testing
{ import = 'plugins.todo-comments' },
{ import = 'plugins.mini' },
{ import = 'plugins.mdx' },
{ import = 'plugins.treesitter' },
-- NOTE: Integration with Noctalia's matugen via base16.
-- Compatible with V5's community template.
--
{ import = 'plugins.base16' },
}, {
ui = {
-- If you are using a Nerd Font: set icons to an empty table which will use the
-- default lazy.nvim defined Nerd Font icons, otherwise define a unicode icons table
icons = vim.g.have_nerd_font and {} or {
cmd = '⌘',
config = '🛠',
event = '📅',
ft = '📂',
init = '⚙',
keys = '🗝',
plugin = '🔌',
runtime = '💻',
require = '🌙',
source = '📄',
start = '🚀',
task = '📌',
lazy = '💤 ',
},
},
})
-- The line beneath this is called `modeline`. See `:help modeline`
-- vim: ts=2 sts=2 sw=2 et