Last active
July 1, 2022 13:12
-
-
Save 4513ECHO/dc5a7d899f5d4019a699ea9a8b47c9b5 to your computer and use it in GitHub Desktop.
sample function of kana/vim-gf-user
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! gf#vimrc#find() abort | |
let path = expand('<cfile>') | |
let [line, col] = [0, 0] | |
if path =~# '\v:\d+%(:\d+)?:?$' | |
let line = matchstr(path, '\v\d+\ze%(:\d+)?:?$') | |
let col = matchstr(path, '\v:\d+:\zs\d+\ze:?$') | |
let path = matchstr(path, '\v.{-}\ze:\d+%(:\d+)?:?$') | |
endif | |
if path =~# '^file://' | |
let path = substitute(path, '^file://', '', '') | |
endif | |
return { | |
\ 'path': path, | |
\ 'line': line, | |
\ 'col': empty(col) ? 0 : col, | |
\ } | |
endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment