-
Notifications
You must be signed in to change notification settings - Fork 94
/
.ide.vim
62 lines (50 loc) · 1.83 KB
/
.ide.vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
"
" Copyright 2015 Dario Manesku. All rights reserved.
" License: http://www.opensource.org/licenses/BSD-2-Clause
"
" Run vim as 'vim --servername VIM'.
if has("unix")
set makeprg=make
let s:proj_name = "cmft"
let s:proj_root = expand("<sfile>:p:h")
let s:makebg_file = s:proj_root."/.makebg.sh"
let s:log_file = s:proj_root."/make.log"
let s:exec_action = "!../_build/linux64_gcc/bin/".s:proj_name."Debug"
let s:gdb_action = "!gdb -x ".s:proj_root."/.gdbinit"." --args ../_build/linux64_gcc/bin/".s:proj_name."Debug"
let s:make_action = "linux-debug64"
function! SetDebug()
let s:make_action = "linux-debug64"
let s:exec_action = "!../_build/linux64_gcc/bin/".s:proj_name."Debug"
endfunc
command! -nargs=0 SetDebug :call SetDebug()
function! SetRelease()
let s:make_action = "linux-release64"
let s:exec_action = "!../_build/linux64_gcc/bin/".s:proj_name."Release"
endfunc
command! -nargs=0 SetRelease :call SetRelease()
function! Build()
let s:make_command = "make ".s:proj_root." ".s:make_action
let s:build_action = "!".s:makebg_file." ".v:servername." \"".s:make_command."\" ".s:log_file
let curr_dir = getcwd()
exec 'cd' s:proj_root
exec s:build_action
exec 'cd' curr_dir
endfunc
function! Execute()
let s:runtime_dir = s:proj_root."/runtime"
let curr_dir = getcwd()
exec 'cd' s:runtime_dir
exec s:exec_action
exec 'cd' curr_dir
endfunc
function! DebugGdb()
let s:runtime_dir = s:proj_root."/runtime"
let curr_dir = getcwd()
exec 'cd' s:runtime_dir
exec s:gdb_action
exec 'cd' curr_dir
endfunc
nmap ,rr :call Build()<cr><cr>
nmap ,ee :call Execute()<cr>
nmap ,gdb :call DebugGdb()<cr>
endif