forked from mcandre/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
executable file
·208 lines (173 loc) · 5.38 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
" Store as ~/.vimrc (Unix) or ~/_vimrc (Windows, non-cygwin)
" Fix Delete (backspace) on Mac OS X
set backspace=2
" Enable syntax highlighting
syntax on
" " Indentation
" set autoindent
" filetype plugin indent on
" Use OS clipboard for copypasta
set clipboard=unnamed
" Enable OS mouse clicking and scrolling
"
" Note for Mac OS X: Requires SIMBL and MouseTerm
"
" http://www.culater.net/software/SIMBL/SIMBL.php
" https://bitheap.org/mouseterm/
if has("mouse")
set mouse=a
endif
" Bash-style tab completion
set wildmode=longest,list
set wildmenu
" No swap files, use version control instead
set noswapfile
" Keep selection on visual yank
vnoremap <silent> y ygv
" Emacs-style start of line / end of line navigation
nnoremap <silent> <C-a> ^
nnoremap <silent> <C-e> $
vnoremap <silent> <C-a> ^
vnoremap <silent> <C-e> $
inoremap <silent> <C-a> <esc>^i
inoremap <silent> <C-e> <esc>$i
" Emacs-style line cutting
nnoremap <silent> <C-k> d$
vnoremap <silent> <C-k> d$
inoremap <silent> <C-k> <esc>d$i
" Fix Alt key in MacVIM GUI
" TODO - Fix in MacVIM terminal
if has("gui_macvim")
set macmeta
endif
" Emacs-style start of file / end of file navigation
nnoremap <silent> <M-<> gg
nnoremap <silent> <M->> G$
vnoremap <silent> <M-<> gg
vnoremap <silent> <M->> G$
inoremap <silent> <M-<> <esc>ggi
inoremap <silent> <M->> <esc>G$i
" Do not attempt to fix style on paste
" Normally we would just `set paste`, but this interferes with other aliases.
nnoremap <silent> p "+p
" Disable comment continuation on paste
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
" Show line numbers
set number
" Show statusline
set laststatus=2
" Case-insensitive search
set ignorecase
" Highlight search results
set hlsearch
" Default to soft tabs, 2 spaces
set expandtab
set sw=2
set sts=2
" Except for Makefiles: Hard tabs of width 2
autocmd FileType make set ts=2
" And Markdown
autocmd FileType mkd set sw=4
autocmd FileType mkd set sts=4
autocmd BufRead,BufNewFile *.md set filetype=markdown
autocmd BufRead,BufNewFile *.cql set filetype=cql
" And Java
autocmd FileType java set sw=2
" Default to Unix LF line endings
set ffs=unix
" Folding
set foldmethod=syntax
set foldcolumn=1
set foldlevelstart=20
let g:vim_markdown_folding_disabled=1 " Markdown
let javaScript_fold=1 " JavaScript
let perl_fold=1 " Perl
let php_folding=1 " PHP
let r_syntax_folding=1 " R
let ruby_fold=1 " Ruby
let sh_fold_enabled=1 " sh
let vimsyn_folding='af' " Vim script
let xml_syntax_folding=1 " XML
"
" Wrap window-move-cursor
"
function! s:GotoNextWindow( direction, count )
let l:prevWinNr = winnr()
execute a:count . 'wincmd' a:direction
return winnr() != l:prevWinNr
endfunction
function! s:JumpWithWrap( direction, opposite )
if ! s:GotoNextWindow(a:direction, v:count1)
call s:GotoNextWindow(a:opposite, 999)
endif
endfunction
nnoremap <silent> <C-w>h :<C-u>call <SID>JumpWithWrap('h', 'l')<CR>
nnoremap <silent> <C-w>j :<C-u>call <SID>JumpWithWrap('j', 'k')<CR>
nnoremap <silent> <C-w>k :<C-u>call <SID>JumpWithWrap('k', 'j')<CR>
nnoremap <silent> <C-w>l :<C-u>call <SID>JumpWithWrap('l', 'h')<CR>
nnoremap <silent> <C-w><Left> :<C-u>call <SID>JumpWithWrap('h', 'l')<CR>
nnoremap <silent> <C-w><Down> :<C-u>call <SID>JumpWithWrap('j', 'k')<CR>
nnoremap <silent> <C-w><Up> :<C-u>call <SID>JumpWithWrap('k', 'j')<CR>
nnoremap <silent> <C-w><Right> :<C-u>call <SID>JumpWithWrap('l', 'h')<CR>
"
" vim-plug dependency manager
" https://github.com/junegunn/vim-plug
"
call plug#begin('~/.vim/plugged')
Plug 'bruno-/vim-alt-mappings'
Plug 'ctrlpvim/ctrlp.vim'
Plug 'tpope/vim-fugitive'
Plug 'tomtom/tcomment_vim'
Plug 'bling/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'benjaminwhite/Benokai'
Plug 'fsouza/go.vim'
Plug 'wting/rust.vim'
Plug 'godlygeek/tabular'
Plug 'plasticboy/vim-markdown'
Plug 'mtth/scratch.vim'
Plug 'greplace.vim'
Plug 'mcandre/Conque-Shell'
Plug 'elubow/cql-vim'
Plug 'scrooloose/nerdtree'
Plug 'moll/vim-bbye'
Plug 'editorconfig/editorconfig-vim'
call plug#end()
" Enable Powerline fonts for airline
if !has("win32") && !has("win16")
let g:airline_powerline_fonts = 1
let g:airline_theme='distinguished'
endif
" Work around PowerShell color limitations
if !has("win32") && !has("win16")
colorscheme Benokai
endif
" Column 80 marker
highlight OverLength ctermbg=darkred ctermfg=white guibg=#660000
match OverLength /\%81v.\+/
" " Currently broken due to Vim/Semicolon issues
" " Alt+; to toggle comments
" nnoremap <silent> <M-;> gc
" vnoremap <silent> <M-;> gc
" inoremap <silent> <M-;> <esc>gci
" Scratch splits the current window in half
let g:scratch_height = 0.50
" Scratch opens in Markdown format
let g:scratch_filetype = 'markdown'
" ctrlp: Apply patterns from .gitignore
set wildignore+=node_modules
" Conque Allow C-w window navigation while in insert mode
let g:ConqueTerm_CWInsert = 1
" Replace shell with Conque-Shell
set nocp
cabbrev sh sh<C-\>esubstitute(getcmdline(), '^sh', 'ConqueTerm bash', '')<cr>
" Autolaunch NERDTree
autocmd vimenter * NERDTree
" Focus main window, not NERDTree
augroup NERD
autocmd!
autocmd VimEnter * NERDTree
autocmd VimEnter * wincmd p
augroup END
" Exit Vim when the only window left is NERDTree
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif