Skip to content

Instantly share code, notes, and snippets.

@egwynn
Created June 6, 2014 14:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save egwynn/c75ff3ccce8b2f239362 to your computer and use it in GitHub Desktop.
Save egwynn/c75ff3ccce8b2f239362 to your computer and use it in GitHub Desktop.
" Open the corresponding .C/.T/.h/whatever file
function! EG_openMatching()
let path=expand("%:p:h")
let pattern=expand("%:t:r").".\\*"
let cur=expand("%:t")
let cmd="find ".path." -maxdepth 1 -name ".pattern." -and -not -name ".cur
let result=system(cmd)
if v:shell_error
echom "Error: [".result."] (".len(result).")"
echom "Command was: [".cmd."]"
elseif len(result)
execute ":args ".result
endif
endfun
nnoremap <M-C-Up> :call EG_openMatching()<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment