-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
121 lines (104 loc) · 3.21 KB
/
vimrc
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
121
" Plugins ---------------
call plug#begin('~/.vim/plugged')
Plug 'kien/ctrlp.vim'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-commentary'
Plug 'gabesoft/vim-ags'
Plug 'mustache/vim-mustache-handlebars'
" Colorschemes
Plug 'NLKNguyen/papercolor-theme'
call plug#end()
" General --------------
syntax enable
set modelines=0 " security see http://www.techrepublic.com/blog/security/turn-off-modeline-support-in-vim/4476
set guioptions-=T " disable toolbar
set guifont=Menlo\ Regular:h12
set background=light
colorscheme molokai
set history=500 " increase history
set laststatus=2 " statusline ftw
let mapleader = ','
set hidden " put buffer in background without write
set timeoutlen=10000 " extra long to notice overrides
set cpoptions+=$ " indicate end of change command with $ sign
set autoread " load changed files automatically
set encoding=utf-8
" Line numbers
set number
" set relativenumber
" Backup ---------------
set backupdir=~/dotfiles/vim/tmp,.
set directory=~/dotfiles/vim/tmp,.
" Searching ------------
set ignorecase " ignore case when everything is lowercase
set smartcase " case sensitive when there is a capital letter
set hlsearch " highlight
" Wildmode
set wildmode=list:longest " terminal like tab completion
set wildignore+=.git,.hg " ignore version control directories
set wildignore+=*.class,*.jar " java stuff
set wildignore+=node_modules " vendored stuff
" ctrlp settings
let g:ctrlp_switch_buffer = 'e' " never switch tabs
let g:ctrlp_custom_ignore = {
\ 'dir': '.rsync_cache$\|coverage$\|log$\|tmp$\|spec/cassettes$'
\ }
" Tabs -----------------
set expandtab
set tabstop=2
set shiftwidth=2
set softtabstop=2
set autoindent
" Invisible ------------
set list
nmap <leader>l :set list!<CR> " toogle set list
set listchars=tab:▸\ ,eol:¬ " show tabs and eol
" highlight trailing whitespace
highlight ExtraWhitespace ctermbg=red guibg=red
autocmd ColorScheme * highlight ExtraWhitespace ctermbg=red guibg=red
autocmd BufWinEnter * match ExtraWhitespace /\s\+$/
" the above flashes annoyingly while typing, be calmer in insert mode
autocmd InsertLeave * match ExtraWhitespace /\s\+$/
autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
function! TrimWhiteSpace()
%s/\s\+$//e
endfunction
" Mappings -------------
" disable arrow keys
inoremap <Up> <NOP>
inoremap <Down> <NOP>
inoremap <Left> <NOP>
inoremap <Right> <NOP>
noremap <Up> <NOP>
noremap <Down> <NOP>
noremap <Left> <NOP>
noremap <Right> <NOP>
" hard mode
" noremap h <NOP>
" noremap j <NOP>
" noremap k <NOP>
" noremap l <NOP>
" alternativ exit insert mode
inoremap jj <Esc>
nnoremap gp `[v`] " reselect paste
" for vim-rspec-focus
:nnoremap <leader>t :AddFocusTag<CR>
:nnoremap <leader>r :RemoveAllFocusTags<CR>
" Statusline -----------
if has("statusline")
set statusline=%<%f\ %h%m%r%=%{\"[\".(&fenc==\"\"?&enc:&fenc).((exists(\"+bomb\")\ &&\ &bomb)?\",B\":\"\").\"]\ \"}%k\ %-14.(%l,%c%V%)\ %P
endif
" File Types -----------
autocmd Filetype gitcommit setlocal spell textwidth=72
autocmd FileType python setlocal shiftwidth=4 softtabstop=4 expandtab
" maybe -----
" " Don't move on */#
" noremap * *<c-o>
" noremap # #<c-o>
"
" " Scrolling
" set scrolloff=3
"
" let g:netrw_liststyle=3
" let g:netrw_preview=1