question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

defx messes window layout

See original GitHub issue

Consider the following minimal init.vim

set nocompatible

let $DOTVIM = expand('$HOME/.config/nvim')

set runtimepath+=$DOTVIM/bundle/repos/github.com/Shougo/defx.nvim
filetype plugin indent on

call defx#custom#option('_', {
            \ 'winwidth': 40,
            \ 'split': 'vertical',
            \ 'direction': 'topleft',
            \ })

Now as in the GIF do the following

  1. Open nvim and edit some file, for example :e init.vim
  2. Run sp and then vsp
  3. Run :Defx
  4. Run :q on the defx buffer You can see in steps 3 and 4 that window layout is broken -> defx shouldn’t change the window layout

defxlayout

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
petobenscommented, Mar 12, 2019

This is indeed working with defx#do_action('quit') but not when opening files. Consider the following minimal vimrc:

set nocompatible

let $DOTVIM = expand('$HOME/.config/nvim')

set runtimepath+=$DOTVIM/bundle/repos/github.com/Shougo/defx.nvim
filetype plugin indent on

call defx#custom#option('_', {
            \ 'winwidth': 40,
            \ 'split': 'vertical',
            \ 'direction': 'topleft',
            \ })

augroup ps_defx
    au!
    au FileType defx call s:defx_settings()
augroup END

function! s:defx_settings()
    nnoremap <silent><buffer><expr> q defx#do_action('quit')
    nnoremap <silent><buffer><expr> <CR>
        \ defx#is_directory() ? defx#do_action('open') :
        \ defx#do_action('multi', ['drop', 'quit'])
endfunction

Now

  1. Open nvim and edit some file, for example :e init.vim
  2. Run :sp, move to the new split and run :vsp, move to this new split and run :sp again.
  3. From the last split window run :Defx
  4. Press <CR> on some candidate

After 4. the original window layout is broken (on the other hand if using q instead of <CR> then the layout is indeed preserved)

1reaction
petobenscommented, Mar 11, 2019

Thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Shougo/defx.nvim - Gitter
hello, there is a another question, i want using float window to show defx, and i config it like below, the float window's...
Read more >
visual studio 2010 - vs2010 window layout messed up
I tried Window > Reset Window Layout, but that didn't work. I even tried resetting the environment. How can I get back the...
Read more >
Hot Mess Mama PNG Image Leopard Pink Retro Design - Etsy Norway
Hot Mess Mama PNG Image, Leopard Pink Retro Design, Sublimation Designs Downloads, Transparent PNG File. WizdomStudio. Star Seller. Star Seller.
Read more >
PC Gamer, PC computer svg, Gaming Accessories, BUNDLE, SVG ...
Window Decals · Car Window · Cricut Creations · Silhouette Design · Free Silhouette Files · Silhouette Projects · i am not a...
Read more >
西安高端模特.dfx– green sprouts
Green Sprouts® provides healthy and natural baby products for baby's well-being and whole development, along with resources for natural parenting.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found