/vim-wakatime

Vim plugin for automatic time tracking and metrics generated from your programming activity.

Primary LanguageVim ScriptBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

vim-wakatime

Vim Neovim MacVim gVim Coding time tracker

WakaTime is an open source Vim plugin for metrics, insights, and time tracking automatically generated from your programming activity.

Installation

  1. With Vundle: echo "Plugin 'wakatime/vim-wakatime'" >> ~/.vimrc && vim +PluginInstall

    Or with Pathogen: cd ~/.vim/bundle && git clone https://github.com/wakatime/vim-wakatime.git

    Or with Vim-plug: add Plug 'wakatime/vim-wakatime' to .vimrc file. While in vim reload .vimrc with :so ~/.vimrc or restart vim, enter :PlugInstall

    Or with Packer: add use 'wakatime/vim-wakatime' to your plugins file.

    Or with Vim 8+: mkdir -p ~/.vim/pack/plugins/start && cd ~/.vim/pack/plugins/start && git clone https://github.com/wakatime/vim-wakatime.git

    Or with Lazy.nvim: add to your plugins file.

    { 'wakatime/vim-wakatime', lazy = false }
  2. Restart Vim.

  3. If this is the first WakaTime plugin on your machine, type :WakaTimeApiKey inside Vim.

  4. Enter your API Key, then press enter.

  5. Use Vim and your coding activity will be displayed on your WakaTime dashboard.

Screen Shots

Project Overview

Commands

  • :WakaTimeApiKey - set or change the api key saved in your ~/.wakatime.cfg
  • :WakaTimeDebugEnable - enable debug mode (may slow down Vim so disable when finished debugging)
  • :WakaTimeDebugDisable - disable debug mode
  • :WakaTimeScreenRedrawEnable - enable screen redraw to prevent artifacts (only for Vim < 8.0)
  • :WakaTimeScreenRedrawEnableAuto - redraw screen when plugin takes too long (only for Vim < 8.0)
  • :WakaTimeScreenRedrawDisable - disable screen redraw
  • :WakaTimeToday - echo your total coding activity for Today

The vim-wakatime plugin automatically downloads and updates wakatime-cli in your $WAKATIME_HOME/.wakatime/ folder. WakaTime plugins also share a common $WAKATIME_HOME/.wakatime.cfg config file. $WAKATIME_HOME defaults to your $HOME folder.

Troubleshooting

Run :WakaTimeDebugEnable in Vim then run this Terminal command:

tail -f ~/.wakatime/wakatime.log

Enabling Debug Mode writes Vim Script errors to your Vim Status Bar and tells wakatime-cli to write verbose logs to $WAKATIME_HOME/.wakatime/wakatime.log.

Debug mode can make it hard to find the real error because of all the extra logging, so also try disabling Debug Mode while tailing ~/.wakatime/wakatime.log and editing files in Vim. With Debug Mode enabled, the plugin sends data synchronously so disable it when finished debugging with :WakaTimeDebugDisable.

The How to Debug Plugins guide shows how to check when coding activity was last received from Vim use the User Agents API. For more general troubleshooting info, see the wakatime-cli Troubleshooting Section.

Uninstalling

  1. Remove Plugin 'wakatime/vim-wakatime' from your .vimrc file.

  2. Run in terminal: rm ~/.wakatime.*.

  3. Run in terminal: vim +PluginClean.

If using vim-plug

While in vim

  1. Delete or comment out Plug command from .vimrc file.

  2. Reload vimrc (:so ~/.vimrc) or restart vim

  3. Run :PlugClean, it will detect and remove undeclared plugins.