summaryrefslogtreecommitdiff
path: root/init.lua
blob: 3b222006e7cad7d50c9c840d0e125cd88e0834af (plain)
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
--  ░██████╗░██╗░░░██╗██╗██╗░░██╗░█████╗░████████╗██╗░█████╗░░░░░░░███╗░░██╗██╗░░░██╗██╗███╗░░░███╗
--  ██╔═══██╗██║░░░██║██║╚██╗██╔╝██╔══██╗╚══██╔══╝██║██╔══██╗░░░░░░████╗░██║██║░░░██║██║████╗░████║
--  ██║██╗██║██║░░░██║██║░╚███╔╝░██║░░██║░░░██║░░░██║██║░░╚═╝█████╗██╔██╗██║╚██╗░██╔╝██║██╔████╔██║
--  ╚██████╔╝██║░░░██║██║░██╔██╗░██║░░██║░░░██║░░░██║██║░░██╗╚════╝██║╚████║░╚████╔╝░██║██║╚██╔╝██║
--  ░╚═██╔═╝░╚██████╔╝██║██╔╝╚██╗╚█████╔╝░░░██║░░░██║╚█████╔╝░░░░░░██║░╚███║░░╚██╔╝░░██║██║░╚═╝░██║
--  ░░░╚═╝░░░░╚═════╝░╚═╝╚═╝░░╚═╝░╚════╝░░░░╚═╝░░░╚═╝░╚════╝░░░░░░░╚═╝░░╚══╝░░░╚═╝░░░╚═╝╚═╝░░░░░╚═╝
--
--  By QuixoticNapoleon

--------------------------------------------------------
-- 🪶 Plugins
--------------------------------------------------------

require("config.lazy")
require("scripts.sudo")

--------------------------------------------------------
-- 🪶 Theme
--------------------------------------------------------

local dark_teal = "#003636"
vim.cmd("colorscheme terafox")

--------------------------------------------------------
-- 🪶 Basic Settings
--------------------------------------------------------

-- List Chars
vim.o.list = true
vim.opt.listchars = {
	tab = "»»",
	-- tab = "│»",
	space = "·",
	trail = "·",
	eol = "↲",
	extends = "›",
	precedes = "‹",
	nbsp = "␣",
}

-- Enable wrapping
vim.opt.wrap = true

-- Break lines at word boundaries
vim.opt.linebreak = true

-- Prefix shown on wrapped lines
vim.opt.showbreak = "↳ "

-- Indent wrapped lines to match indentation
vim.opt.breakindent = true

-- (Optional) fine-tune breakindent behavior
-- vim.opt.breakindentopt = "shift:2"

-- Line Numbers
vim.wo.number = true
vim.wo.relativenumber = true


-- Change the color of the line numbers
vim.api.nvim_set_hl(0, 'LineNr', { fg = '#74c4c4', bg = 'NONE' })
vim.api.nvim_set_hl(0, 'CursorLineNr', { fg = '#74c4c4', bg = 'NONE' })


-- Tab/Space defaults (spaces for most languages)
vim.cmd("set tabstop=4")
vim.cmd("set shiftwidth=4")
vim.cmd("set expandtab")
vim.cmd("set smarttab")

-- Indentation Options
vim.opt.indentkeys:remove(":")
vim.opt.cinkeys:remove(":")
vim.opt.smartindent = true

-- Tabs for C/C++/Zig/Go/Lua/Shell
vim.api.nvim_create_autocmd("FileType", {
	pattern = { "c", "cpp", "zig", "go", "lua", "sh", "zsh", "bash" },
	callback = function()
		vim.bo.expandtab = false
		vim.bo.tabstop = 4
		vim.bo.shiftwidth = 4
	end,
})



--------------------------------------------------------
-- 🪶 Basic Keybindings
--------------------------------------------------------

-- Leader Key
vim.g.mapleader = ' '

-- Tree
vim.api.nvim_set_keymap('n', '<leader>t', ':NvimTreeToggle<CR>', { noremap = true, silent = true })

-- ~/.config/nvim/lua/keymaps.lua
vim.keymap.set('n', '<Space>;', function()
	local row, col = unpack(vim.api.nvim_win_get_cursor(0)) -- save cursor
	local line = vim.api.nvim_get_current_line()

	-- Only add semicolon if it doesn't exist
	if not line:match(";$") then
		vim.api.nvim_set_current_line(line .. ";")
	end

	-- Restore cursor
	vim.api.nvim_win_set_cursor(0, {row, col})
end, { noremap = true, silent = true })


-- Telescope
local builtin = require('telescope.builtin')
vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
vim.keymap.set('n', '<leader>fg', builtin.live_grep, {})
vim.keymap.set('n', '<leader>fb', builtin.buffers, {})

-- UndoTree
vim.cmd.packadd("nvim.undotree")
vim.keymap.set("n", "<leader>u", function()
	require("undotree").open()
end, { desc = "Open undotree" })


