-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
194 lines (141 loc) · 3.76 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
set nocompatible
filetype off
"{{{managed plugins with dein
set rtp^=~/.config/nvim/repos/github.com/Shougo/dein.vim
call dein#begin(expand('~/.cache/dein'))
call dein#add('Shougo/dein.vim')
call dein#add('Shougo/deoplete.nvim')
" Files and buffers
call dein#add('junegunn/fzf', { 'build': './install --all', 'merged': 0 })
call dein#add('junegunn/fzf.vim', { 'depends': 'fzf' })
call dein#add('jlanzarotta/bufexplorer')
call dein#add('scrooloose/nerdtree')
call dein#add('tpope/vim-eunuch')
call dein#add('rking/ag.vim')
call dein#add('christoomey/vim-tmux-navigator')
call dein#add('bling/vim-airline')
call dein#add('jiangmiao/auto-pairs')
call dein#add('scrooloose/syntastic')
call dein#add('scrooloose/nerdcommenter')
" Syntax and highlight
call dein#add('Valloric/MatchTagAlways')
" Git
call dein#add('tpope/vim-fugitive')
call dein#add('airblade/vim-gitgutter')
" JavaScript
call dein#add('marijnh/tern_for_vim')
call dein#add('jelera/vim-javascript-syntax')
call dein#add('pangloss/vim-javascript')
call dein#add('elzr/vim-json')
call dein#end()
if dein#check_install()
call dein#install()
endif
"}}}
"{{{Misc Settings
filetype plugin indent on
set encoding=utf-8
set showcmd
set showmode
set autoindent
set backspace=indent,eol,start
" Spaces instead of tabs
set expandtab
set smarttab
set shiftwidth=2
set softtabstop=2
" Completion.
set ofu=syntaxcomplete#Complete
set completeopt=longest,menuone
" Tab completion.
set wildmenu
set wildmode=list:longest,full
" Enable mouse support.
set mouse=a
" Clipboard! Should work on OSX with 7.3+
set clipboard=unnamed
" Searches.
set ignorecase
set smartcase
set incsearch
set hidden
set history=50
set wildignore+=*/tmp/*,*.so,*.swp,*.swo,*.zip
" }}}
"{{{Look and Feel
syntax enable
colorscheme slate
set showmatch
set number
set ruler
set laststatus=2 statusline=%02n:%<%f\ %h%m%r%=%{fugitive#statusline()}\ %{SyntasticStatuslineFlag()}\ %-8.(%l,%c%V%)\ %P
hi StatusLine ctermfg=Gray
hi StatusLine ctermbg=Red
" }}}
"{{{ Mappings
let mapleader=","
" Toggle line numbers.
nnoremap <C-N> :set number!<CR>
" Moving around mah split'd windows.
map <C-J> <C-W>j
map <C-K> <C-W>k
map <C-H> <C-W>h
map <C-L> <C-W>l
map <C-F5> <C-W>_<C-W><Bar>
" fzf
nnoremap <C-P> :FZF<CR>
" Create Blank Newlines and stay in Normal mode
nnoremap <silent> zj o<Esc>
nnoremap <silent> zk O<Esc>
" auto indent when paste
nnoremap >< V`]>
nnoremap <lt>> V`]<
nnoremap =- V`]=
" Space will toggle folds.
nnoremap <space> za
" Search mappings: These will make it so that going to the next match
" will center on the line it's found in.
map N Nzz
map n nzz
nnoremap <F3> :cn<CR>
nnoremap <F4> :cp<CR>
" <TAB>: completion.
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>""
" }}}
"{{{Autocmd
" Remove trailing whitespace
function! StripTrailingWhitespace()
normal mZ
let l:chars = col("$")
%s/\s\+$//e
if (line("'Z") != line(".")) || (l:chars != col("$"))
echo "Trailing whitespace stripped\n"
endif
normal `Z
endfunction
autocmd BufWritePre * :call StripTrailingWhitespace()
" Automatically cd into the directory that the file is in
" autocmd BufEnter * execute "chdir ".escape(expand("%:p:h"), ' ')
"{{{Filetypes
autocmd FileType ruby setlocal softtabstop=2 shiftwidth=2
function! MyBufEnter()
" don't (re)store filepos for git commit message files
if &filetype == "gitcommit"
call setpos('.', [0, 1, 1, 0])
endif
endfunction
au BufEnter * call MyBufEnter()
" }}}
" }}}
"{{{Plugin settings
let g:bufExplorerSortBy='fullpath' " Sort by full file path name.
let g:bufExplorerShowRelativePath=1 " Show relative paths.
let g:bufExplorerSplitOutPathName=0
let g:syntastic_check_on_open=1
" Disable AutoComplPop.
let g:acp_enableAtStartup=1
" Use deoplete.
let g:deoplete#enable_at_startup = 1
inoremap <M-o> <Esc>o
inoremap <C-j> <Down>
" }}}