forked from aleks/vim-dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
196 lines (157 loc) · 5.33 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
" Plugins
call plug#begin('~/.vim/plugged')
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
" Interface
Plug 'bling/vim-airline'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
Plug 'wesQ3/vim-windowswap'
Plug 'nathanaelkane/vim-indent-guides'
Plug 'easymotion/vim-easymotion'
" Fuzzy Finders
Plug 'ctrlpvim/ctrlp.vim'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
" Tools
Plug 'tpope/vim-eunuch'
Plug 'tpope/vim-surround'
Plug 'jiangmiao/auto-pairs'
Plug 'vim-scripts/tComment'
Plug 'junegunn/vim-easy-align'
" App Integration
Plug 'tpope/vim-fugitive'
Plug 'mileszs/ack.vim'
Plug 'rizzatti/dash.vim' " Mac only!
" Ruby / Rails
Plug 'tpope/vim-bundler'
Plug 'tpope/vim-rails'
Plug 'tpope/vim-endwise'
Plug 'thoughtbot/vim-rspec'
Plug 'slim-template/vim-slim'
Plug 'asux/vim-capybara'
" Jekyll
Plug 'csexton/jekyll.vim'
Plug 'junegunn/goyo.vim' " Distraction-free writing in Vim.
" Syntax
Plug 'scrooloose/syntastic'
Plug 'kchmck/vim-coffee-script', { 'for': 'coffee' }
" Snippets
Plug 'MarcWeber/vim-addon-mw-utils' | Plug 'tomtom/tlib_vim' | Plug 'garbas/vim-snipmate'
Plug 'honza/vim-snippets'
call plug#end()
" Plugins end
" Leader
let mapleader = ","
" EasyMotion
" <Leader>f{char} to move to {char}
map <Leader>f <Plug>(easymotion-bd-f)
nmap <Leader>f <Plug>(easymotion-overwin-f)
" Move to word
map <Leader>w <Plug>(easymotion-bd-w)
nmap <Leader>w <Plug>(easymotion-overwin-w)
" s{char}{char} to move to {char}{char}
nmap s <Plug>(easymotion-overwin-f2)
" Show register
map ; :reg<CR>
" Settings
set backspace=2 " Backspace deletes like most programs in insert mode
set nocompatible " Use Vim settings, rather then Vi settings
set nobackup
set nowritebackup
set noswapfile " http://robots.thoughtbot.com/post/18739402579/global-gitignore#comment-458413287
set history=50
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set incsearch " do incremental searching
set laststatus=2 " Always display the status line
set autowrite " Automatically :write before running commands
set hlsearch " highlight search
set number " show linenumbers
set numberwidth=4 " linenumbers width
set tabstop=2
set shiftwidth=2
set expandtab
set list listchars=tab:»·,trail:· " Display extra whitespace
set laststatus=2 " Always display the status line, even if only one window is displayed
" Function Keys
set pastetoggle=<F9> " Toggle paste mode with F9
map <F10> :Dash<CR> " Map Dash.app Search to F9
nnoremap <F11> :set nonumber!<CR> " Toggle linenumbers
map <F12> :NERDTreeToggle<CR> " Toggle NERDTree
map <F7> :Goyo<CR> " Toggle Goyo (distraction-free writing)
" Switch syntax highlighting on, when the terminal has colors
if (&t_Co > 2 || has("gui_running")) && !exists("syntax_on")
syntax on
endif
filetype plugin indent on
" Color scheme
highlight NonText guibg=#060606
highlight Folded guibg=#0A0A0A guifg=#9090D0
" Show register
map ; :reg<CR>
" Quick window resizing
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-h> <C-w>h
nnoremap <C-l> <C-w>l
" Resize splits
nnoremap <C-k> <C-w>+
nnoremap <C-j> <C-w>-
nnoremap <C-l> <C-w><
nnoremap <C-h> <C-w>>
" Switch between the last two files inside a buffer
" nnoremap <leader><leader> <c-^>
" Moving splits (with vim-windowswap)
let g:windowswap_map_keys = 0 "prevent default bindings
nnoremap <C-w>m :call WindowSwap#EasyWindowSwap()<CR>
"Clear current search highlight by double tapping //
nmap <silent> // :nohlsearch<CR>
" NERDTree
let g:NERDTreeWinSize = 40
let NERDTreeDirArrows = 1
" FZF / fzf.vim
nmap <Leader>t :FZF<CR>
nnoremap <silent> <Leader><Enter> :Buffers<CR>
" Ctrlp
let g:ctrlp_map = ',p'
let g:ctrlp_working_path_mode = 'ra'
set wildignore+=*/tmp/*,*.so,*.swp,*.zip
let g:ctrlp_custom_ignore = {
\ 'dir': '\.git$\|\.hg$\|\.svn$\|\.yardoc\|public\/images\|public\/system\|data\|log\|tmp$',
\ 'file': '\.exe$\|\.so$\|\.dat$'
\ }
" RSpec.vim mappings
map <Leader>c :call RunCurrentSpecFile()<CR>
map <Leader>s :call RunNearestSpec()<CR>
map <Leader>l :call RunLastSpec()<CR>
map <Leader>a :call RunAllSpecs()<CR>
" JsBeautifier
map <c-f> :call JsBeautify()<cr>
" Treat <li> and <p> tags like the block tags they are
let g:html_indent_tags = 'li\|p'
" Configure syntastic syntax checking to check on open as well as save
let g:syntastic_check_on_open=1
" Airline
let g:airline_powerline_fonts = 1
if !exists('g:airline_symbols')
let g:airline_symbols = {}
endif
let g:airline_left_sep = '⮀'
let g:airline_left_alt_sep = '⮁'
let g:airline_right_sep = '⮂'
let g:airline_right_alt_sep = '⮃'
let g:airline_symbols.branch = '⭠'
let g:airline_symbols.readonly = '⭤'
let g:airline_symbols.linenr = '⭡'
let g:airline_symbols.branch = '⎇'
let g:airline_symbols.paste = 'ρ'
let g:airline_symbols.paste = 'Þ'
let g:airline_symbols.paste = '∥'
let g:airline_symbols.whitespace = 'Ξ'
" Snippets
let g:snipMate = {}
let g:snipMate.scope_aliases = {}
let g:snipMate.scope_aliases['ruby'] = 'ruby,rails'
" Load local settings from vimrc_local
if filereadable( expand("$HOME/vim-dotfiles/vimrc_local") )
source ~/vim-dotfiles/vimrc_local
endif