wakatime / vim-wakatime

Vim plugin for automatic time tracking and metrics generated from your programming activity.
https://wakatime.com/vim
BSD 3-Clause "New" or "Revised" License
1.04k stars 70 forks source link

WakaTimeToday permission denied #131

Closed harryghgim closed 2 years ago

harryghgim commented 2 years ago

Hi. Thanks for the great vim plugin.

My issue is even if I registered my api key, my wakatime dashboard won't show the sign of vim as registered editor. I ran :WakaTimeApiKey and pasted my api key from dashboard, and also made sure that my ~/.wakatime.cfg has api_keyvalue in it.

I use wakatime with vscode and sublime text, and no such non-recognition issue happened with them.

And as a related issue I suspect, when I run :WakaTimeToday, I see this sign on the bottom:

Today: zsh:1: permission denied: /Users/gwanghyeongim/.wakatime/wakatime-cli

But when I run this file in shell, it seems at least I don't have permission error.

What do you think seems to be the reason of the problem?

For better reproduction of the issue my environments are as follow:

kidonng commented 2 years ago

Try setting the symlink yourself:

ln -s $(basename ~/.wakatime/*) ~/.wakatime/wakatime-cli

The symlink will be created automatically if you install the CLI via this plugin.

Or alternatively set g:wakatime_CLIPath.

alanhamlett commented 2 years ago

@harryghgim try adding debug = true to your ~/.wakatime.cfg file then start Vim and look for an error message at the bottom.

Every time vim-wakatime loads (on Vim startup) it runs this install script which should create the symlink. If it's failing there should be an error printed with debug = true.

harryghgim commented 2 years ago

@harryghgim try adding debug = true to your ~/.wakatime.cfg file then start Vim and look for an error message at the bottom.

Every time vim-wakatime loads (on Vim startup) it runs this install script which should create the symlink. If it's failing there should be an error printed with debug = true.

@alanhamlett After I set debug = true in cfg file, no earlier than I had set let g:wakatime_CLIPath='/Users/gwanghyeongim/.wakatime/wakatime-cli' in my vimrc, I see this error message. Maybe my path is wrong somehow?

Screen Shot 2022-02-22 at 12 43 38 AM

@kidonng I ran the command, and the result says

ln: /Users/gwanghyeongim/.wakatime/wakatime-cli/wakatime-cli: File exists

So I tried g:wakatime_CLIPath as above, it doesn't seem to help me much either.

I have a feeling that I've missed something too obvious to miss in the end...

alanhamlett commented 2 years ago

That error shown is: Error: sh: /Users/gwanghyeongim/.wakatime/wakatime-cli: is a directory

Try deleting your ~/.wakatime/ folder then re-launch Vim.

harryghgim commented 2 years ago

@alanhamlett Thank you so much. My issue is solved now and I'm closing it.

alanhamlett commented 2 years ago

Also, remember to turn off debug mode so your Vim performance won't be impacted:

:WakaTimeDebugDisable

alanhamlett commented 2 years ago

f922f82954cb68fccfd20ad3eacc78fb2559a937 should prevent this from happening in the future.

OGoodness commented 2 years ago

Having a similar issue, it's trying to run the folder instead of running the binary inside of the folder

alanhamlett commented 2 years ago

You're using the latest vim-wakatime? This change should remove the old directory, so maybe you're not on the latest? https://github.com/wakatime/vim-wakatime/blob/f922f82954cb68fccfd20ad3eacc78fb2559a937/scripts/install_cli.py#L190

If you're using the latest vim-wakatime, try deleting the ~/.wakatime/ folder then restart Vim.