git-time-metric / gtm

Simple, seamless, lightweight time tracking for Git
MIT License
979 stars 52 forks source link

gtm appears to not work in a Cygwin environment #117

Open dvklopfenstein opened 11 months ago

dvklopfenstein commented 11 months ago

Thank you so much for creating gtm and the vim plugin. GTM looks like it will be extremely useful and I would very much like to use it, but am having difficulties -- I see no .gtm/*.event files and no time tracking appears to be happening.

Hypothesis

Google's GO language does not properly handle directory and filenames in Cygwin and so gtm does not work in a Cygwin environment.

Request

Please add support for using gtm in a Cygwin environment (Linux-like feel while running native Windows)

Details

This is everything I tried before having the thought to try it in Linux --which worked: finally seeing ./.gtm/*.event files.

Sigh. I would so like to use gtm in both Linux and Cygwin.

I have used vim for a while, but this is my first plugin. Pathogen recommends: For new users, I recommend using Vim's built-in package management instead. :help packages

$ gtm status

$ gtm --version
v1.3.5

$ find .gtm
.gtm
.gtm/terminal.app

$ vim --version
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Jul  7 2023 23:06:09)
Included patches: 1-4372
Modified by <cygwin@cygwin.com>
Compiled by <cygwin@cygwin.com>

To load the gtm plugin, I did:

$ git clone https://github.com/git-time-metric/gtm-vim-plugin.git ~/.vim/pack/gtm/start/gtm
$ find ~/.vim/pack/gtm/start/gtm/plugin/
/home/dvklo/.vim/pack/gtm/start/gtm/plugin/
/home/dvklo/.vim/pack/gtm/start/gtm/plugin/gtm.vim

In my .vimrc file, I set: let g:gtm_plugin_status_enabled = 1

Then I edited a file in my repo:

$ vim -V9vim.log README.md

In vim, I do:

:set runtimepath?
~/.vim,~/.vim/pack/gtm/start/gtm,/usr/share/vim/vimfiles,/usr/share/vim/vim82,/usr/share/vim/vimfiles/after,~/.vim/after

:set packpath
packpath=~/.vim,/usr/share/vim/vimfiles,/usr/share/vim/vim82,/usr/share/vim/vimfiles/after,~/.vim/after

:scriptnames
  1: /etc/vimrc
  2: /usr/share/vim/vim82/syntax/syntax.vim
  3: /usr/share/vim/vim82/syntax/synload.vim
  4: /usr/share/vim/vim82/syntax/syncolor.vim
  5: /usr/share/vim/vim82/colors/lists/default.vim
  6: /usr/share/vim/vim82/filetype.vim
  7: /usr/share/vim/vim82/scripts.vim
  8: /usr/share/vim/vim82/autoload/dist/script.vim
  9: /usr/share/vim/vim82/ftplugin.vim
 10: ~/.vimrc
 11: /usr/share/vim/vim82/syntax/nosyntax.vim
 12: /usr/share/vim/vim82/plugin/getscriptPlugin.vim
 13: /usr/share/vim/vim82/plugin/gzip.vim
 14: /usr/share/vim/vim82/plugin/logiPat.vim
 15: /usr/share/vim/vim82/plugin/manpager.vim
 16: /usr/share/vim/vim82/plugin/matchparen.vim
 17: /usr/share/vim/vim82/plugin/netrwPlugin.vim
 18: /usr/share/vim/vim82/plugin/rrhelper.vim
 19: /usr/share/vim/vim82/plugin/spellfile.vim
 20: /usr/share/vim/vim82/plugin/tarPlugin.vim
 21: /usr/share/vim/vim82/plugin/tohtml.vim
 22: /usr/share/vim/vim82/plugin/vimballPlugin.vim
 23: /usr/share/vim/vim82/plugin/zipPlugin.vim
 24: ~/.vim/pack/gtm/start/gtm/plugin/gtm.vim
 25: /usr/share/vim/vim82/ftplugin/conf.vim
 26: /usr/share/vim/vim82/syntax/conf.vim

My vim.log file created with the -V9vim.log vim argument shows some activity with gtm:

chdir(/home/dvklo/.vim/pack/gtm/start)
fchdir() to previous dir
chdir(/home/dvklo/.vim/pack/gtm/start/gtm/plugin)
fchdir() to previous dir
sourcing "/home/dvklo/.vim/pack/gtm/start/gtm/plugin/gtm.vim"
finished sourcing /home/dvklo/.vim/pack/gtm/start/gtm/plugin/gtm.vim

I see calls to s:record():

Executing BufRead Autocommands for "*"
autocommand silent call s:record()

Calling shell to execute: "(gtm record --status '/cygdrive/c/Users/dvklo/Data/git/mednotes/README.md')>/tmp/vqLKKmp/0 2>&1"
Executing BufEnter Autocommands for "*"
autocommand sil call s:LocalBrowse(expand("<amatch>"))

Executing VimEnter Autocommands for "*"
autocommand sil call s:VimEnter(expand("<amatch>"))

Executing CursorMoved Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()

Executing CursorMoved Autocommands for "*"
autocommand silent call s:record()