From 6ce99540d19903004c042b9208ac8ea3d9b2268a Mon Sep 17 00:00:00 2001 From: Petr Hrdina Date: Wed, 14 Jan 2026 20:10:46 +0100 Subject: [PATCH] Improve file structure --- init.lua | 49 ++++++------------------------------------ lazy-lock.json | 4 ++++ lua/config/keymaps.lua | 12 +++++++++++ lua/config/lazy.lua | 9 +++++++- lua/config/options.lua | 30 ++++++++++++++++++++++++++ 5 files changed, 60 insertions(+), 44 deletions(-) create mode 100644 lazy-lock.json create mode 100644 lua/config/keymaps.lua create mode 100644 lua/config/options.lua diff --git a/init.lua b/init.lua index 83520c0..0f38d93 100644 --- a/init.lua +++ b/init.lua @@ -2,49 +2,12 @@ vim.g.mapleader = " " vim.g.maplocalleader = " " +-- Load options first +require("config.options") + +-- Load keymaps +require("config.keymaps") + -- Load lazy.nvim require("config.lazy") --- Line numbers -vim.opt.number = true -vim.opt.relativenumber = true - --- Tabs & indentation -vim.opt.tabstop = 4 -- number of spaces a tab counts for -vim.opt.shiftwidth = 4 -- spaces for each indent -vim.opt.expandtab = true -- convert tabs to spaces -vim.opt.smartindent = true - --- Searching -vim.opt.ignorecase = true -- case-insensitive search... -vim.opt.smartcase = true -- ...unless you use capitals -vim.opt.hlsearch = true -vim.opt.incsearch = true - --- UI / UX -vim.opt.termguicolors = true -vim.opt.cursorline = true -vim.opt.signcolumn = "yes" -- avoid text shifting -vim.opt.wrap = false -- no line wrapping - --- Behavior -vim.opt.scrolloff = 8 -- keep lines above/below cursor -vim.opt.sidescrolloff = 8 -vim.opt.updatetime = 300 -- faster diagnostics -vim.opt.timeoutlen = 500 -- faster key sequences - --- Clipboard (use system clipboard) -vim.opt.clipboard = "unnamedplus" - --- Save & quit -vim.keymap.set("n", "w", ":w") -vim.keymap.set("n", "q", ":q") - --- Clear search highlight -vim.keymap.set("n", "h", ":nohlsearch") - --- Better window navigation -vim.keymap.set("n", "", "h") -vim.keymap.set("n", "", "j") -vim.keymap.set("n", "", "k") -vim.keymap.set("n", "", "l") diff --git a/lazy-lock.json b/lazy-lock.json new file mode 100644 index 0000000..d11e201 --- /dev/null +++ b/lazy-lock.json @@ -0,0 +1,4 @@ +{ + "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, + "tokyonight.nvim": { "branch": "main", "commit": "5da1b76e64daf4c5d410f06bcb6b9cb640da7dfd" } +} diff --git a/lua/config/keymaps.lua b/lua/config/keymaps.lua new file mode 100644 index 0000000..dd10d17 --- /dev/null +++ b/lua/config/keymaps.lua @@ -0,0 +1,12 @@ +-- Save & quit +vim.keymap.set("n", "w", ":w") +vim.keymap.set("n", "q", ":q") + +-- Clear search highlight +vim.keymap.set("n", "h", ":nohlsearch") + +-- Better window navigation +vim.keymap.set("n", "", "h") +vim.keymap.set("n", "", "j") +vim.keymap.set("n", "", "k") +vim.keymap.set("n", "", "l") diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua index 84f8da9..1134061 100644 --- a/lua/config/lazy.lua +++ b/lua/config/lazy.lua @@ -18,6 +18,13 @@ vim.opt.rtp:prepend(lazypath) -- Initialize lazy.nvim require("lazy").setup({ - -- plugins will go here + { + "folke/tokyonight.nvim", + lazy = false, -- load immediately + priority = 1000, -- load before other plugins + config = function() + vim.cmd("colorscheme tokyonight") + end, + }, }) diff --git a/lua/config/options.lua b/lua/config/options.lua new file mode 100644 index 0000000..3e176b0 --- /dev/null +++ b/lua/config/options.lua @@ -0,0 +1,30 @@ +-- Line numbers +vim.opt.number = true +vim.opt.relativenumber = true + +-- Tabs & indentation +vim.opt.tabstop = 4 -- number of spaces a tab counts for +vim.opt.shiftwidth = 4 -- spaces for each indent +vim.opt.expandtab = true -- convert tabs to spaces +vim.opt.smartindent = true + +-- Searching +vim.opt.ignorecase = true -- case-insensitive search... +vim.opt.smartcase = true -- ...unless you use capitals +vim.opt.hlsearch = true +vim.opt.incsearch = true + +-- UI / UX +vim.opt.termguicolors = true +vim.opt.cursorline = true +vim.opt.signcolumn = "yes" -- avoid text shifting +vim.opt.wrap = false -- no line wrapping + +-- Behavior +vim.opt.scrolloff = 8 -- keep lines above/below cursor +vim.opt.sidescrolloff = 8 +vim.opt.updatetime = 300 -- faster diagnostics +vim.opt.timeoutlen = 500 -- faster key sequences + +-- Clipboard (use system clipboard) +vim.opt.clipboard = "unnamedplus"