vim.keymap.set('n', "-", "Oil --float", { desc ="Enter file explorer (Oil)" }) vim.keymap.set('n', "w", "w", { desc = "Save" } ) vim.keymap.set('n', "w", "w", { desc = "Save" } ) vim.keymap.set('n', "q", "q", { desc = "Quit without saving" } ) vim.keymap.set('n', "q", "q", { desc = "Quit without saving" } ) vim.keymap.set('n', "wq", "wq", { desc = "Save and quit" } ) vim.keymap.set('n', "qq", "q!", { desc = "Force to quit without saving" } ) -- todo: this is not robust... add autocompletion and verify that file exists vim.keymap.set("n", "e", function() local file_name = vim.fn.input("Open file: ") if file_name ~= "" then vim.cmd(":edit " .. file_name) end end, { desc = "edit a file"}) vim.keymap.set("n","ls", "ls", { desc = "list buffers" }) vim.keymap.set("n","f", "bnext", { desc = "goto next buffers" }) vim.keymap.set("n","d", "bprevious", { desc = "goto previous buffers" }) vim.keymap.set("n","c", "bd", { desc = "close buffers" }) vim.keymap.set("n", "h", function() local config_path = vim.fn.stdpath('config') local readme_path = config_path .. '/CHEATSHEET.md' local buf = vim.fn.bufadd(readme_path) vim.fn.bufload(buf) local win = vim.api.nvim_open_win(buf, true, { relative = 'editor', width = 80, height = 20, col = (vim.o.columns - 80) / 2, row = (vim.o.lines - 100) / 2, style = 'minimal' }) vim.api.nvim_win_set_option(win, 'number', false) end, { desc = "Open CHEATSHEET.md"}) vim.keymap.set("n", "hr", function() local config_path = vim.fn.stdpath('config') local readme_path = config_path .. '/README.md' local buf = vim.fn.bufadd(readme_path) vim.fn.bufload(buf) local win = vim.api.nvim_open_win(buf, true, { relative = 'editor', width = 80, height = 20, col = (vim.o.columns - 80) / 2, row = (vim.o.lines - 100) / 2, style = 'minimal' }) vim.api.nvim_win_set_option(win, 'number', false) end, { desc = "Open CHEATSHEET.md"})