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
|
-- Leader keys (must be set before loading plugins)
vim.g.mapleader = " "
vim.g.maplocalleader = ","
-- Setup clipboard on Wayland
if os.getenv("WAYLAND_DISPLAY") and vim.fn.exepath("wl-copy") ~= "" then
vim.g.clipboard = {
name = "wl-clipboard",
copy = {
["+"] = "wl-copy",
["*"] = "wl-copy",
},
paste = {
["+"] = "wl-paste",
["*"] = "wl-paste",
},
cache_enabled = 1,
}
end
-- Terminal colors
vim.opt.termguicolors = true
-- Enable undo history
vim.opt.undofile = true
-- Line numbers
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.signcolumn = "yes:3"
-- Keep N lines above and below cursor
vim.opt.scrolloff = 5
-- Indentation
vim.opt.cpoptions:append("I")
vim.opt.expandtab = true
vim.opt.tabstop = 2
vim.opt.softtabstop = 2
vim.opt.shiftwidth = 2
-- Keymaps
local map = vim.keymap.set
-- Helix-like keymaps, as they are SO CONVENIENT
map({ "n", "v" }, "ge", "G", { desc = "Last line" })
map({ "n", "v" }, "gh", "^", { desc = "First non-whitespace char in line" })
map({ "n", "v" }, "gH", "0", { desc = "First char in line" })
map({ "n", "v" }, "gl", "$", { desc = "Last char in line" })
map({ "n", "v" }, "gm", "%", { desc = "Matching bracket" })
-- Make NeoVim open folds when searching
map("n", "n", "nzzzv", { desc = "Next Search Result" })
map("n", "N", "Nzzzv", { desc = "Previous Search Result" })
-- Reset search highlight on ESC
map("n", "<Esc>", "<cmd>nohlsearch<CR>", { desc = "Reset search highlight" })
|