From d69c281f43ba4168df32ef4ae6b77f88bfc60d86 Mon Sep 17 00:00:00 2001 From: ache Date: Sun, 21 Jul 2024 05:30:30 +0200 Subject: Init commit --- lua/ache/config/init.lua | 5 +++++ lua/ache/config/keymaps.lua | 36 ++++++++++++++++++++++++++++++++++++ lua/ache/config/options.lua | 41 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+) create mode 100644 lua/ache/config/init.lua create mode 100644 lua/ache/config/keymaps.lua create mode 100644 lua/ache/config/options.lua (limited to 'lua/ache/config') diff --git a/lua/ache/config/init.lua b/lua/ache/config/init.lua new file mode 100644 index 0000000..23d39b3 --- /dev/null +++ b/lua/ache/config/init.lua @@ -0,0 +1,5 @@ +require("ache.config.options") +require("ache.config.keymaps") + + +-- TODO: Try signcolumn=number diff --git a/lua/ache/config/keymaps.lua b/lua/ache/config/keymaps.lua new file mode 100644 index 0000000..1fd1125 --- /dev/null +++ b/lua/ache/config/keymaps.lua @@ -0,0 +1,36 @@ +vim.g.mapleader = "!" + +-- vim.keymap.set(mode, lhs, rhs, opts?) +-- mode is: +-- n => normal mode +vim.keymap.set("n", "//", ":nohls", { desc = "clear search highlights" }) +vim.keymap.set("n", "cd", ":cd ", { desc = "change directory" }) + +-- command alias => ca +vim.keymap.set("ca", "tn", "tabnew") + +-- Make some unvisible chars visible. +vim.opt.list = true +vim.opt.listchars = { + tab = "› ", + -- lead = '·', -- lead is just an invisible normal space + trail = "ꞏ", + extends = "♯", + eol = "¬", + nbsp = "⍽", +} + +vim.keymap.set("n", "", ":w", { desc = "quick save file" }) + +-- Number increment +-- It's c-a for Add ! and c-x to decress ! But since you just can't remenber ... +vim.keymap.set("n", "+", "", { desc = "Increment number" }) +vim.keymap.set("n", "-", "", { desc = "Decrement number" }) + +-- Window management +-- Just use ! + +-- Tab navigation +vim.keymap.set("n", "t", "tabnext", { desc = "Go to next tab" }) +vim.keymap.set("n", "t", "tabp", { desc = "Go to previous tab" }) +vim.keymap.set("n", "gt", "tabnew %", { desc = "Open current buffer into a new tab" }) diff --git a/lua/ache/config/options.lua b/lua/ache/config/options.lua new file mode 100644 index 0000000..c2a8d86 --- /dev/null +++ b/lua/ache/config/options.lua @@ -0,0 +1,41 @@ +vim.cmd("let g:netrw_liststyle = 3") + +local opt = { + -- Numbering + relativenumber = true, + number = true, + + -- tabs & indentation + tabstop = 2, -- a tab is 2 spaces width + shiftwidth = 2, -- 2 spaces to indent + expandtab = true, -- transform tab to space. Use to insert tab. + autoindent = true, -- copy indent from current line when starting new one + + -- Long line management. + wrap = true, + + -- search + ignorecase = true, -- ignore case when typing but ⤵ + smartcase = true, -- mixed case in search imply case-sensitive search + + cursorline = true, + + -- turn on termguicolor for colorscheme to work + termguicolors = true, + -- background = "dark", + signcolumn = "yes:1", -- TODO: Try number ! + + -- split behavior + splitright = true, + splitbelow = true, + + -- Use the system clipboard using external program like xsel + clipboard = "unnamedplus", + + -- I fucking don't know + backspace = "indent,eol,start", +} + +for k, v in pairs(opt) do + vim.opt[k] = v +end -- cgit v1.3-2-g11bf