lambdalisue / vim-gita

[Obsolete] An awesome git handling plugin for Vim
Other
226 stars 8 forks source link

Gita browse behavior improvments #142

Closed ahmedelgabri closed 7 years ago

ahmedelgabri commented 7 years ago

Currently if you trigger :Gita browse in normal mode while the cursor for example is on L34, it will open the file on github on line 34 which most probably not the behavior needed because if I want a specific line or range I will highlight them in visual mode & call :Gita browse.

So I guess it will be better if you just open the file in normal mode while you highlight the lines in visual mode, similar to fugitive behavior.

Also another improvement can be that the URL use Github permanent links instead of the normal ones https://help.github.com/articles/getting-permanent-links-to-files/, this way links will always work.

lambdalisue commented 7 years ago

I like the first idea. I'll implement that thanks 👍

Also another improvement can be that the URL use Github permanent links instead of the normal ones https://help.github.com/articles/getting-permanent-links-to-files/, this way links will always work.

Use --scheme=exact instead.

ahmedelgabri commented 7 years ago

Use --scheme=exact instead.

Thanks, didn't know about that one 👍

lambdalisue commented 7 years ago

I checked the current implementation and found that it is nearly impossible with the current implementation so I decided to NOT implement that. Sorry for the inconvenience.

Note

  1. mode() always return n in command so it cannot be used to find if the command was called from visual mode
  2. -range=% return an entire range in default so it can be used if the command was called from visual selection by options.__range__ == [1, line('$')]
  3. Gita show should respect the selected line but Gita browse so using -range=% would break the current behavior of Gita show
ahmedelgabri commented 7 years ago

No worries, It's a bit little annoyance but not a deal breaker. Also I wonder how fugitive is doing it though?

lambdalisue commented 7 years ago

Also I wonder how fugitive is doing it though?

I don't know but fugitive use a different command like Gbrowse and Greae so it would use -range=% to check it I guess.