Skip to content

Conversation

@michelesr
Copy link
Contributor

@michelesr michelesr commented May 1, 2018

Fix #51 #53

Using vim functions instead of external programs dramatically reduces the delay when opening files. Tested with neovim and vim.

In order to make it work with vim I had to add the _close_prev parameter (prefixed with underscore as unused), otherwise calling the function will cause the error too many arguments passed.

I appreciate your comments on #4 about the fact that anyone want a personal version, but this PR is just an improvement and is not changing the logic (at least for what I can see).

Please let me know your feedback.

asciicast

exec self.edit_cmd . system('head -n1 ' . s:choice_file_path)
call system('rm ' . s:choice_file_path)
for f in readfile(s:choice_file_path)
exec 'edit '. f
Copy link
Owner

Choose a reason for hiding this comment

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

please use the params self.edit_cmd instead of 'edit ' to keep the "open the file in a new tab" feature working

@francoiscabrol
Copy link
Owner

Thank you for your contribution! I will try locally

@michelesr
Copy link
Contributor Author

@francoiscabrol: I've updated the code to use self.edit_cmd in the nvim part (a:edit_cmd must be used for the vim part because we're not inside a dictionary based function so self is not available)

@francoiscabrol
Copy link
Owner

I found one weird thing: with your changes, if I try to open a folder with nvm . and then I open a file, the file is not open. Well it is open but also close right after.
If you remove

      if self.close_prev == 1
        exec "bp"
        exec "bd!"
      endif

that fix the issue.
These lines were added recently with #50 to fix an issue that does not exist anymore with your implementation.
So if you remove them, then your PR will be ready.

@francoiscabrol
Copy link
Owner

This PR should fix also the issue #53

@michelesr
Copy link
Contributor Author

I removed the parameter, now it should be all done.

@francoiscabrol
Copy link
Owner

awesome! I tried and everything looks good. Thank you!

@francoiscabrol francoiscabrol merged commit 3592427 into francoiscabrol:master May 3, 2018
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.

Small delay on file opening

2 participants