justinmk / vim-dirvish

Directory viewer for Vim :zap:
Other
1.19k stars 64 forks source link

Fixes 'tree view' mapping suggestion in doc to not change file order, and not overwrite " register #241

Closed yogeshdhamija closed 11 months ago

yogeshdhamija commented 1 year ago

Not to suggest that maintaining a hacky workaround is the best use of anyone's time, but might as well have a correct hacky workaround ¯\ (ツ)/¯.

This PR is in regard to the t remap suggested in the docs, which allows subdirectories to be included in the file listing (making it sort of a tree-style view).

This PR has two commits, the first change prevents the file order from being messed with. The second saves your " register so that it's not overwritten.

Before:

before behaviour

After:

after behaviour
justinmk commented 11 months ago

this seems to work without using a register:

nnoremap <buffer> t o<Esc>:r !find '<C-R>=substitute(getline(line(".")-1),"\\n","","g")<CR>' -maxdepth 1 -print0 \| xargs -0 ls -Fd<CR>:silent! keeppatterns %s/\/\//\//g<CR>:silent! keeppatterns %s/[^a-zA-Z0-9\/]$//g<CR>:silent! keeppatterns g/^$/d _<CR>"_dd