forked from FreekingDean/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
211 lines (166 loc) · 5.69 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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
if !has('nvim') " vim specific vs neovim below
set nocompatible " be iMproved
" install Vim-plug if not installed
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
endif
if has('nvim')
set mouse-=a " not ready for mouse use yet
if empty(glob('~/.local/share/nvim/site/autoload/plug.vim'))
silent !curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
endif
let s:darwin = has('mac')
call plug#begin('~/.vim/plugged')
Plug 'scrooloose/nerdtree'
Plug 'jistr/vim-nerdtree-tabs', {'on': 'NERDTreeToggle'}
Plug 'vim-airline/vim-airline'
Plug 'airblade/vim-gitgutter'
Plug 'ryanoasis/vim-devicons'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-surround'
"Plug 'scrooloose/syntastic'
Plug 'neomake/neomake'
Plug 'airblade/vim-gitgutter'
Plug 'mileszs/ack.vim'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'majutsushi/tagbar'
Plug 'tomlion/vim-solidity', {'for': 'sol'}
Plug 'tpope/vim-rails', {'for': 'ruby'}
Plug 'tpope/vim-haml', {'for': 'haml'}
Plug 'janko-m/vim-test', {'for': 'ruby'}
Plug 'keith/rspec.vim', {'for': 'ruby'}
Plug 'kchmck/vim-coffee-script'
Plug 'hashivim/vim-terraform', {'for': ['tf', 'terraform']}
Plug 'emilyst/vim-xray'
Plug 'pangloss/vim-javascript', {'for': ['js', 'jsx', 'ruby']}
Plug 'chemzqm/vim-jsx-improve', {'for': ['jsx']}
"Plug 'mxw/vim-jsx', {'for': ['js', 'jsx']}
Plug 'MaxMEllon/vim-jsx-pretty', {'for': ['js', 'jsx']}
Plug 'fatih/vim-go', {'for': 'go', 'do': ':GoUpdateBinaries' }
Plug 'elixir-lang/vim-elixir', {'for': 'elixer'}
"if s:darwin
Plug 'fielding/vim-chunkwm-navigator'
Plug 'junegunn/vim-xmark'
"endif
" https://github.com/junegunn/dotfiles/blob/master/vimrc
function! BuildYCM(info)
if a:info.status == 'installed' || a:info.force
!./install.py --all
endif
endfunction
"Plug 'Valloric/YouCompleteMe', { 'do': function('BuildYCM') }
Plug 'OmniSharp/omnisharp-vim'
" note taking and writing
Plug 'rhysd/vim-grammarous', { 'for': ['text', 'markdown'] }
Plug 'beloglazov/vim-online-thesaurus', { 'for': ['text', 'markdown'] }
call plug#end()
filetype plugin indent on " required
let g:airline_powerline_fonts = 1
"nerdtree starts always open
autocmd VimEnter * NERDTree
autocmd VimEnter * wincmd p
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | en
" ctags optimization
"set autochdir
"set tags=tags;
set lazyredraw
set regexpengine=1
set ttyfast
syntax enable
set nohlsearch
set nu
set ts=2
set shiftwidth=2
set autoindent
set smarttab
set expandtab
autocmd FileType solidity setlocal shiftwidth=4 ts=4
autocmd FileType go setlocal noexpandtab
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
set showmatch
set encoding=utf-8
set laststatus=2
"set term=screen-256color
set clipboard=unnamed
"disable arrow keys / ctrl + hjkl window swap
map <up> <nop>
map <down> <nop>
map <left> <nop>
map <right> <nop>
map <C-h> <C-w>h
map <C-j> <C-w>j
map <C-k> <C-w>k
map <C-l> <C-w>l
map <C-K> <C-W>k<C-W>_
map <C-K> <C-W>j<C-W>_
"map <C-d> gf
"map <C-e> :A<CR>
"map <C-c> :R<CR>
"set number
set relativenumber
"Map ;; to <Esc>:'
imap ;; <Esc>:
map ;; <Esc>:
if has('gui_running')
set guifont=Inconsolata:h13 " set fonts for gui vim
"set transparency=5 " set transparent window
set guioptions=egmrt " hide the gui menubar
endif
"Highlight trailing whitespace in red
:highlight ExtraWhitespace ctermbg=red guibg=red
:au InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
:au InsertLeave * match ExtraWhitespace /\s\+$/
:match ExtraWhitespace /\s\+$/ " Show trailing whitespace
:match ExtraWhitespace /\s\+$\| \+\ze\t/ " Show trailing whitespace and spaces before a tab
:match ExtraWhitespace /[^\t]\zs\t\+/ " Show tabs that are not at the start of a line
"Add commands for sudo write
" :command SudoWrite w !sudo sh -c "cat >'%'"
"Auto Rspec on <,+t>
let mapleader=","
" RSpec.vim mappings
map <Leader>t :TestFile<CR>
map <Leader>g :TestNearest<CR>
map <Leader>l :TestLast<CR>
map <Leader>a :TestSuite<CR>
map <Leader>b :Tagbar<CR>
nmap <silent> <leader>c :Gstatus<cr>
nnoremap <leader>. :CtrlPTag<cr>
"Run go prgm on <,+g+r>
map<leader>gr :w\|!go run %<cr>
"Run ruby prgm on <,+g+r>
map<leader>rr :w\|!ruby %<cr>
au BufRead,BufNewFile *.pde set filetype=arduino
au BufRead,BufNewFile *.ino set filetype=arduino
au BufRead,BufNewFile *.go set filetype=go
au BufRead,BufNewFile *.tl set filetype=turlang
"set rtp+=/home/bananaboy/.local/lib/python2.7/site-packages/powerline/bindings/vim
let spring_exists = system('spring -v')
"Spring rspec
"let g:rspec_command = '!spring rspec {spec}'
let g:rspec_command = '!RAILS_ENV=test bundle exec rspec {spec} --color --profile'
nmap \ :Ack!
"Vim-Tmux split nav
let g:chunkwm_navigator_no_mappings = 1
nnoremap <silent> <C-w>h :ChunkwmNavigateLeft<cr>
nnoremap <silent> <C-w>j :ChunkwmNavigateDown<cr>
nnoremap <silent> <C-w>k :ChunkwmNavigateUp<cr>
nnoremap <silent> <C-w>l :ChunkwmNavigateRight<cr>
nnoremap <C-w>r :source $HOME/.vimrc<cr>
nnoremap <C-w><C-w> :tabp<cr>
map <C-w>c :tabe <bar> :term<cr>
nnoremap <C-w>r :source $HOME/.vimrc<cr>
nnoremap <C-w>z <C-w><bar><C-w>_
" Set swapfiles to homedir
set directory=$HOME/.vim/swapfiles//
"Let <Esc> return to normal mode in term
tnoremap <Esc> <C-\><C-n>
colorscheme delek
"Get the 2-space YAML as the default when hit carriage return after the colon
set omnifunc=syntaxcomplete#Complete
call neomake#configure#automake('w')