Skip to content

Instantly share code, notes, and snippets.

@shiqimei
Forked from aldente39/.vimrc
Created October 4, 2018 20:54
Show Gist options
  • Save shiqimei/41e4c88ce44b2bf212965273e98287da to your computer and use it in GitHub Desktop.
Save shiqimei/41e4c88ce44b2bf212965273e98287da to your computer and use it in GitHub Desktop.
To compile & run by F5 (Vim)
"実行コマンド
command! Run call s:Run()
nmap <F5> :Run<CR>
function! s:Run()
let e = expand("%:e")
if e == "c"
:Gcc
endif
if e == "py"
:Python
endif
if e == "f90" || e == "f95"
:Gfortran
endif
endfunction
command! Python call s:Python()
function! s:Python()
:!python %
endfunction
command! Gcc call s:Gcc()
function! s:Gcc()
if has("win32") || has("win64")
:!gcc % -o %:r.exe
:!%:r.exe
else
:!gcc % -o %:r.out
:!%:r.out
endif
endfunction
command! Gfortran call s:Gfortran()
function! s:Gfortran()
if has("win32") || has("win64")
:!gfortran % -o %:r.exe
:!%:r.exe
else
:!gfortran % -o %:r.out
:!%:r.out
endif
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment