Skip to content

Conversation

@gw31415
Copy link
Contributor

@gw31415 gw31415 commented Sep 2, 2023

Thank you for the wonderful plugin.

The current implementation uses fern#util#expand in s:expand even on the first BufEnter.
This causes it to load even on the first startup even if it is not necessary to load fern.vim, for example when opening a file (not a directory).

This PR changes s:expand to use the built-in expand() function without checking when fern.vim is not loaded.
This enables for lazy loading of fern.vim, which should improve startup speed.

Thanks.

@gw31415 gw31415 changed the title Use built-in expand() without fern.vim only for the first hijack Use built-in expand() without check when fern.vim is not loaded. Sep 2, 2023
Copy link
Owner

@lambdalisue lambdalisue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Well, then let's check the presence of fern#util#expand itself instead and describe the reason as a function comment (outside of the function) like

" explain why we check the presence of `fern#util#expand` which usually shoud not
function! s:expand(expr) abort
  if exists('fern#util#expand')
    return fern#util#expand(a:expr)
  endif
  return expand(a:expr)
endfunction

@gw31415
Copy link
Contributor Author

gw31415 commented Sep 7, 2023

Thanks for the advice on better changes. I've made the changes.

@lambdalisue lambdalisue merged commit f655248 into lambdalisue:master Sep 11, 2023
@gw31415
Copy link
Contributor Author

gw31415 commented Sep 12, 2023

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants