-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnvimrc
194 lines (150 loc) · 4.8 KB
/
nvimrc
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
" Author: Mitchell Barron
set nocompatible " be iMproved, required
filetype off " required
let g:python2_host_prog = '/usr/local/bin/python'
let g:python3_host_prog = '/usr/local/bin/python3'
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
Plugin 'altercation/vim-colors-solarized'
Plugin 'scrooloose/nerdtree'
Plugin 'kien/ctrlp.vim'
Plugin 'christoomey/vim-tmux-navigator'
Plugin 'Lokaltog/vim-easymotion'
Plugin 'tpope/vim-surround'
" Plugin 'w0rp/ale' " Async lint engine
Plugin 'airblade/vim-gitgutter'
Plugin 'tmux-plugins/vim-tmux-focus-events' " restores focus event, allowing better gitgutter func.
" Improved sytax highlighting for modern web.
Plugin 'pangloss/vim-javascript'
Plugin 'mxw/vim-jsx'
Plugin 'digitaltoad/vim-pug.git'
" All of your Plugins must be added before the following line
call vundle#end()
"-----------------------------------------------------------
" Plugin configuration
" vim-jsx config (enhanced react highlighting)
let g:jsx_ext_required = 1 " only allow jsx highlighting in .jsx files.
" vim-javascript config (enhanced js highlighting)
let g:javascript_enable_domhtmlcss = 1 " Enable html/css syntax in js files
" ctrlp config
let g:ctrlp_show_hidden = 1
let g:ctrlp_custom_ignore = {
\ 'dir': 'node_modules\|DS_Store\|.git\|.meteor',
\ 'file': '\v\.(exe|so|dll|swp)$',
\ 'link': '',
\ }
" NERDTree config
" Close NERDTree if it's the only window in current tab
let g:ctrlp_dont_split = 'NERD'
let NERDTreeShowHidden=1
let NERDTreeShowLineNumbers=1
let NERDTreeIgnore = ['.swp']
let NERDTreeQuitOnOpen=1 " Automatically closes NERDTree upon file selection
" Disallow NERDTree from remapping C-j/k. This was conflicting with tmux/vim
" split navigation.
let g:NERDTreeMapJumpNextSibling = '<Nop>'
let g:NERDTreeMapJumpPrevSibling = '<Nop>'
"Close NERDTree if it is the last open buffer
autocmd WinEnter * call s:CloseIfOnlyNerdTreeLeft()
" Close all open buffers on entering a window if the only
" buffer that's left is the NERDTree buffer
function! s:CloseIfOnlyNerdTreeLeft()
if exists("t:NERDTreeBufName")
if bufwinnr(t:NERDTreeBufName) != -1
if winnr("$") == 1
q
endif
endif
endif
endfunction
" Easymotion config
let g:Easymotion_do_mapping = 0 " Disable default bindings.
hi EasyMotionTarget ctermbg=none ctermfg=1
hi EasyMotionShade ctermbg=none ctermfg=236
hi link EasyMotionTarget2First Search
hi link EasyMotionTarget2Second Search
hi EasyMotionMoveHL ctermbg=green ctermfg=black
" Gitgutter
" Disables gg's bindings
let g:gitgutter_map_keys = 0
" this is not specifically a gitgutter option, but it improves the responsiveness of gutter sign
" updates
set updatetime=100
"------------------------------------------------------------
" Basic Functionality
filetype indent plugin on
colorscheme solarized
if $ITERM_PROFILE == 'Dark'
set background=dark
else
set background=light
endif
syntax on
set colorcolumn=100
set wildmenu
set showcmd
set hlsearch
set relativenumber
" Use case insensitive search, except when using capital letters
set ignorecase
set smartcase
" Allow backspacing over autoindent, line breaks and start of insert action
set backspace=indent,eol,start
set autoindent
set nostartofline
set ruler
set laststatus=2
set confirm
set visualbell
set t_vb= " Disable bell notifications
set mouse=a
set number
" Quickly time out on keycodes, but never time out on mappings
set notimeout ttimeout ttimeoutlen=200
" Use <F11> to toggle between 'paste' and 'nopaste'
set pastetoggle=<F11>
set lazyredraw
" Folding
set foldenable " enable folding
set foldlevelstart=10 " open most folds by default
set foldnestmax=10 " 10 nested fold max
set foldmethod=indent " fold based on indent level
" Disable character hiding, specifically because double quotes were being
" hidden in json files.
set conceallevel=0
" Unite system and vim clipboard
set clipboard=unnamed
" Navigate by screen lines, prevents skipping wrapped lines
nnoremap j gj
nnoremap k gk
vnoremap j gj
vnoremap k gk
"------------------------------------------------------------
" Indentation options
set tabstop=2
set shiftwidth=2
set softtabstop=2
set expandtab
"------------------------------------------------------------
" Mappings
" ALMIGHTY SPACEBAR LEADER
nnoremap <Space> <NOP>
let mapleader=" "
nnoremap <return> :nohlsearch<return><esc>
" Map Y to act like D and C, i.e. to yank until EOL, rather than act as yy,
" which is the default
map Y y$
" jk / kj to leave insert
inoremap jk <Esc>
inoremap kj <Esc>
" Rebind vim splits to resemble tmux
map <leader>" <C-W>s
map <leader>% <C-W>v
" Plugin Mappings
map <Leader>n :NERDTreeToggle<CR>
nmap <Leader>f <plug>(easymotion-s)
let g:ctrlp_map = '<Leader>p'
let g:ctrlp_cmd = 'CtrlP'