Skip to content

Instantly share code, notes, and snippets.

@xebecnan
Created May 25, 2023 02:25
Show Gist options
  • Save xebecnan/6f7e2615c05f080c85f4cf020ee00363 to your computer and use it in GitHub Desktop.
Save xebecnan/6f7e2615c05f080c85f4cf020ee00363 to your computer and use it in GitHub Desktop.
" Lua 跳转到函数定义 {
fun! GotoLuaFuncDifinition()
let w = expand("<cword>")
exec "Rg \\b" . l:w . "\\b"
exec "norm! gg"
let rr = search("| function\\>", 'c')
if !rr
exec "cclose"
echo "search FAILED for " . l:w
return
endif
echo "jumping to " . l:w
exec ".cc"
exec "cclose"
endfun
" }
au FileType lua nnoremap <buffer> <C-]> :call GotoLuaFuncDifinition()<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment