| 1 | syntax on |
| 2 | filetype plugin on |
| 3 | |
| 4 | set tags=/usr/src/sys/arch/armv7/tags |
| 5 | set omnifunc=syntaxcomplete#Complete |
| 6 | |
| 7 | set mouse=a |
| 8 | set incsearch |
| 9 | set shiftwidth=4 |
| 10 | set tabstop=8 |
| 11 | set backspace=2 |
| 12 | set ruler |
| 13 | set smartcase |
| 14 | set showmatch |
| 15 | set nu |
| 16 | set nocp |
| 17 | set nowrap |
| 18 | set statusline+=%F\ %l\:%c |
| 19 | set laststatus=2 |
| 20 | cmap w!! w !sudo tee > /dev/null % |
| 21 | |
| 22 | map <C-]> :vsp <CR>:exec("tag ".expand("<cword>"))<CR> |
| 23 | |
| 24 | function! GenSdmmcTags() |
| 25 | TlistAddFilesRecursive ~/code/sdmmc/src/sys/arch/armv7 *.[c,h] |
| 26 | TlistAddFilesRecursive ~/code/sdmmc/src/sys/dev *.[c,h] |
| 27 | TlistAddFilesRecursive ~/code/sdmmc/src/sys/scsi *.[c,h] |
| 28 | TlistAddFilesRecursive ~/code/sdmmc/src/sys/kern *.[c,h] |
| 29 | TlistAddFilesRecursive ~/code/sdmmc/src/sys/lib *.[c,h] |
| 30 | endfunction |
| 31 | |
| 32 | function! SdmmcTags() |
| 33 | TlistSessionLoad /home/kremlin/sdmmc.tlist |
| 34 | endfunction |
| 35 | |
| 36 | |
| 37 | function! DoPrettyXML() |
| 38 | " save the filetype so we can restore it later |
| 39 | let l:origft = &ft |
| 40 | set ft= |
| 41 | " delete the xml header if it exists. This will |
| 42 | " permit us to surround the document with fake tags |
| 43 | " without creating invalid xml. |
| 44 | 1s/<?xml .*?>//e |
| 45 | " insert fake tags around the entire document. |
| 46 | " This will permit us to pretty-format excerpts of |
| 47 | " XML that may contain multiple top-level elements. |
| 48 | 0put ='<PrettyXML>' |
| 49 | $put ='</PrettyXML>' |
| 50 | silent %!xmllint --format - |
| 51 | " xmllint will insert an <?xml?> header. it's easy enough to delete |
| 52 | " if you don't want it. |
| 53 | " delete the fake tags |
| 54 | 2d |
| 55 | $d |
| 56 | " restore the 'normal' indentation, which is one extra level |
| 57 | " too deep due to the extra tags we wrapped around the document. |
| 58 | silent %< |
| 59 | " back to home |
| 60 | 1 |
| 61 | " restore the filetype |
| 62 | exe "set ft=" . l:origft |
| 63 | endfunction |
| 64 | command! PrettyXML call DoPrettyXML() |
| 65 | |