Skip to content
Snippets Groups Projects
cdaq.vimrc 5.96 KiB
Newer Older
mep user's avatar
mep user committed
set nocompatible
" set default 'runtimepath' (without ~/.vim folders)
let &runtimepath = printf('%s/vimfiles,%s,%s/vimfiles/after', $VIM, $VIMRUNTIME, $VIM)

" what is the name of the directory containing this file?
let s:portable = expand('<sfile>:p:h')

" add the directory to 'runtimepath'
let &runtimepath = printf('%s,%s,%s/after', s:portable, &runtimepath, s:portable)

execute pathogen#infect()
syntax on
filetype plugin on
filetype indent on      " activates indenting for files

set smartindent
set autoindent

set laststatus=3        " grey status bar at the bottom
set shiftwidth=2
set expandtab
set foldmethod=indent   
set foldnestmax=10
set nofoldenable
set nocompatible
set ignorecase             " case insensitive search
set restorescreen=on       " restore the screen
set number                 " line numbers
set relativenumber
" Switch to absolute numbering in insert mode
au InsertEnter * :set norelativenumber
au InsertLeave * :set relativenumber

" Maintain undo history between sessions
set undofile
set undodir=~/users/whit/.vim/undodir

" -------------------------------------
" Color scheme
"set t_Co=256
"colorscheme  flattened_dark      " colorscheme desert
":let g:solarized_termcolors = 256
"colorscheme wombat
colorscheme wombat256mod " current favorite
"colorscheme codeschool
"colorscheme jellybeans
"colorscheme badwolf
"colorscheme goodwolf
"colorscheme Tomorrow-Night
"set background=dark
"colorscheme solarized 
"set background=dark
"colorscheme PaperColor
" disable the Background Color Erase that messes with some color schemes
set t_ut=


" 
let mapleader = "-"

" vimwiki
let g:vimwiki_list = [{'path': '~/.vim/vimwiki/cdaq.wiki'}]
set nocompatible
filetype plugin on
syntax on

au BufRead,BufNewFile *.wiki set filetype=vimwiki
":autocmd FileType vimwiki map d :VimwikiMakeDiaryNote

"set spell spelllang=en_us

"function! ToggleCalendar()
"  execute ":Calendar"
"  if exists("g:calendar_open")
"    if g:calendar_open == 1
"      execute "q"
"      unlet g:calendar_open
"    else
"      g:calendar_open = 1
"    end
"  else
"    let g:calendar_open = 1
"  end
"endfunction
":autocmd FileType vimwiki map c :call ToggleCalendar()

" --------------------------------------
"  Utility Functions
"
" The following causes jump to the last cursor position when
" reopening a file
if has("autocmd")
  au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
        \| exe "normal! g'\"" | endif
endif

" Damian conway plugins
"https://github.com/thoughtstream/Damian-Conway-s-Vim-Setup
"dragvisuals allows for moving around visual blocks
runtime plugin/dragvisuals.vim
vmap  <expr>  <LEFT>   DVB_Drag('left')
vmap  <expr>  <RIGHT>  DVB_Drag('right')
vmap  <expr>  <DOWN>   DVB_Drag('down')
vmap  <expr>  <UP>     DVB_Drag('up')
"vmap  <expr>  D        DVB_Duplicate()
"Remove any introduced trailing whitespace after moving.
let g:DVB_TrimWS = 1
"runtime plugin/vmath.vim
"vmap <expr> ++ VMATH_YankAndAnalyse()
"nmap        ++ vip++

" ----------------------------
"  File type specific 
autocmd Filetype python setlocal expandtab tabstop=4 shiftwidth=4

"let g:load_doxygen_syntax=1

let mapleader = "-"

" edit vim rc with 
"nnoremap <leader>ev :vsplit $MYVIMRC<cr>
"nnoremap <leader>sv :source $MYVIMRC<cr>
"autocmd BufWritePre *.html :normal gg=G

