Created
January 6, 2016 03:20
-
-
Save xebecnan/3483042280650f5a4755 to your computer and use it in GitHub Desktop.
This file contains 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
"LUA REQUIRE JUMPER { | |
function! JumpRequire() | |
let line=getline('.') | |
if line =~ "\\<require\\>\\s*(\\?\\s*['\"][^'\"]\\+['\"]\\s*)\\?\\s*$" | |
let path = substitute(line, "^.*\\<require\\>\\s*(\\?\\s*['\"]\\([^'\"]\\+\\)['\"]\\s*)\\?\\s*$", '\1', 'g') | |
let target = substitute(path, '\.', '/', 'g') . '.lua' | |
if &mod['ified'] | |
execute "vs " . target | |
else | |
execute "e " . target | |
end | |
else | |
echo "bad line" | |
endif | |
endfunction | |
nmap <C-j> :call JumpRequire()<CR> | |
"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment