From 506fa2b40a48894ceeefe1ad703cabb41631eab1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lukas=20H=C3=A4gele?= Date: Tue, 6 Jan 2026 17:21:24 +0100 Subject: [PATCH] add keymap for window split --- lua/config/keymap.lua | 12 ++++++++++++ lua/config/settings.lua | 2 +- lua/config/telescope/multigrep.lua | 14 +++++++------- plugin/sessionmanager.lua | 4 ++-- 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/lua/config/keymap.lua b/lua/config/keymap.lua index 467c268..663f564 100644 --- a/lua/config/keymap.lua +++ b/lua/config/keymap.lua @@ -5,6 +5,18 @@ vim.keymap.set('i', 'jj', '') vim.keymap.set("n", "#", "Vgc", { desc = "select line and toggle comment", remap = true }) vim.keymap.set("v", "#", "gc", { desc = "toggle comment of selected line", remap = true }) +-- window actions +vim.keymap.set("n", "s", function() + -- Define window configuration + local win_config = { + vertical = true, + width = math.floor(vim.o.columns * 0.4), + height = vim.o.lines + } + -- split window + vim.api.nvim_open_win(0, true, win_config) +end, { desc = "split vertically and move to new window" }) + -- move highlighted lines vim.keymap.set("v", "J", ":m '>+1gv=gv") vim.keymap.set("v", "K", ":m '<-2gv=gv") diff --git a/lua/config/settings.lua b/lua/config/settings.lua index 1eff867..f9fa0be 100644 --- a/lua/config/settings.lua +++ b/lua/config/settings.lua @@ -25,7 +25,7 @@ vim.opt.winborder = "rounded" -- vim.opt.termguicolors = false vim.opt.scrolloff = 8 -vim.opt.signcolumn = "yes:1" +vim.opt.signcolumn = "yes" vim.opt.isfname:append("@-@") vim.opt.updatetime = 50 diff --git a/lua/config/telescope/multigrep.lua b/lua/config/telescope/multigrep.lua index 1064fe6..4f34660 100644 --- a/lua/config/telescope/multigrep.lua +++ b/lua/config/telescope/multigrep.lua @@ -12,25 +12,25 @@ local live_multigrep = function(opts) local finder = finders.new_async_job { command_generator = function(prompt) if not prompt or prompt == "" then - return nil + return nil end local pieces = vim.split(prompt, " ") local args = { "rg" } if pieces[1] then - table.insert(args, "-e") - table.insert(args, pieces[1]) + table.insert(args, "-e") + table.insert(args, pieces[1]) end if pieces[2] then - table.insert(args, "-g") - table.insert(args, pieces[2]) + table.insert(args, "-g") + table.insert(args, pieces[2]) end return vim.tbl_flatten { - args, - { "--color=never", "--no-heading", "--with-filename", "--line-number", "--column", "--smart-case" }, + args, + { "--color=never", "--no-heading", "--with-filename", "--line-number", "--column", "--smart-case" }, } end, entry_maker = make_entry.gen_from_vimgrep(opts), diff --git a/plugin/sessionmanager.lua b/plugin/sessionmanager.lua index d4ac078..ab3d5dd 100644 --- a/plugin/sessionmanager.lua +++ b/plugin/sessionmanager.lua @@ -53,7 +53,7 @@ do -- read history from disk do - function project(entry) + function Project(entry) history[entry.path] = entry end -- tolerate missing history file @@ -65,7 +65,7 @@ do local function serialize() local str = "" for _, entry in pairs(history) do - str = str .. "project { path = \"" .. entry.path .. "\" }\n" + str = str .. "Project { path = \"" .. entry.path .. "\" }\n" end return str -- 2.39.5