summaryrefslogtreecommitdiff
path: root/lua/config/options.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/config/options.lua')
-rw-r--r--lua/config/options.lua54
1 files changed, 54 insertions, 0 deletions
diff --git a/lua/config/options.lua b/lua/config/options.lua
new file mode 100644
index 0000000..4bdfe21
--- /dev/null
+++ b/lua/config/options.lua
@@ -0,0 +1,54 @@
+-- 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'
+
+-- 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' })