-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
205 lines (164 loc) · 4.13 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
unlet! skip_defaults_vim
source $VIMRUNTIME/defaults.vim
set exrc
set autoindent
set si
set shiftwidth=4
set relativenumber
colorscheme monokai
" Don't try to be vi compatible
set nocompatible
au BufEnter /private/tmp/crontab.* setl backupcopy=yes
set ft=html.javascript
" Turn on syntax highlighting
syntax on
filetype plugin on
" Fuzzy find with no plugins
set path+=**
set wildmenu
" TODO: Pick a leader key
let mapleader = " "
" Security
set modelines=0
" Show line numbers
set number
" Show file stats
set ruler
" Blink cursor on error instead of beeping (grr)
set visualbell
" Encoding
set encoding=utf-8
" Whitespace
set wrap
set textwidth=160
"set formatoptions=tcqrn1
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
set smarttab
set noshiftround
" Insert Mapping
:imap jk <esc>
" Cursor motion
set scrolloff=3
set backspace=indent,eol,start
set matchpairs+=<:> " use % to jump between pairs
runtime! macros/matchit.vim
" Splitting
set splitbelow
set splitright
" Allow hidden buffers
set hidden
" Rendering
set ttyfast
" Status bar
set laststatus=2
" Last line
set showmode
set showcmd
" Searching
set hlsearch
set incsearch
set ignorecase
set smartcase
set showmatch
map <leader><space> :let @/=''<cr> " clear search
map <leader>n :sp<CR>
map <leader>v :vs<CR>
map <leader>x :q<CR>
nnoremap n nzzzv
nnoremap N Nzzzv
" Remap help key.
inoremap <F1> <ESC>:set invfullscreen<CR>a
nnoremap <F1> :set invfullscreen<CR>
vnoremap <F1> :set invfullscreen<CR>
" Eclim Settings/Config
set nocompatible
filetype plugin indent on
" Textmate holdouts
" Formatting
"map <leader>q gqip
" Visualize tabs and newlines
set listchars=tab:▸\ ,eol:¬
" Uncomment this to enable by default:
" set list " To enable by default
" Or use your leader key + l to toggle on/off
map <leader>l :set list!<CR> " Toggle tabs and EOL
call plug#begin('~/.vim/plugged')
" General
Plug 'scrooloose/nerdtree'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
Plug 'terryma/vim-multiple-cursors'
Plug 'Valloric/YouCompleteMe'
" Go
Plug 'fatih/vim-go', { 'tag': '*' }
" JS
"Plug 'ternjs/tern_for_vim', { 'do': 'npm install' }
Plug 'leafgarland/typescript-vim'
Plug 'moll/vim-node'
Plug 'pangloss/vim-javascript'
Plug 'scrooloose/syntastic'
Plug 'othree/html5.vim'
Plug 'leshill/vim-json'
Plug 'mustache/vim-mustache-handlebars'
Plug 'mattn/emmet-vim'
" Rust
Plug 'rust-lang/rust.vim'
" Git
Plug 'tpope/vim-fugitive'
call plug#end()
let g:fzf_command_prefix = ''
" TernJS html support
"set omnifunc=tern#Complete
"set ft=html.javascript_tern
set ft=html.javascript
map <leader>jh :NERDTreeToggle<CR>
map <leader>jj :NERDTreeFind<CR>
let g:javascript_plugin_jsdoc = 1
let g:syntastic_html_checkers = ['eslint']
let g:syntastic_javascript_checkers = ['eslint']
let g:syntastic_javascript_eslint_exe='$(npm bin)/eslint'
" reload vimrc whenever I save it
augroup reload_vimrc " {
autocmd!
autocmd BufWritePost vimrc,.vimrc,*.vim source $MYVIMRC
augroup END " }
" disable syntax highlighting on massive files
augroup big_files
autocmd!
autocmd Filetype * if (getfsize(@%) > 1000000) | setlocal syntax=OFF | endif
" autocmd Filetype * :echom "a"
augroup END
" Key Bindings
" insert mode shortcuts
" normal mode shortucts
:let mapleader = " "
:nmap <Leader><Leader> :w<Enter>
:nmap <Leader>sw "zyiw:Ag z
" FZF
" This is the default extra key bindings
let g:fzf_action = {
\ 'ctrl-t': 'tab split',
\ 'ctrl-x': 'split',
\ 'ctrl-v': 'vsplit' }
inoremap <expr> <c-x><c-f> fzf#vim#complete#path(
\ "find . -path '*/\.*' -prune -o -print \| sed '1d;s:^..::'",
\ fzf#wrap({'dir': expand('%:p:h')}))
nmap <C-p> :Files<enter>
nmap <C-k> :Buffers<enter>
" Eclim
nmap <c-c><c-g> :JavaCallHierarchy<enter>
nmap <c-c><c-h> :JavaHierarchy<enter>
nmap <c-c><c-i> :JavaImpl<enter>
nmap <c-c><c-r> :JavaRename
nmap <c-c>i :JavaImportOrganize<cr>
" YCM
nmap <leader>jd :YcmCompleter GoToDefinition<enter>
nmap <leader>jt :YcmCompleter GoToType<enter>
nmap <leader>gt :YcmCompleter GetType<enter>
nmap <leader>gd :YcmCompleter GetDoc<enter>
nmap <leader>rn :YcmCompleter RefactorRename
" Navigation
nmap <leader>w <c-w>