dotfiles/vim/.vimrc
2016-11-04 14:35:41 +01:00

127 lines
3 KiB
VimL

" Must have for vim
set nocompatible
" Display nbsp
set listchars=tab:\|\ ,nbsp
set list
" Remap ESC on ,,
map ,, <ESC>
imap ,, <ESC>
scriptencoding utf-8
" Manage plugins
call pathogen#infect()
" Must be *after* pathogen
filetype plugin indent on
" Leader
let mapleader=","
nnoremap <leader>a :echo("\<leader\> works! It is set to <leader>")<CR>
" let maplocalleader = "-"
" Highlighting
syntax enable
if has('gui_running')
" When gui is running, it pretty much sets its own colors
set background=light
set guifont=Inconsolata\ 16
else
" If we're in a terminal, then we stay default, terminal will choose
" which colors it likes.
set background=dark
endif
let g:solarized_termcolors=16
colorscheme solarized
" Set line numbering
set number
" Don't wrap lines, it's ugly
set nowrap
" Deal with tabs
set softtabstop=2
set tabstop=2 " 1 tab = 2 spaces
set shiftwidth=2 " Indent with 2 spaces
set expandtab " Insert spaces instead of tabs
" Set par as default wrapper
set formatprg=par\ -w80
" Set mouse on
set mouse=a
" Don't set timeout - this breaks the leader use
set notimeout
set ttimeout
" Set filetype tex for tikz files
au BufNewFile,BufRead *.mgs set filetype=mgs
" Set filetype tex for tikz files
au BufNewFile,BufRead *.tikz set filetype=tex
" Set filetype Faust for DSP files
au BufNewFile,BufRead *.dsp set filetype=faust
" OCaml indentation
let g:ocp_indent_vimfile = system("opam config var share")
let g:ocp_indent_vimfile = substitute(g:ocp_indent_vimfile, '[\r\n]*$', '', '')
let g:ocp_indent_vimfile = g:ocp_indent_vimfile . "/ocp-indent/vim/indent/ocaml.vim"
autocmd FileType ocaml exec ":source " . g:ocp_indent_vimfile
" For lusty-explorer
set hidden
" ack default config
let g:ackprg = "ack -H --nocolor --nogroup --column"
" place a marker and search
nmap <leader>j mA:Ack <space>
" place a marker and search the word under the cursor
nmap <leader>ja mA:Ack "<C-r>=expand("<cword>")<cr>"
nmap <leader>jA mA:Ack "<C-r>=expand("<cWORD>")<cr>"
map <F12> :w<CR>:make -j 5<CR><CR><CR>
map <space> za
" Search for selected text, forwards or backwards.
vnoremap <silent> * :<C-U>
\let old_reg=getreg('"')<Bar>let old_regtype=getregtype('"')<CR>
\gvy/<C-R><C-R>=substitute(
\escape(@", '/\.*$^~['), '\_s\+', '\\_s\\+', 'g')<CR><CR>
\gV:call setreg('"', old_reg, old_regtype)<CR>
vnoremap <silent> # :<C-U>
\let old_reg=getreg('"')<Bar>let old_regtype=getregtype('"')<CR>
\gvy?<C-R><C-R>=substitute(
\escape(@", '?\.*$^~['), '\_s\+', '\\_s\\+', 'g')<CR><CR>
\gV:call setreg('"', old_reg, old_regtype)<CR>
let &colorcolumn=join(range(81,999),",")
" vimtex options
let g:vimtex_fold_enabled=1
let g:vimtex_fold_manual=1
" nice pluginless stuff
set path+=**
set wildmenu
" Tag generation
command! MakeTags !ctags -R .
" Less noise in netrw
let g:netrw_banner=0
let g:netrw_browse_split=4
let g:netrw_altv=1
let g:netrw_liststyle=3
let g:netrw_list_hide=netrw_gitignore#Hide()
let g:netrw_list_hide.=',\(^\|\s\s\)\zs\.\S\+'
" vim:ai:et:sw=4:ts=4:sts=4:tw=78:fenc=utf-8:foldmethod=marker