added leader v for split
parent
739460cc1a
commit
db1fa7dcd0
|
@ -61,3 +61,22 @@ keymap.set('n', '<leader>fs', '<Plug>(easymotion-overwin-f2)', { silent = true }
|
|||
|
||||
-- Telescope history
|
||||
keymap.set('n', '<leader>fh', '<cmd>Telescope file_history history<CR>', { silent = true })
|
||||
|
||||
-- Define a custom function to move the current buffer to a vertical split with the previous buffer
|
||||
function move_to_vertical_split()
|
||||
local current_buffer = vim.fn.bufnr('%') -- Get the current buffer number
|
||||
local last_buffer = vim.fn.bufnr('#') -- Get the previous buffer number
|
||||
|
||||
-- Check if last_buffer is set; if not, duplicate the current buffer
|
||||
if last_buffer == -1 then
|
||||
vim.cmd('vsplit')
|
||||
vim.cmd('b ' .. current_buffer)
|
||||
else
|
||||
vim.cmd('vsplit')
|
||||
vim.cmd('b ' .. last_buffer)
|
||||
vim.cmd('wincmd w') -- Switch focus to the original (current) buffer
|
||||
end
|
||||
end
|
||||
|
||||
-- Map <leader>v to the custom function
|
||||
keymap.set('n', '<leader>v', [[:lua move_to_vertical_split()<CR>]], { noremap = true, silent = true })
|
||||
|
|
Loading…
Reference in New Issue