-
Notifications
You must be signed in to change notification settings - Fork 2
/
vimrc
282 lines (222 loc) · 7.83 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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
" map leader (defaults to \)
let mapleader = ','
" set colorscheme
if &t_Co >= 256 || has('gui_running')
colorscheme ir_black
endif
" Variables for template interpolation
let email_address = "[email protected]"
let fullname = "Chris MacLeod"
let company_name = "Airdat LLC"
let template_date_format_string = "%a %b %d %Y"
" pathogen is a plugin for managing plugins as bundles
filetype off
call pathogen#runtime_append_all_bundles()
call pathogen#helptags() " generate helptag documentation for any existing bundles
" enable filetype and plugins
filetype on
filetype indent on
filetype plugin on
" set options here
set ai " auto indend
set si " smart indent
set ff=unix " file format unix dammit
set nocompatible " nocompatible mode
set ruler " ruler the bottom
set expandtab " expand tabs to spaces
set tabstop=2 " define what our tabs are
set softtabstop=2 " soft tabstop
set shiftwidth=2 " # of spaces for auto indent
set smarttab " smart tab (shiftwidth v tabstop)
set tw=0 " no textwidth set by default
set modeline " enable modelines
set modelines=3 " number of modelines to read
set tildeop " case change with movement rather than single char
set showmatch " show matching brackets
set matchtime=5 " how many tenths of a second to blink matching brackets for
set hlsearch " highlight search on by default
set noincsearch " move curser as you type search terms
set autoread " auto read in files that have changed underneath
set shellcmdflag=-lc " set the ! shell to be a login shell to get at functions and aliases
" settings requiring the latest vim
if version >= 703
set colorcolumn=80 " highlight the 80th column
set listchars=nbsp:¶,eol:¬,tab:>-,extends:»,precedes:«,trail:• " characters to use for 'specical' characters and non-printables
endif
" don't remove indents for comments
"inoremap # X#
" new stuff
" add \v to all searches to support regular perl style regex
nnoremap / /\v
vnoremap / /\v
cnoremap %s/ %s/\v
" map <space> to disable highlight easily
nnoremap <silent><leader><space> :noh<cr>
" window settings and maps
nnoremap <leader>w :vnew<CR><C-w>l
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
set nomousefocus " focus does not follow mouse
" set wh=1 " minimal number of lines used for the current window
" set wmh=1 " minimal number of lines used for any window
" set equalalways " make all windows the same size when adding/removing windows
set splitbelow " a new window is put below the current one
set splitright " a new vertical window is right of the current one
" unmap F1 - stupid help key
inoremap <F1> <ESC>
nnoremap <F1> <ESC>
vnoremap <F1> <ESC>
" map to remove trailing whitespace from lines
nnoremap <silent><leader>l :%s/\v\s+$//g<cr>
nnoremap <silent><Leader>i :set invlist<CR>
" reformats entire file based on current indent/syntax settings, then resets
" cursor to last position
noremap <silent><leader>k gg=G``
" Only do this part when compiled with support for autocommands.
if has("autocmd")
" Enable file type detection.
" Use the default filetype settings, so that mail gets 'tw' set to 72,
" 'cindent' is on in C files, etc.
" Also load indent files, to automatically do language-dependent indenting.
filetype plugin indent on
" Put these in an autocmd group, so that we can delete them easily.
augroup vimrcEx
au!
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
" Also don't do it when the mark is in the first line, that is the default
" position when opening a file.
autocmd BufReadPost *
\ if line("'\"") > 1 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
augroup END
else
set autoindent " always set autoindenting on
endif " has("autocmd")
" gui vs console settings
" gui settings go in ~/.gvimrc
if has("gui_running")
else
"set bg=dark
endif
" turn on syntax if we are in a color terminal
if &t_Co > 1
syntax on
endif
" allow the . to execute once for each line of a visual selection
vnoremap . :normal .<CR>
" xterm specifics
if &term =~ "xterm"
set title
set t_kb=
fixdel
endif
" set title for screen use iconstring to set it correctly for tmux as well
if &term =~ "screen"
set t_ts=]2;
set t_fs=
set title
set t_IS=k
set t_IE=\
set icon
endif
set titlestring=%t%(\ %M%)%(\ (%{expand(\"%:~:.:h\")})%)%(\ %a%)
set iconstring=%t%(\ %M%)%(\ (%{expand(\"%:~:.:h\")})%)%(\ %a%)
let &titleold=getcwd()
" Appends / insert current date
nmap <Leader>_d "=strftime("%Y-%m-%d")<CR>p
nmap <Leader>_D "=strftime("%Y%m%d")<CR>P
" surround maps
nmap <Leader>{ ysiw{
nmap <Leader>} ysiw}
nmap <Leader>" ysiw"
nmap <Leader>' ysiw'
" Paste mode
nnoremap <C-E> :silent! set invpaste<CR>
set pastetoggle=<C-E>
" current edge version stuff
if v:version >= 703
set norelativenumber " number the file based on relative position, neat but distracting
set noundofile " this creates undo droppings
endif
let g:javascript_conceal = 1
let javascript_enable_domhtmlcss = 1
let b:javascript_fold = 1
" -------------------------------------
" GNUPG plugin settings
" -------------------------------------
let g:GPGPreferArmor = 1
" Comment settings
let NERDSpaceDelims = 1
let g:NERDCustomDelimiters = {
\ 'puppet': { 'left': '#', 'leftAlt': '/*', 'rightAlt': '*/' }
\ }
let NERDAllowAnyVisualDelims = 1
let NERDCompactSexyComs = 0
let NERDSexyComMarker = ""
" -------------------------------------
" Twiki plugin settings
" -------------------------------------
let g:Twiki_FoldAtHeadings = '0'
let g:Twiki_SourceHTMLSyntax = '1'
let g:Twiki_Functions = '1'
let g:Twiki_Mapings = '1'
" allow loose skeleton matching for templates
" ie init.pp (a puppet filetype) will match init_puppet
let g:EteSkeleton_loosefiletype = 1
" DNSTools
let g:dnstools_prompt_replacement = 0
" set statusline to always be present see plugin/statusline.vim for actual
" setting of the statusline
set laststatus=2
" ctags
set tags=./tags; " allows recursing upwards to project roots
" open vimrc in new vsplit for quick config changes
nmap <leader>v :tabnew ~/.vimrc<cr>:lcd ~/.vim<cr>
" auto source it on save
autocmd! bufwritepost .vimrc source %
" enable matchit which ships with vim but isn't turned on
source $VIMRUNTIME/macros/matchit.vim
" settings for taglist
let tlist_puppet_settings='puppet;c:class;d:define;s:site'
nnoremap <silent><leader>t :TlistToggle<CR>
" set supertab to do context based completion
let g:SuperTabDefaultCompletionType = "context"
" map the align command to align fat comma's, do need to visual select first
" vmap <LEADER>= :Align =><CR>
" fold settings for copressing code/etc
set foldmethod=syntax
set foldlevelstart=20
" map keys to fold commands za is tedious
inoremap <LEADER>f <C-O>za
nnoremap <LEADER>f za
onoremap <LEADER>f <C-C>za
vnoremap <LEADER>f zf
" lazy git commit
nmap <LEADER>g :Gcommit<CR>
" map for syntastic errors window
nnoremap <silent> <LEADER>e :<C-u>call ToggleErrors()<CR>
nnoremap <silent> <LEADER>E :lnext<CR>
" autoclose syntastic's error windown when no errors
let g:syntastic_auto_loc_list=2
" always update location list
let g:syntastic_always_populate_loc_list = 1
" syntastic checking mode
let g:syntastic_mode_map = { 'mode': 'active',
\ 'active_filetypes': ['ruby', 'python', 'perl', 'shell', 'puppet' ],
\ 'passive_filetypes': ['php', 'html'] }
" check syntax on file open
let g:syntastic_check_on_open=1
" haml lint
let g:syntastic_haml_checkers = ['haml_lint']
" enable puppet module detection
let g:puppet_module_detect=1
" split window movement mappings
nmap <silent> <A-Up> :wincmd k<CR>
nmap <silent> <A-Down> :wincmd j<CR>
nmap <silent> <A-Left> :wincmd h<CR>
nmap <silent> <A-Right> :wincmd l<CR>