Created
February 22, 2025 15:35
-
-
Save pachun/0e18a6703d68bc4bc10c4598a0183e93 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Vim split hotkeys | |
vim.keymap.set("n", "<leader>d|", "<C-w>v", { desc = "Split window vertically" }) | |
vim.keymap.set("n", "<leader>d_", "<C-w>s", { desc = "Split window horizontally" }) | |
-- <leader>+ toggles maximizing the current pane, like tmux | |
_G.toggle_session = function() | |
local session_file = "/tmp/vim_session_" .. vim.fn.getpid() .. ".vim" | |
if vim.fn.filereadable(session_file) == 1 then | |
vim.cmd("silent! source " .. session_file) | |
vim.fn.delete(session_file) | |
else | |
vim.cmd("mks! " .. session_file) | |
vim.cmd("wincmd o") -- Maximize current pane (Ctrl-w o) | |
end | |
end | |
vim.api.nvim_set_keymap("n", "<leader>d+", ":lua _G.toggle_session()<CR>", { noremap = true, silent = true }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment