-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
144 lines (118 loc) · 4.25 KB
/
vimrc
File metadata and controls
144 lines (118 loc) · 4.25 KB
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
set shell=bash " for compatability with xonsh
set nocompatible " be iMproved, required
filetype off " required for Vundle
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Plugin 'ntpeters/vim-better-whitespace'
Plugin 'Vimjas/vim-python-pep8-indent'
Plugin 'JamshedVesuna/vim-markdown-preview'
Plugin 'tpope/vim-fugitive'
Plugin 'tomasr/molokai'
Plugin 'posva/vim-vue'
Plugin 'hashivim/vim-terraform'
Bundle 'elzr/vim-json'
Bundle 'hdima/python-syntax'
Bundle 'matze/vim-move'
Bundle 'scrooloose/nerdcommenter'
Bundle 'vim-syntastic/syntastic'
" All plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
" Python syntax highlighting
let python_highlight_all = 1
" vim-move: Ctrl + k/j to move up/down
let g:move_key_modifier = 'C'
autocmd BufWritePre * StripWhitespace " strip whitespace on save
colorscheme stereokai " https://github.com/tomasr/stereokai
set background=dark
set nobackup
set nowritebackup
set noswapfile
set tabstop=4 " number of visual spaces per TAB
set colorcolumn=80 " vertical line at max line length
set shiftwidth=4 " how many columns the reindent operations (<< and >>) use
set softtabstop=4 " how many columns when hit Tab in insert mode
set expandtab " tabs are spaces
set number " show line numbers
set showcmd " show command in bottom bar
set showmatch " shows matching parentheses
syntax enable " enable syntax processing
set clipboard=unnamed " yank to clipboard
set backspace=2 " make backspace work like most other apps
set tw=120 " visual select a long line and split it up with gq
" convenience mapping for ESC
imap ;; <Esc>
" space is your leader
let mapleader = "\<Space>"
" use tabs for go
autocmd Filetype go setlocal noexpandtab
" use 2 space tabs for html, yaml, and javascript
autocmd FileType html setlocal shiftwidth=2 tabstop=2
autocmd FileType yaml setlocal shiftwidth=2 tabstop=2
autocmd FileType tf setlocal shiftwidth=2 tabstop=2
autocmd FileType vue setlocal shiftwidth=2 tabstop=2
autocmd FileType javascript setlocal shiftwidth=2 tabstop=2
" format JSON in Visual mode
map <Leader>j !python -m json.tool<CR>
" python-syntax
let python_highlight_all = 1
" :PrettyXML
function! DoPrettyXML()
" save the filetype so we can restore it later
let l:origft = &ft
set ft=
" delete the xml header if it exists. This will
" permit us to surround the document with fake tags
" without creating invalid xml.
1s/<?xml .*?>//e
" insert fake tags around the entire document.
" This will permit us to pretty-format excerpts of
" XML that may contain multiple top-level elements.
0put ='<PrettyXML>'
$put ='</PrettyXML>'
silent %!xmllint --format -
" xmllint will insert an <?xml?> header. it's easy enough to delete
" if you don't want it.
" delete the fake tags
2d
$d
" restore the 'normal' indentation, which is one extra level
" too deep due to the extra tags we wrapped around the document.
silent %<
" back to home
1
" restore the filetype
exe "set ft=" . l:origft
endfunction
command! PrettyXML call DoPrettyXML()
" show unsaved changes
command Diff :w !diff % -
" Syntastic settings
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0"
" use silver searcher instead of ack for :grep
" The Silver Searcher
if executable('ag')
" Use ag over grep
set grepprg=ag\ --nogroup\ --nocolor
" Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
" ag is fast enough that CtrlP doesn't need to cache
let g:ctrlp_use_caching = 0
endif
nmap <silent> <RIGHT> :cnext<CR>
nmap <silent> <LEFT> :cprev<CR>
" set colour of selected text to Grey
hi Visual term=reverse cterm=reverse guibg=Grey
" show line number, column number etc
set ruler
" Allow vim-terraform to override indentation syntax for matching files. Defaults to 0 which is off.
let g:terraform_align=1