Files
dotfiles/vimrc
T
2021-08-17 11:47:19 +02:00

260 lines
5.0 KiB
VimL

" General {{{
" Sets how many lines of history VIM has to remember
set history=700
" Set to auto read when a file is changed from the outside
set autoread
" Use par for prettier line formatting
set formatprg="PARINIT='rTbgqR B=.,?_A_a Q=_s>|' par\ -w72"
" Kill the damned Ex mode.
nnoremap Q <nop>
" }}}
" Vundle {{{
set nocompatible
filetype off
set rtp+=~/.vim/bundle/vundle
call vundle#rc()
" let Vundle manage Vundle
" required!
Bundle 'gmarik/vundle'
" Support bundles
Bundle 'scrooloose/syntastic'
" Other programming languages
Bundle 'hellerve/carp-vim'
"Bundle 'junegunn/goyo.vim'
" }}}
" VIM user interface {{{
" Turn on the WiLd menu
set wildmenu
" Tab-complete files up to longest unambiguous prefix
set wildmode=list:longest,full
" Always show current position
set ruler
" Show trailing whitespace
set list
" But only interesting whitespace
if &listchars ==# 'eol:$'
set listchars=tab:>\ ,trail:-,extends:>,precedes:<,nbsp:+
endif
" Height of the command bar
set cmdheight=1
" Configure backspace so it acts as it should act
set backspace=eol,start,indent
set whichwrap+=<,>,h,l
" Ignore case when searching
set ignorecase
" When searching try to be smart about cases
set smartcase
" Highlight search results
set hlsearch
" Makes search act like search in modern browsers
set incsearch
" Don't redraw while executing macros (good performance config)
set lazyredraw
" For regular expressions turn magic on
set magic
" Show matching brackets when text indicator is over them
set showmatch
" How many tenths of a second to blink when matching brackets
set mat=2
" No annoying sound on errors
set noerrorbells
set vb t_vb=
if &term =~ '256color'
" disable Background Color Erase (BCE) so that color schemes
" render properly when inside 256-color tmux and GNU screen.
" see also http://snk.tuxfamily.org/log/vim-256color-bce.html
set t_ut=
endif
" Default to mouse mode on
set mouse=a
" }}}
" Enable syntax highlighting
syntax enable
" Enable filetype plugins
filetype plugin on
filetype indent on
" Use same color behind concealed unicode characters
hi clear Conceal
" Set paste mode and use system clipboard
set paste
set clipboard=unnamed
set t_Co=256
" Set utf8 as standard encoding and en_US as the standard language
set encoding=utf8
" Use Unix as the standard file type
set ffs=unix,dos,mac
" }}}
" Files, backups and undo {{{
" Turn backup off, since most stuff is in Git anyway...
set nobackup
set nowb
set noswapfile
" }}}
" Text, tab and indent related {{{
" Use spaces instead of tabs
set expandtab
" Be smart when using tabs
set smarttab
" 1 tab == 2 spaces
set shiftwidth=2
set tabstop=2
" Linebreak on 80 characters
set lbr
set tw=80
set ai "Auto indent
set si "Smart indent
set wrap "Wrap lines
" }}}
" Moving around, tabs, windows and buffers {{{
" Treat long lines as break lines (useful when moving around in them)
nnoremap j gj
nnoremap k gk
noremap <c-h> <c-w>h
noremap <c-k> <c-w>k
noremap <c-j> <c-w>j
noremap <c-l> <c-w>l
" Return to last edit position when opening files (You want this!)
augroup last_edit
autocmd!
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
augroup END
" Remember info about open buffers on close
set viminfo^=%
" }}}
" Status line {{{
let g:mode_map={
\ '__' : '------',
\ 'c' : 'COMMAND',
\ 'i' : 'INSERT',
\ 'ic' : 'INSERT COMPL',
\ 'ix' : 'INSERT COMPL',
\ 'n' : 'NORMAL',
\ 'ni' : '(INSERT)',
\ 'no' : 'OP PENDING',
\ 'R' : 'REPLACE',
\ 'Rv' : 'V REPLACE',
\ 's' : 'SELECT',
\ 'S' : 'S-LINE',
\ '' : 'S-BLOCK',
\ 't' : 'TERMINAL',
\ 'v' : 'VISUAL',
\ 'V' : 'V-LINE',
\ '' : 'V-BLOCK',
\ }
let g:mode_color_map={
\ '__' : 'magenta',
\ 'c' : 'red',
\ 'i' : '208',
\ 'ic' : '208',
\ 'ix' : '208',
\ 'n' : 'white',
\ 'ni' : '208',
\ 'no' : 'red',
\ 'R' : '135',
\ 'Rv' : '135',
\ 's' : '135',
\ 'S' : '135',
\ '' : '135',
\ 't' : 'white',
\ 'v' : '135',
\ 'V' : '135',
\ '' : '135',
\ }
function! GetMode()
let col=get(g:mode_color_map, mode(), mode())
exec printf("hi StatusLine ctermbg=%s", col)
return get(g:mode_map, mode(), mode())
endfunction
set statusline=%{GetMode()}\ \ \ \ %.20f\ %m\ %r%=%v\ %l\/%L\ \(%2p%%\)\ %y
"set statusline=%y
" Always show the status line
set laststatus=2
" }}}
" Editing mappings {{{
" Delete trailing white space on save
func! DeleteTrailingWS()
exe "normal mz"
%s/\s\+$//ge
exe "normal `z"
endfunc
augroup whitespace
autocmd!
autocmd BufWrite *.hs :call DeleteTrailingWS()
augroup END
" }}}
let g:syntastic_carp_checkers = ['carp']
command Cr !carp -x %
let g:syntastic_python_checkers = ['python']
let g:syntastic_python_python_exec = '/usr/local/bin/python3'
let g:syntastic_haskell_hlint_args = "-i 'Eta reduce'"
let g:syntastic_always_populate_loc_list = 1
au BufNewFile,BufRead .sbclirc set filetype=lisp