-
Notifications
You must be signed in to change notification settings - Fork 1
/
.vimrc
201 lines (160 loc) · 5.58 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
set nocompatible " be iMproved, required
filetype off " required
" vim-plug autoconfig if not already installed
if empty(glob('~/.config/nvim/autoload/plug.vim'))
silent !curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall | nested source $MYVIMRC
endif
call plug#begin('~/.vim/plugged')
Plug 'tpope/vim-fugitive' " Git
Plug 'gorkunov/smartpairs.vim'
Plug 'sheerun/vim-polyglot'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-vinegar'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-endwise'
Plug 'tpope/vim-eunuch'
Plug 'plasticboy/vim-markdown', { 'for': 'markdown' }
Plug 'vim-ruby/vim-ruby'
Plug 'tpope/vim-rails'
Plug 'mileszs/ack.vim'
Plug 'christoomey/vim-tmux-navigator'
Plug 'bronson/vim-trailing-whitespace'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'rakr/vim-one'
Plug 'junegunn/fzf'
Plug 'rust-lang/rust.vim'
Plug 'dense-analysis/ale'
Plug 'junegunn/goyo.vim'
Plug 'junegunn/limelight.vim'
Plug 'jxnblk/vim-mdx-js'
if has('nvim')
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
else
Plug 'Shougo/deoplete.nvim'
Plug 'roxma/nvim-yarp' " deoplete dependency
Plug 'roxma/vim-hug-neovim-rpc' " deoplete dependency
endif
Plug 'deoplete-plugins/deoplete-tag'
if has('nvim')
Plug 'bfredl/nvim-miniyank'
endif
call plug#end()
syntax enable
set encoding=utf-8
set showcmd " display incomplete commands
"" Whitespace
set nowrap " don't wrap lines
set tabstop=2 shiftwidth=2 " a tab is two spaces (or set this to 4)
set expandtab " use spaces, not tabs (optional)
set backspace=indent,eol,start " backspace through everything in insert mode
"" Searching
set hlsearch " highlight matches
set incsearch " incremental searching
set ignorecase " searches are case insensitive...
set smartcase " ... unless they contain at least one capital letter
"" Misc
set number " show line numbers
set wildignore+=*.o,*.obj,.git,*.rbc,*.class,.svn,vendor/gems/*,tmp/**,public/system/**,public/uploads/**,public/assets/**,site_media/m/**,build/**
set ls=2 " always display filename
" Prevent Vim from clobbering the scrollback buffer. See
" http://www.shallowsky.com/linux/noaltscreen.html
set t_ti= t_te=
set scrolloff=3 " keep more context when scrolling off the end of a buffer
set ttimeoutlen=10 " Set ESC lag to 100ms
set clipboard=unnamed " User system clipboard
set noshowmode " Don't show -- INSERT --
set lazyredraw " Buffer screen updates
set hidden " Disable No write since last change messages
set noerrorbells " STFU
" Don't create backups
set noswapfile
set nobackup
set nowb
set fillchars+=vert:\|
let g:ackprg = 'ag --vimgrep --smart-case --hidden'
cnoreabbrev ag Ack
" Bubble single lines
nmap <C-Up> ddkP
nmap <C-Down> ddp
" Bubble multiple lines
vmap <C-Up> xkP`[V`]
vmap <C-Down> xp`[V`]
set background=dark
colorscheme codeschool
let g:airline_theme='serene'
let g:airline_powerline_fonts = 1
let g:airline#extensions#disable_rtp_load = 1
" Cursor type setup
let &t_SI = "\<Esc>]50;CursorShape=1\x7" " Insert mode
let &t_EI = "\<Esc>]50;CursorShape=0\x7" " Command mode
autocmd InsertEnter,InsertLeave * set cul! " Highlight current line in insert mode
" Use comma as a leader key
let mapleader=","
nnoremap <c-j> <c-w>j
nnoremap <c-k> <c-w>k
nnoremap <c-h> <c-w>h
nnoremap <c-l> <c-w>l
nnoremap <left> <c-w>5<
nnoremap <down> <c-w>5-
nnoremap <up> <c-w>5+
nnoremap <right> <c-w>5>
" Return unhighlights current search
nnoremap <CR> :nohlsearch<cr>
" Insert a hash rocket with <c-l>
imap <c-l> <space>=><space>
" Can't be bothered to understand ESC vs <c-c> in insert mode
imap <c-c> <esc>
" double percentage sign in command mode is expanded
" to directory of current file - http://vimcasts.org/e/14
cnoremap %% <C-R>=expand('%:h').'/'<cr>
augroup vimrcEx
" Clear all autocmds in the group
autocmd!
" Vim is an awesome notepad!
autocmd FileType text setlocal textwidth=100
augroup END
autocmd FileType markdown :set wrap linebreak nolist
function! s:goyo_enter()
if executable('tmux') && strlen($TMUX)
silent !tmux set status off
silent !tmux list-panes -F '\#F' | grep -q Z || tmux resize-pane -Z
endif
set noshowmode
set noshowcmd
set wrap linebreak nolist
" Limelight
endfunction
function! s:goyo_leave()
if executable('tmux') && strlen($TMUX)
silent !tmux set status on
silent !tmux list-panes -F '\#F' | grep -q Z && tmux resize-pane -Z
endif
set showmode
set showcmd
" Limelight!
endfunction
autocmd! User GoyoEnter nested call <SID>goyo_enter()
autocmd! User GoyoLeave nested call <SID>goyo_leave()
let g:limelight_conceal_ctermfg = 240
let g:goyo_width = 100
let g:deoplete#enable_at_startup = 1
let g:deoplete#tag#cache_limit_size = 10000000
set omnifunc=ale#completion#OmniFunc
let g:ale_linters = {
\ 'ruby': ['rubocop', 'ruby'],
\}
let g:ale_lint_on_text_changed = 0
let g:vim_markdown_folding_disabled=1
au VimResized * :wincmd = " Resize panes when terminal resizes
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif " Split panes proportionally
map <Leader>t :FZF<CR>
let g:ruby_path = system('echo $HOME/.rbenv/shims')
:let $NVIM_TUI_ENABLE_CURSOR_SHAPE=1
if has('nvim')
map p <Plug>(miniyank-autoput)
map P <Plug>(miniyank-autoPut)
endif
let g:rustfmt_autosave = 1