Skip to content

Instantly share code, notes, and snippets.

@zmack
Created June 18, 2018 07:19
Show Gist options
  • Save zmack/9b154fc581a00ff231ded48e8549b509 to your computer and use it in GitHub Desktop.
Save zmack/9b154fc581a00ff231ded48e8549b509 to your computer and use it in GitHub Desktop.
function RacerGoToDefinition()
let current_line = line(".")
let current_column = col(".")
let current_file = expand("%")
let command = g:racer_cmd." find-definition ".current_line." ".current_column." ".current_file
let definition = system(command)
let matches = split(split(definition, "\n")[0], ",")
if split(matches[0], " ")[0] != "MATCH"
return
endif
let file = matches[3]
let column = matches[2]
let line = matches[1]
execute ":e ".file
execute ":call cursor(".line.", ".column.")"
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment