if( (&ft == "c") || (&ft == "cpp") )
setlocal cindent
setlocal cino={1s=1s:1s(1s
+elseif(&ft == "ruby")
+ setlocal tabstop=2
+ setlocal shiftwidth=2
+ set softtabstop=2
endif
-"==============================================================================
-" Abbreviations
-"==============================================================================
-" Normal mode abbreviations
-abbreviate inc #include
-abbreviate def #define
-abbreviate ifdef #ifdef<CR>#endif<up><END>
-abbreviate ifndef #ifndef<CR>#endif<up><END>
-abbreviate prf printf("");<left><left><left>
-
-abbreviate ctest
- \void test_(void)<CR>
- \{<CR>
- \ // Setup<CR>
- \ // Expected calls<CR>
- \ // Function to test<CR>
- \ // Asserts<CR>
- \}<UP><UP><UP><UP><UP><UP><END><ESC>%i
-
"------------------------------------------------------------------------------
" Connect To CTags and CScope
"------------------------------------------------------------------------------
set noerrorbells " Turn off auditory bells
set hid " Change buffer without saving
set clipboard=unnamed " Yank and Put commands use the system clipboard
-set laststatus=2 " Turn off the status line
+set laststatus=2 " Turn on the status line always
set undodir=$VIMHOME/undo " Set directory for storing undo files
set undofile " Turn on persistent undo
set cscopetag " Search both cscope dbs and ctags files for tags
set formatoptions+=r " Enable continuation of comments after a newline
set omnifunc=syntaxcomplete#Complete " Auto complete based on syntax
set completeopt=menu,longest " Show a popup menu with the longest common prefix selected
+set wildmode=list:full
+set wildmenu
"==============================================================================
" Global Variables
" ToFn - Converts a group of C function prototypes to definitions
command! -range=% -nargs=0 ToFn execute "<line1>,<line2>s/;/\r{\r\r}\r/"
-" Todo - Opens ~/.todo.md for editing
+" Todo - Opens g:TodoList for editing
command! Todo execute "edit " . g:TodoList
-" Todo - Opens ~/.todo.md for editing
+" Template - Opens the specified template for editing
command! -nargs=1 Template execute "edit " . g:TemplateDir . "/" . <f-args> . ".m4"
" LoadProject - Searches for and loads project specific settings
" ReformatWhiteSpace - Convert tabs to spaces and remove trailing whitespace
function! ReformatWhiteSpace()
+ let line_num = line(".")
if &modifiable
retab
silent! exec("%s/\\s\\+$//")
endif
+ execute(":" . line_num)
endfunction
" Template - Finds and inserts the text of the given template
let targs = strpart(a:input,stridx(a:input,' ')+1)
if filereadable( tdir . '/' . tname )
execute(".-1read !m4 -DARGS='" . targs . "' -I" . tdir . " " . tname)
+ let line_num = line(".")
+ execute("normal G=gg")
+ execute(":" . line_num)
else
echoerr "No template found: " . tname
endif
map k gk
" ---- Toggle Fold ----
-map zz <ESC>za
+map zz <ESC>za
" ---- Indenting Visual Blocks ----
vnoremap < <gv
inoremap <C-Space> <C-n>
" ---- Template Replacement ----
-map ;t :call Template(getline("."))<CR>jdd
+map <Leader>t :call Template(getline("."))<CR>jdd
" ---- Buffer Management ----
map <C-S-tab> :bp<CR>
map <C-tab> :bn<CR>
imap <C-tab> <ESC>:bn<CR>
-" ---- Working With Windows ----
-map <M-h> <C-w>h
-map <M-j> <C-w>j
-map <M-k> <C-w>k
-map <M-l> <C-w>l
-map <M-c> <C-w>c
-map <M-v> :vs<CR>
-map <M-s> :split<CR>
-
" ---- Moving Lines Around ----
nmap <C-j> ddp
imap <C-j> <ESC>ddpi
cnoreabbrev tofn ToFn
cnoreabbrev fn ToFn
cnoreabbrev <expr> ff
- \ ((getcmdtype() == ':' && getcmdpos() <= 4)? 'cs f f' : 'ff')
+ \ ((getcmdtype() == ':' && getcmdpos() <= 4)? 'cs f f' : 'ff')
"==============================================================================
" Auto Commands