Skip to content

git-time-metric/gtm-vim-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 

Repository files navigation

GTM Logo
Git Time Metric

Vim Git Time Metrics (GTM) plug-in

Simple, seamless, lightweight time tracking for all your git projects

Git Time Metrics (GTM) is a tool to automatically track time spent reading and working on code that you store in a Git repository. By installing GTM and using supported plug-ins for your favorite editors, you can immediately realize better insight into how you are spending your time and on what files.

Installation

Installing GTM is a two step process. First, it's recommended you install the GTM executable that the plug-in integrates with and then install the Vim GTM plug-in. Please submit an issue if you have any problems and/or questions.

  1. Follow the Getting Started section to install the GTM executable for your operating system.
  2. The easy way to install the plug-in is to use your favorite Vim plug-in manager.
    • Plug Plug 'git-time-metric/gtm-vim-plugin'
    • NeoBundle NeoBundle 'git-time-metric/gtm-vim-plugin'
    • Vundle Plugin 'git-time-metric/gtm-vim-plugin'
    • Pathogen git clone https://github.com/git-time-metric/gtm-vim-plugin.git ~/.vim/bundle/gtm

Note - to enable time tracking for a Git repository, you need to initialize it with gtm init otherwise it will be ignored by GTM. This is done via the command line.

> cd /path/to/your/project
> gtm init

Consult the README and Wiki for more information.

Features

Status Bar

In the status bar see your total time spent for in-process work (uncommitted).

By default this feature is off, to enable set g:gtm_plugin_status_enabled in your .vimrc.

let g:gtm_plugin_status_enabled = 1

Here's an example of diplaying time spent within Vim's status line.

set statusline=%{exists('*GTMStatusline')?'['.GTMStatusline().']':''}\ %<%f\ %h%m%r%=%-14.(%l,%c%V%)\ %P

If you have the Vim Airline plug-in loaded, here's an example for adding it to the status line.

function! AirlineInit()
  if exists('*GTMStatusline')
    call airline#parts#define_function('gtmstatus', 'GTMStatusline')
    let g:airline_section_b = airline#section#create([g:airline_section_b, ' ', '[', 'gtmstatus', ']'])
  endif
endfunction
autocmd User AirlineAfterInit call AirlineInit()

Note - the time shown is based on the file's path and the Git repository it belongs to. You can have several files open that belong to different Git repositories. The status bar will display the time for the current file's Git repository. Also keep in mind, a Git repository must be initialized for time tracking in order to track time.

Command Line Interface

Use the command line to report on time logged for your commits.

Here are some examples of insights GTM can provide you.

$ gtm report -last-month
$ gtm report -last-month -format summary
$ gtm report -last-month -format timeline-hours

GTM is automatic, seamless and lightweight. There is no need to remember to start and stop timers. It runs on occasion to capture activity triggered by your editor. The time metrics are stored locally with the git repository as [Git notes](https://git-scm.com/docs/git-notes) and can be pushed to the remote repository.

Support

To report a bug, please submit an issue on the GitHub Page

Consult the README and Wiki for more information.

About

Plugin for the Vim editor to be used with the Git Time Metric platform.

Resources

License

Stars

Watchers

Forks

Packages

No packages published