Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[neovim] Fix lcd when fzf job exits on Windows #970

Merged
merged 1 commit into from
Jul 9, 2017

Conversation

janlazo
Copy link
Contributor

@janlazo janlazo commented Jul 9, 2017

#896 did not consider relative filepaths in the exit handler because dir /s/b outputs absolute paths. I changed dict and temp to be part of the fzf job config to minimize issues with the exit handler when running :FZF consecutively in Neovim.

@junegunn
Copy link
Owner

junegunn commented Jul 9, 2017

Thanks, can you post a scenario that reproduces the problem for future reference?

@janlazo
Copy link
Contributor Author

janlazo commented Jul 9, 2017

From #960 (with error redirection to powershell's /dev/null)
Requires #969 to not block Vim/Neovim

C:\Windows\System32>set FZF_DEFAULT_COMMAND=powershell.exe -NoLogo -NoProfile -Noninteractive -Command "Get-ChildItem -File -Recurse -Name 2> $null"
C:\Windows\System32>fzf
:: outputs a relative path

Compare with Vim/Neovim using the same minimal config. Vim changes the working directory but Neovim does not (without running lcd in the exit callback).

" assume fzf is installed in ~/.fzf
set rtp+=~/.fzf
runtime! plugin/fzf.vim
set noshellslash
FZF C:\Program\ Files\ (x86)\

call s:callback(s:dict, lines)
if s:present(self.dict, 'dir')
execute 'lcd' s:escape(self.dict.dir)
endif
Copy link
Owner

Choose a reason for hiding this comment

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

Can you check if we can use call s:pushd(self.dict) instead as in

fzf/plugin/fzf.vim

Lines 677 to 679 in 68bd410

call s:pushd(self.dict)
let lines = s:collect(self.temps)
call s:callback(self.dict, lines)
?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Didn't work. self.dict.prev_dir is set by the earlier s:pushd(a:dict)

Copy link
Owner

Choose a reason for hiding this comment

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

I see, thanks for the confirmation.

@junegunn junegunn merged commit 940214a into junegunn:master Jul 9, 2017
@junegunn
Copy link
Owner

junegunn commented Jul 9, 2017

Thanks!

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

Successfully merging this pull request may close these issues.

2 participants