" mutt
"au! BufRead,BufNewFile /tmp/mutt-*    set fo+=aw
"autocmd BufRead,BufNewFile /tmp/mutt-* setlocal spell
"autocmd BufRead,BufNewFile /tmp/mutt-* set complete+=kspell
"au! BufRead,BufNewFile *mutt-*    set fo+=aw
"autocmd BufRead,BufNewFile *mutt-* setlocal spell
"autocmd BufRead,BufNewFile *mutt-* set complete+=kspell
"au BufRead /tmp/mutt-* source ~/.vim/ftplugin/mail/mutt-aliases.vim

" md
autocmd BufRead,BufNewFile *.md set fo+=aw
autocmd BufRead,BufNewFile *.md setlocal spell
autocmd BufRead,BufNewFile *.md set complete+=kspell
let g:vim_markdown_folding_disabled=1
autocmd BufRead,BufNewFile *slides/*.md set ft=html

" tex
"autocmd BufRead,BufNewFile *.tex    set fo+=aw
""let g:tex_flavor='latex'
autocmd BufRead,BufNewFile *.cls set ft=tex
autocmd BufRead,BufNewFile *.tex setlocal spell
autocmd BufRead,BufNewFile *.tex set complete+=kspell
"au BufNewFile,BufRead body.tex syntax spell toplevel
let g:tex_flavor='latex'
let g:vimtex_quickfix_latexlog = {'default' : 0}

" html
autocmd BufRead,BufNewFile *.html setlocal spell
autocmd BufRead,BufNewFile *.html set complete+=kspell
"au! BufRead,BufNewFile *.tex    set fo+=aw

" txt
autocmd BufRead,BufNewFile *.txt    set fo+=w
autocmd BufRead,BufNewFile *.txt setlocal spell
autocmd BufRead,BufNewFile *.txt set complete+=kspell
autocmd BufRead,BufNewFile CMakeLists.txt setlocal nospell

" tmp
autocmd BufRead,BufNewFile *.tmp set fo+=w
autocmd BufRead,BufNewFile *.tmp setlocal spell
autocmd BufRead,BufNewFile *.tmp set complete+=kspell

set matchpairs+=<:>

" json
autocmd BufNewFile,BufRead *.json set ft=javascript

" clang-format
map <C-K> :pyf /group/c-csv/local/stow/llvm_6.0.1/share/clang/clang-format.py<cr>
imap <C-K> <c-o>:pyf /group/c-csv/local/stow/llvm_6.0.1/share/clang/clang-format.py<cr>

" git
autocmd FileType gitcommit setlocal spell

"let g:netrw_dirhistmax = 0
"let g:netrw_dirhistmax  =10
"let g:netrw_dirhist_cnt =5
"let g:netrw_home=$XDG_CACHE_HOME.'/vim'

"let g:ycm_global_ycm_extra_conf = "~/.vim/ycm_extra_conf.py"

" calendar
"let g:calendar_google_calendar = 1
"let g:calendar_google_task = 1

" vim-airline
let g:airline#extensions#tabline#enabled = 1
let g:airline_powerline_fonts = 1
"let g:airline_theme = 'powerlineish'
"let g:airline#extensions#hunks#enabled=0
"let g:airline#extensions#branch#enabled=1
"if !exists('g:airline_symbols')
"  let g:airline_symbols = {}
"endif
"let g:airline_symbols.space = "\ua0"
"let g:airline_section_a = 'asdf'
"let g:airline_section_b = '%-0.10{getcwd()}'
"let g:airline_section_c = '%t'
let g:airline_extensions = ['branch', 'tabline']
"let g:airline#extensions#branch#enabled = 1

" email utils
" http://www.256bit.org/~chrisbra/cms/vim_as_e-mail_editor.html#format
"let g:checkattach_filebrowser = 'ranger'
"let g:mutt_aliases_file="~/.mutt/aliases"