]> git.mdlowis.com Git - archive/vim_config.git/commitdiff
Added project.vim template files
authorMike D. Lowis <mike@mdlowis.com>
Fri, 1 Jun 2012 14:05:29 +0000 (10:05 -0400)
committerMike D. Lowis <mike@mdlowis.com>
Fri, 1 Jun 2012 14:05:29 +0000 (10:05 -0400)
projects/gentex.vim [new file with mode: 0644]
projects/project.vim [new file with mode: 0644]

diff --git a/projects/gentex.vim b/projects/gentex.vim
new file mode 100644 (file)
index 0000000..78f17df
--- /dev/null
@@ -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 "<ESC>:cgetfile quickfix.txt<CR>' .
+              \ ((a:show_qf == 1) ? '<ESC>:cope<CR>' : '') .
+              \ '<ESC>:let g:CmdRunning = 0<CR>"'
+
+    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 ' . '<args>')
+cnoreabbrev rake Rake
+
+" Define a rake command
+command! -nargs=* Exec call RunCmd(0, '<args>')
+cnoreabbrev exec Exec
+cnoreabbrev cmd Exec
+
+"------------------------------------------------------------------------------
+" Project Specific Key Mappings
+"------------------------------------------------------------------------------
+map <silent> <F2>  <F3><F4>
+map <silent> <F3>  <ESC>:call RefreshCTags()<CR>
+map <silent> <F4>  <ESC>:call RefreshCScope()<CR>
+map <silent> <F6>  <ESC>:execute("find " . g:TestSrcPath . "/**/test_" . expand("%:t:r") . ".c")<CR>
+map <silent> <F7>  <ESC>:Rake test:%:t:r.c<CR>
+map <silent> <F8>  <ESC>:Rake bullseye:%:t:r.c<CR>
+map <silent> <F9>  <ESC>:call RunCmd(1,'grep -rEn "TODO\|@bug\|@fix" Code/ Test/')<CR>
+map <silent> <F10> <ESC>:Rake release<CR>
+map <silent> <F12> <ESC>:Rake debug<CR>
+
+"==============================================================================
+" 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 (file)
index 0000000..6e2158a
--- /dev/null
@@ -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 <F2> <ESC>:call RefreshCTags()<CR>:call RefreshCScope()<CR>
+map <F3> <ESC>:call RefreshCTags()<CR>
+map <F4> <ESC>:call RefreshCScope()<CR>
+map <F6> <ESC>:execute("find " . g:TestSrcPath . "/**/test_" . expand("%:t:r") . ".c")<CR>
+
+"------------------------------------------------------------------------------
+" 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()