Fixes for windows.
This commit is contained in:
@@ -14,27 +14,54 @@ endif
|
|||||||
"
|
"
|
||||||
" Windows
|
" Windows
|
||||||
"
|
"
|
||||||
|
let g:argv=""
|
||||||
let g:cppflags=""
|
let g:cppflags=""
|
||||||
let g:wcppflags="/O2 /EHsc"
|
let g:wcppflags="/O2 /EHsc /DWIN32"
|
||||||
function! s:CompileMSVC()
|
function! s:CompileMSVC()
|
||||||
let exename=expand("%:p:r:s,$,.exe,")
|
let exename=expand("%:p:r:s,$,.exe,")
|
||||||
let srcname=expand("%")
|
let srcname=expand("%")
|
||||||
" compile it
|
" compile it
|
||||||
let ccline="cl ".g:cppflags." ".g:wcppflags." ".srcname." /Fe".exename
|
let ccline="cl ".$CXXFLAGS." ".g:cppflags." ".g:wcppflags." ".srcname." /Fe".exename." /link ".$LDFLAGS
|
||||||
echo ccline
|
echo ccline
|
||||||
let cout = system( ccline )
|
let cout = system( ccline )
|
||||||
if v:shell_error
|
if v:shell_error
|
||||||
echo cout
|
echo cout
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
echo cout
|
||||||
" run it
|
" run it
|
||||||
echo exename
|
let cmd = exename . " " . g:argv
|
||||||
let eout = system( exename )
|
echo cmd
|
||||||
|
let eout = system( cmd )
|
||||||
|
echo eout
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:CompileJava()
|
||||||
|
" compile it
|
||||||
|
let cmd = "javac " . g:javaflags . " " . expand("%")
|
||||||
|
echo cmd
|
||||||
|
let cout = system( cmd )
|
||||||
|
echo cout
|
||||||
|
if v:shell_error
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
" run it
|
||||||
|
"let classpath=expand("%:p:r")
|
||||||
|
let exename=expand("%:r")
|
||||||
|
let cmd = "java " . exename . " " . g:argv
|
||||||
|
echo cmd
|
||||||
|
let eout = system( cmd )
|
||||||
echo eout
|
echo eout
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:CompileWindows()
|
function! s:CompileWindows()
|
||||||
|
let ext=expand("%:e")
|
||||||
|
if ext=="java"
|
||||||
|
call s:CompileJava()
|
||||||
|
endif
|
||||||
|
if ext=="cpp"
|
||||||
call s:CompileMSVC()
|
call s:CompileMSVC()
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"
|
"
|
||||||
@@ -68,11 +95,23 @@ endfunction
|
|||||||
" Load compile instructions and call window or linux compiler.
|
" Load compile instructions and call window or linux compiler.
|
||||||
"
|
"
|
||||||
function! CF5Compile()
|
function! CF5Compile()
|
||||||
source expand("%:p:h")."/compile-opt.vim"
|
"
|
||||||
call FirstModeLine()
|
" Source compile-opt.vim if exists.
|
||||||
if exists("g:cf5script")
|
"
|
||||||
execute g:cf5script
|
let copt=expand("%:p:h")."/compile-opt.vim"
|
||||||
|
if filereadable(copt)
|
||||||
|
source copt
|
||||||
endif
|
endif
|
||||||
|
"
|
||||||
|
" Set source specific compiler options.
|
||||||
|
"
|
||||||
|
call FirstModeLine()
|
||||||
|
"if exists("g:cf5script")
|
||||||
|
" execute g:cf5script
|
||||||
|
"endif
|
||||||
|
"
|
||||||
|
" Compile.
|
||||||
|
"
|
||||||
if has("win32") || has("win64")
|
if has("win32") || has("win64")
|
||||||
call s:CompileWindows()
|
call s:CompileWindows()
|
||||||
else
|
else
|
||||||
|
|||||||
11
vim/vimrc
11
vim/vimrc
@@ -48,28 +48,31 @@ endif
|
|||||||
" for keeping undo history after closing Vim entirely. Vim will complain if you
|
" for keeping undo history after closing Vim entirely. Vim will complain if you
|
||||||
" try to quit without saving, and swap files will keep you safe if your computer
|
" try to quit without saving, and swap files will keep you safe if your computer
|
||||||
" crashes.
|
" crashes.
|
||||||
if has('hidden')
|
if exists('&hidden')
|
||||||
set hidden
|
set hidden
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Instead of failing a command because of unsaved changes, instead raise a
|
" Instead of failing a command because of unsaved changes, instead raise a
|
||||||
" dialogue asking if you wish to save changed files.
|
" dialogue asking if you wish to save changed files.
|
||||||
if has('confirm')
|
if exists('&confirm')
|
||||||
set confirm
|
set confirm
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Use visual bell instead of beeping when doing something wrong
|
" Use visual bell instead of beeping when doing something wrong
|
||||||
if has('visualbell')
|
if exists('&visualbell')
|
||||||
set visualbell
|
set visualbell
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Display line numbers on the left
|
" Display line numbers on the left
|
||||||
if has('number')
|
if exists('&number')
|
||||||
set number
|
set number
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Modelined are used to configure files.
|
" Modelined are used to configure files.
|
||||||
|
if exists('&modeline')
|
||||||
set modeline
|
set modeline
|
||||||
|
set modelines=10
|
||||||
|
endif
|
||||||
|
|
||||||
" Only do this part when compiled with support for autocommands.
|
" Only do this part when compiled with support for autocommands.
|
||||||
if has("autocmd")
|
if has("autocmd")
|
||||||
|
|||||||
Reference in New Issue
Block a user