code_runner.nvim icon indicating copy to clipboard operation
code_runner.nvim copied to clipboard

[feat request] when open nvim-tree, set the window to the right of nvim-tree

Open shellRaining opened this issue 1 year ago • 2 comments

image

as the img shown, the result window is under nvim-tree, and when I close the result window, it will auto focus on the nvim-tree, I wish it can re-focus on my code window

thanks a lot if you can impl this~😊

shellRaining avatar Jul 15 '23 07:07 shellRaining

It is not difficult to do, however this is delegated to neovim, neovim decides which window to focus on, in any case I am open to any pr

CRAG666 avatar Jul 20 '23 17:07 CRAG666

I got the same problem, so i made this for getting back to the code window..

`function Switch() local tree_win = vim.fn.win_findbuf(vim.api.nvim_get_current_buf())

if #tree_win == 0 then -- NvimTree is not open, press <C-w>w once vim.cmd('wincmd w') else -- NvimTree is open, press <C-w>w twice vim.cmd('wincmd w') vim.cmd('wincmd w') end

end

vim.api.nvim_set_keymap('n', '<F9>', ':w<CR>:RunFile<CR>:lua Switch()<CR>', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', '.', ':RunClose<CR>', { noremap = true, silent = false }) vim.api.nvim_set_keymap('i', '<F9>', '<Esc>:w<CR>:RunFile<CR>:lua Switch()<CR>', { noremap = true, silent = false })

` I use nvchad , so i add this in my init.lua file.. you can make the changes add this code to the equivalent of your vim or nvim config..

Thanks.

reactVishnu avatar Mar 31 '24 10:03 reactVishnu