ramccor / vcscommand

Automatically exported from code.google.com/p/vcscommand
0 stars 0 forks source link

Feature-Request: VCSStatusString #65

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
This is feature request. I like VCSCommand, actually it is the best one of its 
type which is around on the net. Still it lacks one simple feature that other 
vim-VCS integration plugins have: Functions which can be used to display the 
state of the current file in the statusline. This might be, whether the current 
file was changed or at which revision or branch it currently is.

The simplest of these is a function which returns the VCS status (Modified, 
Added, ...) of the file as a string. This could then be integrated into the 
command line as '%{VCSStatusString()}' giving a neat overview of the file 
status. I looked into the source, but my vim scripting skills are not 
sufficient to get this done.

Original issue reported on code.google.com by t.kel...@freenet.de on 23 Sep 2010 at 4:07

GoogleCodeExporter commented 9 years ago
Okay, I figured out that there are facilities for getting the revision numbers 
and the current branch into the status bar. Still it would be perfect if there 
would also be a variable, say VCSCommandBufferStatus, which reflects the 
modification status of the current buffer's file.

Btw thanks alot for this great plugin! :-)

Original comment by t.kel...@freenet.de on 23 Sep 2010 at 7:56

GoogleCodeExporter commented 9 years ago
If you enable the buffer status information, using:

let VCSCommandEnableBufferStatus=1

...you can use the VCSCommandGetStatusLine() function to pull the information 
you want.  I think the function is as useful is a variable, but could be 
persuaded to add a variable if there is a use case where it works better.

Original comment by bob.hies...@gmail.com on 4 Oct 2010 at 3:01

GoogleCodeExporter commented 9 years ago

Original comment by bob.hies...@gmail.com on 4 Oct 2010 at 3:01

GoogleCodeExporter commented 9 years ago
I'm already using the 'VCSCommandGetStatusLine()' function to display e.g. the 
CVS revision of the current file and the git branch etc. My request is about a 
new variable that indicates whether the current buffer has uncommitted changes. 
Currently this information is not contained in the VCSCommandBufferInfo list.

Original comment by t.kel...@freenet.de on 4 Oct 2010 at 3:27

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I extended the VCSCommand script such that the functionality that I needed is 
given for the "CVS" and "git" plugins. I also provided an example status line 
string function that shows the applicaiton.

The main purpose is, that you can see, when you start editing a file with vim, 
whether the file has uncommitted changes. In that case you might want to commit 
first, before proceeding. Additionally, you can now see whether the file was 
locally added / moved or whether it is not versioned at all. The information is 
structured, that means it has the same format for all VCS plugins. I found this 
to be the greatest drawback of the current approach where each plugin returns 
whatever it finds useful in 'b:VCSCommandBufferInfo'.

Original comment by t.kel...@freenet.de on 6 Oct 2010 at 7:33

Attachments:

GoogleCodeExporter commented 9 years ago
This is a new version which included SVN support. I will not add the remaining 
VCSs, because I do not use them at all. For someone who is familiar with them, 
and who has the templates from this tar file, this should be easy to do.

Original comment by t.kel...@freenet.de on 7 Oct 2010 at 3:34

Attachments:

GoogleCodeExporter commented 9 years ago
I've created a repository for vcscommand on github and merged these changes 
into the 'statusline' branch if you want to look at that.  It's 
http://github.com/harleypig/vcscommand.git Hopefully it makes it easier to 
implement this, or a similar change.

Original comment by alansyou...@gmail.com on 6 Nov 2010 at 12:19

GoogleCodeExporter commented 9 years ago
Thanks, I'll take a look.  However, I previously had such functionality and 
ended up removing it due to clunkiness in supporting all the VCS in a seamless 
fashion.

Original comment by bob.hies...@gmail.com on 10 Nov 2010 at 2:13

GoogleCodeExporter commented 9 years ago
I think to make it less clunky one should allow different types of output for 
different versioning systems. At the moment I integrated the following status 
values:

'+' for 'locally modified'
'A' for 'locally added'
'R' for 'locally removed'
'M' for 'locally renamed/moved'
'U' for 'not versioned/unknown'
'P' for 'needs patch/outdated'
'I' for 'ignored'
'C' for 'conflicted'
''  for 'up-to-date'

Most useful are '+', 'U', 'A' and ''. The other flags may be generated by some 
versioning systems only, e.g. git will never generate a 'P' flag and cvs will 
never generate a 'M' flag. I think this is okay. The status flag should only 
mirror the underlying VCSs file status. It should not be required that the 
status flags are coherent for all VCSs. For example with git it is hard to see 
that a file is ignored. Therefore my current implementation does not generate 
'I' flags for git. Perhaps one could agree on a minimum set of flags which are 
always correctly generated, like '+', 'A' and ''. All the other flags are 
generated only, if the respective plugin specifies that.

Original comment by t.kel...@freenet.de on 10 Nov 2010 at 9:23

GoogleCodeExporter commented 9 years ago
Just noticed my link is wrong.  It's https://github.com/harleypig/vcscommand.vim

Also, I added the option to allow users to change the flag if they so desired.

Original comment by alansyou...@gmail.com on 10 Nov 2010 at 6:33