How to auto open files when browsing explorer? #1903
-
I'd like files to open automatically in the right buffer when I move to them using jk in the Explorer. |
Beta Was this translation helpful? Give feedback.
Answered by
drowning-cat
May 22, 2025
Replies: 1 comment 2 replies
-
ActionsOpen new buffer on opts = {
picker = {
sources = {
explorer = {
win = {
list = {
keys = {
['j'] = { { 'list_down', 'jump', 'focus_list' } },
['k'] = { { 'list_up', 'jump', 'focus_list' } }, Replace the main window's buffer on opts = {
picker = {
sources = {
explorer = {
actions = {
replace_main = function(picker, item)
if not item.dir and picker.main then
local buf = vim.api.nvim_win_get_buf(picker.main)
vim.bo[buf].buflisted = false
picker:action 'jump'
end
end,
},
win = {
list = {
keys = {
['j'] = { { 'list_down', 'replace_main', 'focus_list' } },
['k'] = { { 'list_up', 'replace_main', 'focus_list' } }, Preview
|
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
gestate-8
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Actions
Open new buffer on
list_down/list_up
:Replace the main window's buffer on
list_down/list_up
: