From 1c69d7378405324f4ae21b8fbe49863cd4ab718e Mon Sep 17 00:00:00 2001 From: Simon Lasbrugnas Date: Sat, 9 Nov 2024 00:28:22 +0100 Subject: [PATCH] chore: update options * Ignore case and use smart case for searches * Turn on line wrap, linebreak, breakindent * Inverse splits positions * Turn off --- more --- display --- lua/config/keymaps.lua | 11 ++++++++ lua/config/options.lua | 58 +++++++++++++++++++++++++----------------- 2 files changed, 45 insertions(+), 24 deletions(-) diff --git a/lua/config/keymaps.lua b/lua/config/keymaps.lua index ea32c65..7f34537 100644 --- a/lua/config/keymaps.lua +++ b/lua/config/keymaps.lua @@ -17,6 +17,17 @@ vim.keymap.set({ "n", "v" }, "y", [["+y]]) -- Escape terminal mode vim.keymap.set("t", "", "") +-- Toggle hlsearch if it's on, otherwise just do "enter" +vim.keymap.set("n", "", function() + ---@diagnostic disable-next-line: undefined-field + if vim.v.hlsearch == 1 then + vim.cmd.nohl() + return "" + else + return vim.keycode "" + end +end, { expr = true }) + vim.keymap.set("n", "bd", "bd") -- Thanks to Mr. Primeagen diff --git a/lua/config/options.lua b/lua/config/options.lua index 8a87eb2..b89cda0 100644 --- a/lua/config/options.lua +++ b/lua/config/options.lua @@ -1,33 +1,43 @@ -vim.opt.number = true -vim.opt.relativenumber = true +local opt = vim.opt -vim.opt.tabstop = 4 -vim.opt.softtabstop = 4 -vim.opt.shiftwidth = 4 -vim.opt.expandtab = false -vim.opt.smartindent = true -vim.opt.cursorline = true +opt.number = true +opt.relativenumber = true -vim.opt.wrap = false +opt.tabstop = 4 +opt.softtabstop = 4 +opt.shiftwidth = 4 +opt.expandtab = false +opt.smartindent = true +opt.cursorline = true -vim.opt.swapfile = false -vim.opt.backup = false -vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir" -vim.opt.undofile = true +opt.wrap = true +opt.linebreak = true +opt.breakindent = true +opt.showbreak = "> " -vim.opt.hlsearch = false -vim.opt.incsearch = true +opt.inccommand = "split" -vim.opt.termguicolors = true +opt.incsearch = true +opt.smartcase = true +opt.ignorecase = true -vim.opt.scrolloff = 8 -vim.opt.sidescrolloff = 16 +opt.splitbelow = true +opt.splitright = true -vim.opt.updatetime = 100 -vim.opt.list = true -vim.opt.listchars = "tab: ,extends:›,precedes:‹,nbsp:·,trail:·" +opt.formatoptions:remove "o" -vim.g.python3_host_prog = "/usr/bin/python3" +opt.swapfile = false +opt.backup = false +opt.undodir = os.getenv("HOME") .. "/.vim/undodir" +opt.undofile = true --- Always use system clipboard (I might regret this) -vim.opt.clipboard = "unnamedplus" +opt.termguicolors = true + +opt.scrolloff = 8 +opt.updatetime = 100 +opt.list = true +opt.listchars = "tab: ,extends:›,precedes:‹,nbsp:·,trail:·" + +opt.clipboard = "unnamedplus" + +opt.more = false