summaryrefslogtreecommitdiff
path: root/vimrc
blob: fef7398234e3a70f92e1d7c7fdf283adb801160c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
" load plugin bundles with pathogen
runtime bundle/pathogen/autoload/pathogen.vim
execute pathogen#infect()
runtime ftplugin/man.vim

set nocompatible            " don't be compatible to vi
set showcmd                 " show entered commands in status line
set showmatch               " show matching brackets
set autoindent              " indent new lines correctly
set hlsearch                " highlight search results
set ignorecase              " case-insensitive searching
set background=dark         " color scheme for dark background
set title                   " set terminal title
set ruler                   " show line/column of cursor in status line
set tabstop=4               " display a tab as 4 spaces
"set softtabstop=4          " (soft) indent tabs with 4 spaces
set shiftwidth=4            " (auto)indent with 4 spaces (> <)
set noexpandtab             " don't expand tabs to spaces
set nobackup                " don't keep backup files
set showtabline=2           " always show tab line
set hidden                  " change buffers without saving
set cursorline              " highlight current cursor line
set scrolloff=4             " keep 4 lines context when scrolling
set laststatus=2            " always show status line
set ttimeoutlen=50          " faster switch from insert to normal mode
set noshowmode              " don't show current mode (done by airline)
set encoding=utf-8          " use utf8 by default
set number                  " enable line numbers
set relativenumber          " show relative line numbers
set backspace=indent,eol,start      " enable backspacing
syntax on                   " enable syntax highlighting
filetype plugin indent on

set directory=~/.vim/swap,.,~/tmp,/var/tmp,/tmp     " directory where to save/search swap files
set viminfo+=n~/.vim/viminfo                        " different location for viminfo file

" make indentation and trailing whitespaces visible
set list listchars=tab:·\ ,trail:·

" autocommands
autocmd FileType python setlocal tabstop=4 softtabstop=0
autocmd FileType c      setlocal tabstop=4 softtabstop=0 noexpandtab
autocmd FileType perl   setlocal tabstop=4 softtabstop=4 expandtab

autocmd InsertEnter * if &number | set norelativenumber | endif
autocmd InsertLeave * if &number | set relativenumber | endif

" show cursorline only in active window
augroup CursorLine
    autocmd!
    autocmd VimEnter,WinEnter,BufWinEnter * set cursorline
    autocmd WinLeave * set nocursorline
augroup END

" highlighting settings
if (&t_Co == 88)
    highlight CursorLine cterm=NONE ctermbg=81
elseif (&t_Co == 256)
    highlight CursorLine cterm=NONE ctermbg=237
    highlight Folded cterm=NONE ctermbg=239
    highlight SignColumn ctermbg=234
    highlight LineNr ctermfg=lightyellow ctermbg=234
    highlight SpecialKey ctermfg=darkgray
else
    highlight CursorLine cterm=NONE ctermbg=darkgray
endif


" file browser
let g:netrw_liststyle=3             " tree style listing
let g:netrw_banner=0                " suppress banner on top
"let g:netrw_browse_split=3         " open files in new tab
let g:netrw_list_hide='^\..*$'      " don't show hidden files


" key mappings
nnoremap    <silent> <SPACE>        :nohlsearch<CR>
nmap        tn                      :tabnew<CR>
nmap        tc                      :tabclose<CR>
noremap     <silent> <F3>           :BufExplorerHorizontalSplit<CR>
nnoremap    <silent> <F4>           :TagbarToggle<CR>
nnoremap    <silent> <F6>           :SyntasticCheck<CR>

" disable arrow keys
noremap     <Up>                    <Nop>
noremap     <Down>                  <Nop>
noremap     <Left>                  <Nop>
noremap     <Right>                 <Nop>

" different keycodes in urxvt
nmap        <ESC>[5^                <C-PageUp>
nmap        <ESC>[6^                <C-PageDown>


" folding settings;  disabled for now because of performance problems
"set foldmethod=syntax              " fold automatically by syntax rules
"set foldlevel=0                    " fold from top level
"set foldnestmax=1                  " fold only 1 level
"let perl_fold=1
"let perl_nofold_packages=0

" BufExplorer settings
let g:bufExplorerSplitHorzSize=15
let g:bufExplorerSplitVertSize=40
let g:bufExplorerDefaultHelp=0
let g:bufExplorerShowNoName=1

" airline settings
let g:airline_theme='wombat'
let g:airline#extensions#whitespace#enabled=0

" Syntastic settings
let g:syntastic_check_on_wq=0           " don't check when closing buffers
let g:syntastic_aggregate_errors=1      " run every checker
let g:syntastic_mode_map = { 'mode': 'passive' }

" neocomplete settings
let g:neocomplete#enable_at_startup=1

" vim: set et:sw=4:sts=4