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.

directory name is disordered when move the directory

See original GitHub issue

Problems summary

When move directory and Defx buffer is updated, “/” remains and directory name become disodered if previous directory name is longer than next one.

Environment Information

  • plugin version(SHA1): up-to-date (i’m not sure SHA1)

  • OS: WSL 20.04 LTS

  • neovim/Vim version: NVIM v0.5.0-dev+1053-g459a6c845

  • :checkhealth or :CheckHealth result(neovim only):

health#defx#check
========================================================================
## defx.nvim
  - OK: has("python3") was successful
  - OK: Python 3.6.1+ was successful

Provide a minimal init.vim/vimrc

[[plugins]]
repo = 'Shougo/defx.nvim'
hook_add = '''

  call defx#custom#option('_', {
  \ 'winwidth': 40,
  \ 'split': 'vertical',
  \ 'direction': 'topleft',
  \ 'show_ignored_files': 1,
  \ 'buffer_name': 'exproler',
  \ 'toggle': 1,
  \ 'resume': 1,
  \ 'columns': 'indent:icons:filename:mark',
  \ })

  nnoremap <silent>fs :<C-u>Defx -auto-cd -vertical-preview -floating-preview<CR>

  autocmd FileType defx call s:defx_my_settings()
  function! s:defx_my_settings() abort
    " Define mappings
    nnoremap <silent><buffer><expr> <CR>
      \ defx#is_directory() ?
      \ defx#do_action('open') :
      \ defx#do_action('multi', ['drop', 'quit'])

    nnoremap <silent><buffer><expr> h
      \ defx#do_action('cd', ['..'])

    nnoremap <silent><buffer><expr> j
      \ line('.') == line('$') ? 'gg' : 'j'

    nnoremap <silent><buffer><expr> k
      \ line('.') == 1 ? 'G' : 'k'

    nnoremap <silent><buffer><expr> l
      \ defx#do_action('open')

  endfunction

'''

The reproduce ways from neovim

Let’s use files in this repository for example.

  1. Clone this repository in local environment.
  2. Move to the directory and launch neovim. And open Defx buffer. (‘fs’ in my env)
  3. Move to .git directory by defx#do_action(‘open’). (‘i’ in my env)
  4. I can see the style is disordered. “/” remains and the position that directory name starts is inconsistent.

Screen shot

initial state

messageImage_1616556318573

when move to .git directory messageImage_1616556656424

what I tried

I tried to use defx-action-multi to hook defx#redraw() function. However, problem was not solved.

nnoremap <silent><buffer><expr> h defx#do_action('multi', ['cd', '..', 'redraw'])   

And I also tried to use autocmd to hook “User DefxDirChanged” event and <C-l> redraw command. But this trial end up to fail with my tiny vimscript power…

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
matsui54commented, Mar 24, 2021

I could reproduce the same problem in WSL’s default console. However, when this problem occurs, the whole Neovim’s drawing system is broken. If @yut19 has the same problem, this is not defx’s problem, but WSL console’s one. It seems that WSL’s default console is incompatible with Vim. I recommend using windows terminal.

1reaction
pqppqcommented, Mar 24, 2021

@Shougo @matsui54 I’m sorry for my inadequate report and thank you for your quick response. I understand the cause of problem. I’ll use Windows Terminal instead.

Read more comments on GitHub >

github_iconTop Results From Across the Web

“The Directory Name is Invalid” Error and How To Fix It
Common Causes of “The Directory Name Is Invalid” Error ; Improper device removal ; Malware attack ; Incorrect permissions ; Bad sectors ...
Read more >
Fix 'The Directory Name is Invalid' Error in Windows 10
Summary: This blog explains the causes of the 'The Directory Name is Invalid' error in Windows 10 and methods to fix it.
Read more >
"The directory name is invalid" error message when you start ...
The command prompt program or Notepad logs an error that states that the %HOMEDRIVE%%HOMEPATH% path is not valid for the session. This scenario...
Read more >
Fixing Your Disorganized REAPER Projects - YouTube
Following up on the Essential File Management video which covers preventing issues, this video will cover how to get your existing project ...
Read more >
How to sort files in some directory by the names on Linux
I use opendir() and readdir() to display the file names in a directory. But they are disordered. How can I sort them? The...
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