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 works not so well with Recover.vim

See original GitHub issue

Problems summary

Run :call execute("Defx -auto-cd -search=".fnameescape(expand('%:p'))." ".expand("~")) when enable plugin https://github.com/chrisbra/recover.vim will get some unexpected results:

  1. defx shows in current window instead of a new split
  2. something happend let other autocmd not work

Expected

Fix listed results above, which means have same behavior as https://github.com/chrisbra/recover.vim disabled.

Environment Information

  • plugin version(SHA1): e1842ae
  • OS: Linux
  • neovim/Vim version: gvim 8.2.2815-1

Provide a minimal init.vim/vimrc with less than 50 lines (Required!)

let mapleader=" "

call plug#begin('~/.vim/plugged')
if has('nvim')
  Plug 'Shougo/defx.nvim', { 'do': ':UpdateRemotePlugins' }
else
  Plug 'Shougo/defx.nvim'
  Plug 'roxma/nvim-yarp'
  Plug 'roxma/vim-hug-neovim-rpc'
endif
Plug 'chrisbra/recover.vim'
Plug 'ntpeters/vim-better-whitespace'
call plug#end()

augroup vimrc_defx
  autocmd!
  autocmd VimEnter * call Setup_Defx()
augroup END

nnoremap <silent><leader>l :call execute("Defx -auto-cd -search=".fnameescape(expand('%:p'))." ".expand("~"))<CR>

function! Setup_Defx() abort
  silent! call defx#custom#option('_', {
        \ 'winwidth': 30,
        \ 'split': 'vertical',
        \ 'direction': 'topleft',
        \ 'show_ignored_files': 0,
        \ 'buffer_name': 'defxplorer',
        \ 'columns': 'indent:filename',
        \ 'toggle': 1,
        \ 'resume': 1,
        \ 'listed': 1,
        \ 'root_marker': '≡ '
        \ })
  silent! call defx#custom#column('filename', {
        \ 'max_width': 80,
        \ })
endfunction

let g:better_whitespace_enabled=1
let g:better_whitespace_filetypes_blacklist=['defx']

The reproduce ways from Vim starting (Required!)

Use Vim open a file A and then press <leader>l.

Compare results of press <leader>l in Normal mode between enable and disable https://github.com/chrisbra/recover.vim .

What we can find:

https://github.com/chrisbra/recover.vim enabled

  1. defx covers buffer of A
  2. the trailing spaces of defx are highlight by https://github.com/ntpeters/vim-better-whitespace, which means the autocmd set by https://github.com/ntpeters/vim-better-whitespace not run after open defx

https://github.com/chrisbra/recover.vim disabled

  1. defx opens in a new split
  2. the trailing spaces of defx not hightlight

Screen shot (if possible)

when enable Recover.vim:

image

when disable Recover.vim:

image

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:18 (17 by maintainers)

github_iconTop GitHub Comments

1reaction
chrisbracommented, May 18, 2021

I just pushed a fix, I think.

0reactions
roachsinaicommented, May 18, 2021

@Shougo Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Defx: file explorer plugin for Neovim : r/vim - Reddit
How well does it work in Vim (as this is r/vim not r/neovim)?. I see from the requirements that it requires you to...
Read more >
vim: search files under the current working directory with ...
I'm using defx as filer, and denite and ag to search files on Neovim. ... [coc.nvim] Definition provider not found for current document....
Read more >
Defx open file the buffer nothing to show · Issue #212 - GitHub
/usr/bin/python does not have the "neovim" module. ... Install Perl and cpanminus and verify that `perl` and `cpanm` commands work.
Read more >
recover - Vim documentation
You can recover most of your changes from the files that Vim uses to store the contents of the file. Mostly you can...
Read more >
repeatable vim recovery failure - Google Groups
issue: vim recovery will not work unless orphaned vim swap file extension begins with "sw". scenario: os crashes while gvim has a number...
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