Skip to content

Directory size #194

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

Closed
tambourine-man opened this issue Sep 6, 2020 · 11 comments
Closed

Directory size #194

tambourine-man opened this issue Sep 6, 2020 · 11 comments
Labels

Comments

@tambourine-man
Copy link

Hi, I couldn't figure this out

K Shows file info. [count] shows directory size.

Hitting K over a file shows its size. When over a directory it shows “0.00K”.

Trying 1K (what I understand from [count] K) displays this error:

Error detected while processing function 27_info:
line 5:
E730: using List as a String
E484: Can't open file /var/folders/t3/n79wv4td5gd2z1by299ll1pc0000gn/T/vPtth4v/0

@justinmk
Copy link
Owner

justinmk commented Sep 6, 2020

1K should work. Just tried it and it works for me on macOS, which it looks like you're using...

Looks like vim can't open temp files on your system...? That leads to weird problems, Vim uses temp files to run shell commands (weird but true).

@tambourine-man
Copy link
Author

Weird. I opened Vim as root, similar issue.

Error detected while processing function <SNR>23_info: line 5: E730: using List as a String E484: Can't open file /tmp/vZaFE3I/0

Yes, I'm running a Mac, Mojave 10.14.6.
Nothing special about my installation as far I as I know:

vim --version VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Aug 15 2020 20:27:49) macOS version

/usr/bin/vim --version VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jun 19 2019 19:08:44) Included patches: 1-503, 505-680, 682-1283, 1365 Compiled by [email protected]

I even tried with a barebones vimrc, with only set nocompatible.

@justinmk
Copy link
Owner

justinmk commented Sep 7, 2020

Isn't necessarily a permissions issue. You need to figure out why Vim can't open temp files it created using the Vimscript tempname() function.

@tambourine-man
Copy link
Author

This works:

let tmpFile = tempname()
exe "w " . tmpFile
exe "e " . tmpFile

@justinmk
Copy link
Owner

justinmk commented Sep 7, 2020

Does the Dirvish issue go away if you (do this at the top of your vimrc, before Dirvish loads):

:set noshelltemp

@tambourine-man
Copy link
Author

tambourine-man commented Sep 7, 2020

Nope :(
But I'm using Vim's own package manager (the pack/*/start directory), so I'm not sure it's actually running before Dirvish

@justinmk
Copy link
Owner

justinmk commented Sep 7, 2020

Oh, that's because in Vim system() does not respect 'shelltemp' (see :help 'shelltemp'). Nice.

Can you confirm this is failing (replace /path/to/dir/ with the directory path that you want to inspect):

:echo system(['du','-hs', '/path/to/file/'])

Then try this:

:echo system('du -hs /path/to/file/')

Actually I think this is a Dirvish bug because Vim doesn't support the list form. The tempfile error was a red herring.

@justinmk justinmk reopened this Sep 7, 2020
@tambourine-man
Copy link
Author

I think you nailed it.
This fails
:echo system(['du','-hs', '~/Desktop'])
This works
:echo system('du -hs ~/Desktop')

@justinmk justinmk added bug and removed question labels Sep 7, 2020
@tambourine-man
Copy link
Author

Thanks a lot.
I should probably switch to nvim, but I still like the idea of being able to run my editor anywhere.

@justinmk
Copy link
Owner

justinmk commented Sep 7, 2020

Use whatever you like, but that trope always gets me so I must respond :) If you use vim 9 or 8.2 then that also is not "everywhere". Some systems have e.g. vim 7.x, and going back to vim 7.x from nvim is analogous to going from vim 8.x. This applies to any new version of vim.

BSDs don't ship with vim at all.

@tambourine-man
Copy link
Author

I think Ubuntu 20 comes with 8.1, which is pretty recent, but it's a fair point.

Most of my .vimrc checks for feature support, so I'm used to the vim experience being on a spectrum while remaining mostly consistent, from 7.4 to 8.2, full MacVim.app to Terminal.app, “graceful degradation” style. But I guess this could be accomplished with nvim as well. I tend to prefer stock stuff whenever possible, it's usually simpler, but the thought of writing Lua instead of Vimscript is tantalizing.

Anyway, thanks again :)

chiefjester pushed a commit to chiefjester/vim-dirvish that referenced this issue Sep 9, 2020
The list form of system([...]) only works in Nvim.

fix justinmk#194
chiefjester pushed a commit to chiefjester/vim-dirvish that referenced this issue Sep 25, 2020
The list form of system([...]) only works in Nvim.

fix justinmk#194
chiefjester pushed a commit to chiefjester/vim-dirvish that referenced this issue Sep 25, 2020
The list form of system([...]) only works in Nvim.

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

No branches or pull requests

2 participants