aboutsummaryrefslogtreecommitdiffstats
path: root/vimrc
blob: a3dc7dce9abc7d8c57302c768a2b32ab85eb7337 (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
" vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4

if &compatible
    set nocompatible
endif

" Paths
set directory=$XDG_CACHE_HOME/vim,~/,/tmp
set backupdir=$XDG_CACHE_HOME/vim,~/,/tmp
set viminfo+=n$XDG_CACHE_HOME/vim/viminfo
set runtimepath=$XDG_CONFIG_HOME/vim,$XDG_CONFIG_HOME/vim/after,$VIM,$VIMRUNTIME
let $MYVIMRC="$XDG_CONFIG_HOME/vim/vimrc"

" Plugins
" After plugins changes remember to run  :call dein#install()
set runtimepath+=~/.vim/dein/repos/github.com/Shougo/dein.vim
call dein#begin(expand('~/.vim/dein'))
call dein#add('Shougo/dein.vim')
call dein#add('majutsushi/tagbar')
call dein#add('scrooloose/nerdtree',
    \{'on_cmd': 'NERDTreeToggle'})
call dein#add('justmao945/vim-clang',
    \{'on_ft': ['c', 'cpp']})
call dein#end()

filetype plugin indent on
syntax enable

" Plugins config
let g:clang_c_options = '-std=gnu11'
let g_clang_cpp_options = '-std=c++11 -stdlib=libc++'

" Encoding
set encoding=utf-8
set fileencoding=utf-8
set termencoding=utf-8

" Misc
set paste                       " setting good paste
set colorcolumn=79              " highlight 80 characters limit

" Whitespace
set nowrap                      " don't wrap lines
set tabstop=4 shiftwidth=4      " a tab is four spaces
set expandtab                   " use spaces instead of tabs
set backspace=indent,eol,start  " backspace through everything in insert mode

" Style
colorscheme tomorrow_night      " set color scheme
set relativenumber              " setting line numbers
set ruler                       " show column number
set laststatus=2                " always show the status line

" Searching
set hlsearch                    " highlight matches
set incsearch                   " incremental searching
set ignorecase                  " search are case-insensitive
set smartcase                   " enable case-sensitivity if the pattern
                                " contains a capital letter

" Key bindings
nmap <F2> :NERDTreeToggle<CR>   " toggle file browser with F2
nmap <F8> :TagbarToggle<CR>     " toggle tags browser with F8

" Highlight extra whitespaces
highlight ExtraWhitespace ctermbg=red 
autocmd Syntax * syn match ExtraWhitespace /\s\+$\| \+\ze\t/

" Python files
autocmd BufRead,BufNewFile *.py :setlocal
	\ tabstop=4
	\ softtabstop=4
	\ shiftwidth=4
	\ textwidth=79
	\ expandtab
	\ autoindent
	\ fileformat=unix

" Shell scripts
autocmd BufRead,BufNewFile *.sh,*.ksh,*.csh :setlocal
	\ tabstop=2
	\ softtabstop=2
	\ shiftwidth=2
	\ textwidth=79
	\ expandtab
	\ autoindent
	\ fileformat=unix

" Web files: JavaScript, HTML and CSS
autocmd BufRead,BufNewFile *.js,*.html,*.css :setlocal
	\ tabstop=2
	\ softtabstop=2
	\ shiftwidth=2
	\ expandtab