-- 'a' on empty line: enter insert mode with correct indentation
vim.keymap.set('n', 'a', function()
	local line = vim.api.nvim_get_current_line()
	if line:match("^%s*$") then
		return '"_cc'
	end
	return 'a'
end, { noremap = true, expr = true })

-- Clipboard
vim.opt.clipboard = "unnamedplus"

--------------------------------------------------------
-- 🪶 GUI and Colour Configuration
--------------------------------------------------------

-- Colors
vim.opt.termguicolors = true
vim.opt.background = "dark"  -- or "light" depending on theme

-- Remove Vim Background
vim.api.nvim_set_hl(0, "Normal", { ctermbg = "none", bg = "none" })

-- Colors (Foreground and Background)
-- Neovide uses Neovim's colorscheme, so we’ll override via highlight groups
-- vim.api.nvim_set_hl(0, "Normal", { fg = "#8affff", bg = "#003636" })
vim.api.nvim_set_hl(0, "Normal", { fg = "#8affff", bg = "none", ctermbg = "none" })
vim.api.nvim_set_hl(0, "NormalFloat", { fg = "#8affff", bg = "#003636" })


-- Set font and size
-- vim.o.guifont = "JetBrainsMono Nerd Font:h14"
-- vim.o.guifont = "Source Code Pro:h10.5"
vim.o.guifont = "JetBrainsMono Nerd Font:h10.5"

-- Deleting keymaps
vim.keymap.del('n', 'y<C-g>')


-- General Neovim GUI
vim.cmd([[
	highlight Normal guibg=NONE ctermbg=NONE
	highlight NormalNC guibg=NONE ctermbg=NONE
	highlight LineNr guibg=NONE
	highlight SignColumn guibg=NONE
	highlight WinSeparator guifg=#74c4c4 guibg=NONE
	
	highlight Pmenu guibg=NONE
	highlight PmenuSel guifg=#FFFFFF guibg=#008282
	highlight Substitute guifg=#FFFFFF guibg=#008282
	highlight FloatBorder guifg=#74c4c4
	highlight StatusLine guibg=#003636
	
	highlight NvimTreeNormal guibg=NONE
	highlight NvimTreeNormalFloat guibg=NONE
	highlight NvimTreeCursorLine guibg=#395e5e
	
	highlight Visual guibg=#395e5e

	highlight EndOfBuffer guifg=#016868
	highlight SpecialKey guifg=#016868
	highlight Trailing guifg=#016868
	highlight Whitespace guifg=#016868
	highlight NonText guifg=#016868
	
	highlight TelescopeBorder guifg=#74c4c4 guibg=NONE
]])


-- For Tabs and Folds
vim.cmd [[
	highlight TabLineFill guibg=NONE

	highlight BufferCurrent guifg=#FFFFFF guibg=NONE
	highlight BufferVisible guifg=#CCCCCC guibg=NONE
	highlight BufferInactive guifg=#888888 guibg=NONE
	
	highlight BufferCurrentMod guifg=#fce094 guibg=NONE
	highlight BufferVisibleMod guibg=NONE
	highlight BufferInactiveMod guifg=#a89768 guibg=NONE
	
	highlight BufferDefaultCurrent guifg=#FFFFFF guibg=NONE
	highlight BufferDefaultVisible guifg=#CCCCCC guibg=NONE
	highlight BufferDefaultInactive guifg=#888888 guibg=NONE
	
	highlight BufferInactiveSign guifg=#8affff  guibg=NONE
	highlight BufferVisibleSign  guifg=#8affff  guibg=NONE
	highlight BufferCurrentSign  guifg=#8affff  guibg=NONE
	
	highlight BufferDefaultInactiveSign guifg=#8affff  guibg=NONE
	highlight BufferDefaultVisibleSign  guifg=#8affff  guibg=NONE
	highlight BufferDefaultCurrentSign  guifg=#8affff  guibg=NONE
	
	highlight BufferDefaultInactiveIcon guifg=#8affff  guibg=NONE
	highlight BufferDefaultVisibleIcon  guifg=#8affff  guibg=NONE
	highlight BufferDefaultCurrentIcon  guifg=#8affff  guibg=NONE
	
	highlight BufferInactiveIcon guifg=#8affff  guibg=NONE
	highlight BufferVisibleIcon  guifg=#8affff  guibg=NONE
	highlight BufferCurrentIcon  guifg=#8affff  guibg=NONE
	
	highlight BufferTabpageFill guibg=NONE
	
	highlight Folded guifg=#74c4c4  guibg=NONE
	highlight FoldColumn guifg=#74c4c4  guibg=NONE
]]

-- Syntax Highlighting
vim.cmd([[
	highlight Comment guifg=#00B4B4
	highlight Operator guifg=#5cb5b5
]])
vim.api.nvim_set_hl(0, "@variable", { fg = "#5cb5b5" })