nvim-telescope / telescope-z.nvim

Z integration for Telescope
37 stars 6 forks source link

Results are shown in stderr rather than stdout #12

Closed petobens closed 2 years ago

petobens commented 2 years ago

Since the z module is not in my PATH in order to run the z executable I do:

:lua require('telescope').extensions.z.list({cmd = {'bash', '-c', 'source /usr/share/z/z.sh && _z -l'}})

The output of this line, which gets the command output, is:

{}
1
{ "0.43876    /home/pedro/Desktop/asdad", "0.43876    /home/pedro/Desktop/bigdata-workshop-es", "0.43876    /home/pedro/Desktop/bigquery", "0.43876    /home/pedro/Desktop/fury_fda-python/commands", "0.43876    /h
ome/pedro/git-repos/forks/semshi/rplugin/python3/semshi", "0.43876    /home/pedro/git-repos/private/dotfiles/arch/config/rofi", "0.43876    /home/pedro/git-repos/private/dotfiles/nvim/cache/Arch/tmp/swap", "0.438
76    /home/pedro/git-repos/private/dotfiles/R", "0.43876    /home/pedro/git-repos/private/dotfiles/vim/bundle/repos/github.com/kristijanhusak/vim-dadbod_async-query", "0.43876    /home/pedro/git-repos/teaching/b
igdata-workshop-es/airflow", "0.43876    /home/pedro/git-repos/teaching/bigdata-workshop-es/code/docker/script", "0.43876    /home/pedro/git-repos/teaching/introduccion-ml-aplicado/ejercicios", "0.43876    /home/
pedro/git-repos/work/trafilea/ds-project-mbat/modules/mbat/bumblebee/data/store", "0.43876    /home/pedro/git-repos/work/trafilea/ds-project-mbat/modules/mbat/bumblebee/learn" }

which implies that the _z executable output is thrown into the stderr rather than the stdout as per https://github.com/nvim-telescope/telescope.nvim/blob/f262e7d56d37625613c5de0df5a933cccacf13c5/lua/telescope/utils.lua#L426 .

Any pointers about what's going on? Thanks in advance

delphinus commented 2 years ago

@petobens Sorry for a late response. You are using rupa/z? Then, _z() is an internal function, and it sends its output to stderr intentionally (See here). rupa/z defines z() for usual use.

:lua require('telescope').extensions.z.list({cmd = {'bash', '-c', 'source /usr/share/z/z.sh && z -l'}})

You can get expected results with commands above, I think.