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
|
" 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('benmills/vimux')
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
" Fix performance issue with long lines
set synmaxcol=200
" Plugins config
let g:clang_c_options = '-std=gnu11'
let g_clang_cpp_options = '-std=c++11 -stdlib=libc++'
let g:VimuxHeight = "10"
let g:VimuxOrientation = "v"
let g:VimuxPromptString = ":!"
" 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
" - toggle file browser with F2
nmap <F2> :NERDTreeToggle<CR>
" - run command using vimux with F3
nmap <F3> :VimuxPromptCommand<CR>
" - rerun last command using vimux with F4
nmap <F4> :VimuxRunLastCommand<CR>
" - toggle tags browser with F8
nmap <F8> :TagbarToggle<CR>
" Highlight extra whitespaces
highlight ExtraWhitespace ctermbg=red
autocmd Syntax * syn match ExtraWhitespace /\s\+$\| \+\ze\t/
" Workaround for tmux paging issue
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
" 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
|