From e26464d79e71d255bfa20f488e4c9fe594ee917f Mon Sep 17 00:00:00 2001 From: "Mike D. Lowis" Date: Fri, 1 Jun 2012 10:05:29 -0400 Subject: [PATCH] Added project.vim template files --- projects/gentex.vim | 115 +++++++++++++++++++++++++++++++++++++++++++ projects/project.vim | 66 +++++++++++++++++++++++++ 2 files changed, 181 insertions(+) create mode 100644 projects/gentex.vim create mode 100644 projects/project.vim diff --git a/projects/gentex.vim b/projects/gentex.vim new file mode 100644 index 0000000..78f17df --- /dev/null +++ b/projects/gentex.vim @@ -0,0 +1,115 @@ +"------------------------------------------------------------------------------ +" Global Config Variables +"------------------------------------------------------------------------------ +let g:ProjectPath = getcwd() +let g:TestSrcPath = g:ProjectPath . "/Test/Unit/Application/Source" +let g:CScopeDir = g:ProjectPath . "/Code" +let g:CTagsFile = g:CScopeDir . "/tags" + +"------------------------------------------------------------------------------ +" Global Config Variables +"------------------------------------------------------------------------------ +" Connect to CScope +function! ConnectCScope() + set nocscopeverbose " suppress 'duplicate connection' error + silent! exec "cs add " . g:CScopeDir. "/cscope.out" . " " . g:CScopeDir . " -C" + set cscopeverbose +endfunction + +" Connect to the Correct CTags File +function! ConnectCTags() + execute("set tags=" . g:CTagsFile) +endfunction + +" Update the CScope Database +function! RefreshCScope() + if strlen(g:CScopeDir) + set nocscopeverbose + execute('cscope kill -1') + execute('cd ' . g:CScopeDir) + execute('silent ! cscope -Rb') + call ConnectCScope() + execute('cd ' . g:ProjectPath) + endif +endfunction + +" Update the CTags File +function! RefreshCTags() + if strlen(g:CScopeDir) + execute('cd ' . g:CScopeDir) + execute('silent ! ctags -R *') + execute('cd ' . g:ProjectPath) + endif +endfunction + +" Execute Rake with the given targets and open the quickfix window +function! RunCmd(show_qf,task) + let cmd = 'silent !start /min cmd /c ' . a:task . ' > quickfix.txt 2>&1 ' . + \ '&gvim --servername ' . v:servername . + \ ' --remote-send ":cgetfile quickfix.txt' . + \ ((a:show_qf == 1) ? ':cope' : '') . + \ ':let g:CmdRunning = 0"' + + if !exists('g:CmdRunning') || (g:CmdRunning == 0) + execute(cmd) + let g:CmdRunning = 1 + else + echoerr 'Error: A background command is already running!' + endif +endfunction + +" Define a rake command +command! -nargs=* Rake call RunCmd(1, 'rake ' . '') +cnoreabbrev rake Rake + +" Define a rake command +command! -nargs=* Exec call RunCmd(0, '') +cnoreabbrev exec Exec +cnoreabbrev cmd Exec + +"------------------------------------------------------------------------------ +" Project Specific Key Mappings +"------------------------------------------------------------------------------ +map +map :call RefreshCTags() +map :call RefreshCScope() +map :execute("find " . g:TestSrcPath . "/**/test_" . expand("%:t:r") . ".c") +map :Rake test:%:t:r.c +map :Rake bullseye:%:t:r.c +map :call RunCmd(1,'grep -rEn "TODO\|@bug\|@fix" Code/ Test/') +map :Rake release +map :Rake debug + +"============================================================================== +" Doxygen Comment Configuration +"============================================================================== +" File author tag +let g:DoxygenToolkit_authorTag = "" +let g:DoxygenToolkit_authorName = "$Author$" + +" File version tag +let g:DoxygenToolkit_versionTag = "" +let g:DoxygenToolkit_versionString = "$Revision$" + +" File date tag +let g:DoxygenToolkit_dateTag = "" +let g:DoxygenToolkit_dateString = "$Date$" + +" Extra Info for File Header +let g:DoxygenToolkit_extraTag = "" +let g:DoxygenToolkit_authorExtra = "$HeadURL$" + +"------------------------------------------------------------------------------ +" Project Specific Key Mappings +"------------------------------------------------------------------------------ +" Gentex style code formatting +if( (&ft == "c") || (&ft == "cpp") ) + setlocal cindent + setlocal cino={1s=1s:1s(1s +endif + +"------------------------------------------------------------------------------ +" Connect To CTags and CScope +"------------------------------------------------------------------------------ +call ConnectCScope() +call ConnectCTags() diff --git a/projects/project.vim b/projects/project.vim new file mode 100644 index 0000000..6e2158a --- /dev/null +++ b/projects/project.vim @@ -0,0 +1,66 @@ +"------------------------------------------------------------------------------ +" Global Config Variables +"------------------------------------------------------------------------------ +let g:ProjectPath = getcwd() +let g:TestSrcPath = g:ProjectPath . "/tests" +let g:CScopeDir = g:ProjectPath +let g:CTagsFile = g:CScopeDir . "/tags" + +"------------------------------------------------------------------------------ +" Global Config Variables +"------------------------------------------------------------------------------ +" Connect to CScope +function! ConnectCScope() + set nocscopeverbose " suppress 'duplicate connection' error + silent! exec "cs add " . g:CScopeDir. "/cscope.out" . " " . g:CScopeDir . " -C" + set cscopeverbose +endfunction + +" Connect to the Correct CTags File +function! ConnectCTags() + execute("set tags=" . g:CTagsFile) +endfunction + +" Update the CScope Database +function! RefreshCScope() + if strlen(g:CScopeDir) + set nocscopeverbose + execute('cscope kill -1') + execute('cd ' . g:CScopeDir) + execute('silent ! cscope -Rb') + call ConnectCScope() + execute('cd ' . g:ProjectPath) + endif +endfunction + +" Update the CTags File +function! RefreshCTags() + if strlen(g:CScopeDir) + execute('cd ' . g:CScopeDir) + execute('silent ! ctags -R *') + execute('cd ' . g:ProjectPath) + endif +endfunction + +"------------------------------------------------------------------------------ +" Project Specific Key Mappings +"------------------------------------------------------------------------------ +map :call RefreshCTags():call RefreshCScope() +map :call RefreshCTags() +map :call RefreshCScope() +map :execute("find " . g:TestSrcPath . "/**/test_" . expand("%:t:r") . ".c") + +"------------------------------------------------------------------------------ +" Project Specific Key Mappings +"------------------------------------------------------------------------------ +" Gentex style code formatting +if( (&ft == "c") || (&ft == "cpp") ) + setlocal cindent + setlocal cino==1s:1s(1s +endif + +"------------------------------------------------------------------------------ +" Connect To CTags and CScope +"------------------------------------------------------------------------------ +call ConnectCScope() +call ConnectCTags() -- 2.52.0