Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GHLineGetURL as a function so that users can program with it. #59

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,14 @@ let g:gh_cgit_url_pattern_sub = [
\ ]
```

### Use it in your vimscript

You can call the `GHLineGetURL` function in your own vimscript to customize it further. For example:
```
let url = GHLineGetURL('blob', 0)
" do something with url
```

## Debugging

For getting verbose prints from vim-gh-line plugin set.
Expand Down
7 changes: 6 additions & 1 deletion plugin/vim-gh-line.vim
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func! s:gh_exec_cmd(url)
call system(l:finalCmd)
endfun

func! s:gh_line(action, force_interactive) range
func! GHLineGetURL(action, force_interactive) range
" Get Line Number/s
let lineNum = line('.')
let fileName = resolve(expand('%:t'))
Expand Down Expand Up @@ -153,6 +153,11 @@ func! s:gh_line(action, force_interactive) range
\ 'one of the supported git hosting environments: ' .
\ 'GitHub, GitLab, BitBucket, SourceHut, Cgit.'
endif
return url
endfun

func! s:gh_line(action, force_interactive) range
let url = GHLineGetURL(a:action, a:force_interactive)
call s:gh_exec_cmd(url)
endfun

Expand Down