X-Git-Url: https://uglyman.kremlin.cc/gitweb/gitweb.cgi?p=dotfiles.git;a=blobdiff_plain;f=.vimrc;h=6737af1c4b03f1de2a2343f6e6249054b8beb8d7;hp=d5e2ec2499816c1edd75a0478dccc9d05ca83c2d;hb=HEAD;hpb=7fc9a14578a37ee06e5261cc565504229debb359 diff --git a/.vimrc b/.vimrc index d5e2ec2..6737af1 100644 --- a/.vimrc +++ b/.vimrc @@ -1,11 +1,65 @@ +syntax on +filetype plugin on + +set tags=/usr/src/sys/arch/armv7/tags +set omnifunc=syntaxcomplete#Complete + +set mouse=a set incsearch -set tabstop=4 +set shiftwidth=4 +set tabstop=8 set backspace=2 set ruler set smartcase set showmatch -set cindent set nu set nocp -syntax on +set nowrap +set statusline+=%F\ %l\:%c +set laststatus=2 +cmap w!! w !sudo tee > /dev/null % + +map :vsp :exec("tag ".expand("")) + +function! GenSdmmcTags() + TlistAddFilesRecursive ~/code/sdmmc/src/sys/arch/armv7 *.[c,h] + TlistAddFilesRecursive ~/code/sdmmc/src/sys/dev *.[c,h] + TlistAddFilesRecursive ~/code/sdmmc/src/sys/scsi *.[c,h] + TlistAddFilesRecursive ~/code/sdmmc/src/sys/kern *.[c,h] + TlistAddFilesRecursive ~/code/sdmmc/src/sys/lib *.[c,h] +endfunction + +function! SdmmcTags() + TlistSessionLoad /home/kremlin/sdmmc.tlist +endfunction + + +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///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 ='' + $put ='' + silent %!xmllint --format - + " xmllint will insert an 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()