You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

120 lines
3.1 KiB

" sourced by Janus
set tabstop=4
set shiftwidth=4
set softtabstop=4
" Set the indent to 2 when working with ruby and markup stuff
autocmd BufNewFile,BufRead *.feature,*.rb,*.ru,*.xml,*.html,*.htm,Gemfile,Rakefile,Procfile set shiftwidth=2
\| set tabstop=2
\| set softtabstop=2
" Set up some sane java compilation bits
autocmd BufRead *.java set efm=%A\ %#[javac]\ %f:%l:\ %m,%-Z\ %#[javac]\ %p^,%-C%.%#
\| set makeprg=ant\ -find\ build.xml
map ,t :w<cr>
map ,m :w\|:make<cr><cr>
map ,- :nohl<cr>
" (en|dis)able crosshairs!
function! EnableCrosshairs()
set cursorline
set cursorcolumn
highlight CursorLine ctermbg=blue
highlight CursorColumn ctermbg=blue
endfunction
function! DisableCrosshairs()
set nocursorline
set nocursorcolumn
endfunction
" MyNext() and MyPrev(): Movement between tabs OR buffers
function! MyNext()
if exists( '*tabpagenr' ) && tabpagenr('$') != 1
" Tab support && tabs open
normal gt
else
" No tab support, or no tabs open
execute ":bnext"
endif
endfunction
function! MyPrev()
if exists( '*tabpagenr' ) && tabpagenr('$') != '1'
" Tab support && tabs open
normal gT
else
" No tab support, or no tabs open
execute ":bprev"
endif
endfunction
" moving between tabs OR buffers
nnoremap L :call MyNext()<CR>
nnoremap H :call MyPrev()<CR>
" easy indentation in visual mode
" This keeps the visual selection active after indenting.
" Usually the visual selection is lost after you indent it.
vmap > >gv
vmap < <gv
" run make
" <F3> or \m
map <silent><F3> :make<CR>
map <silent><leader>m :make<CR>
" Highlight over 80 chars wide for python files
" (to call manually, use the mapping '\py80'
map <silent><leader>py80 :call LambastOver80Wide()<CR>
function! LambastOver80Wide()
highlight NearLength ctermbg=yellow ctermfg=black
match NearLength /\%76v.*/
highlight OverLength ctermbg=red ctermfg=white guibg=#592929
match OverLength /\%81v.*/
endfun
" disable mapping (to call manually use mapping '\nopy80'
map <silent><leader>nopy80 :call DisableLambastOver80Wide()<CR>
function! DisableLambastOver80Wide()
highlight OverLength ctermbg=Black ctermfg=white guibg=#000000
endfun
" call it right away for certain files
autocmd FileType python call LambastOver80Wide()
autocmd FileType moin call LambastOver80Wide()
" autocmd FileType javascript call LambastOver80Wide()
" autocmd FileType actionscript call LambastOver80Wide()
autocmd FileType mail call LambastOver80Wide()
autocmd FileType scons call LambastOver80Wide()
" autocmd FileType cs call LambastOver80Wide()
" strip trailing whitespace
map <silent><leader>SW :call StripTrailingWhitespace()<CR>
function! StripTrailingWhitespace()
:%s/\s\+$//e
endfun
" remove all ^M chars
map <silent><leader>SM :call StripCtrlMs()<CR>
function! StripCtrlMs()
:%s/[ \t\r]\+$//e
endfun
" insert date
map <silent><leader>D :call InsertDate()<CR>
function! InsertDate()
:read !date
endfun
if !has('gui_running')
set t_Co=256
"colorscheme gardener
colorscheme inkpot
endif
let g:valgrind_arguments='--leak-check=yes --num-callers=50'