aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Bobov <abobov@gmail.com>2013-04-16 15:58:19 +0600
committerAnton Bobov <abobov@gmail.com>2013-04-16 15:58:19 +0600
commitc6c73501c5e4576e2a688c59c88ef663c4d81ad1 (patch)
tree8790044189e9622234c19f611a7026b9835825dc
parent423460514aff780fbb0244f7d7ac4f60f7e83db4 (diff)
parent0c08d59fae1e0b2c00af83c11298e15e06733af9 (diff)
Merge branch 'master' of ~/dotfiles
-rwxr-xr-xfiles/.vim/ftplugin/yaml.vim32
-rwxr-xr-xfiles/.vim/plugin/XMLFolding.vim105
-rw-r--r--files/.vimrc4
3 files changed, 141 insertions, 0 deletions
diff --git a/files/.vim/ftplugin/yaml.vim b/files/.vim/ftplugin/yaml.vim
new file mode 100755
index 0000000..ca3abe2
--- /dev/null
+++ b/files/.vim/ftplugin/yaml.vim
@@ -0,0 +1,32 @@
+" Vim indent file
+" Language: Yaml
+" Author: Ian Young
+" Get it bundled for pathogen: https://github.com/avakhov/vim-yaml
+
+if exists("b:did_indent")
+ finish
+endif
+"runtime! indent/ruby.vim
+"unlet! b:did_indent
+let b:did_indent = 1
+
+setlocal autoindent sw=2 et
+setlocal indentexpr=GetYamlIndent()
+setlocal indentkeys=o,O,*<Return>,!^F
+
+function! GetYamlIndent()
+ let lnum = v:lnum - 1
+ if lnum == 0
+ return 0
+ endif
+ let line = substitute(getline(lnum),'\s\+$','','')
+ let indent = indent(lnum)
+ let increase = indent + &sw
+ if line =~ ':$'
+ return increase
+ else
+ return indent
+ endif
+endfunction
+
+" vim:set sw=2:
diff --git a/files/.vim/plugin/XMLFolding.vim b/files/.vim/plugin/XMLFolding.vim
new file mode 100755
index 0000000..ec5487b
--- /dev/null
+++ b/files/.vim/plugin/XMLFolding.vim
@@ -0,0 +1,105 @@
+" About XMLFolding Script {{{
+
+" XMLFolding version 1.1 - May 13th, 2006
+" Author: Thadeu Aparecido Coelho de Paula
+" E-mail: thadeudepaula@gmail.com
+" WebPage: http://mundolivre.hostrixonline.com
+"
+" This is my first vim script... at this point I already worked three
+" continual weeks to make it. Never give up your objectives!
+" I hope that you enjoy it, and use it to accomplish your projects!
+"
+" This script is under GNU Public License... use it, change it, sell it but
+" never forget to mention the original author"
+"
+" Made using Vim 6.04 on Debian GNU/Linux
+"
+" This Script supports:
+"
+" Folding of comments "<!-- -->"
+" Folding of open/close tags in different lines "<> </>"
+" Folding between CDATA markers "<![CDATA[" and "]]>"
+
+" }}}
+
+" Howto {{{
+
+ " Installing {{{
+" Copy this file for any location yow want to... I suggest that you put it on
+" your ~/.vim/plugin directory.
+"
+" To load this script in your vim session, type on normal mode:
+" :so ~/.vim/script/XMLFolding.vim
+" (If you saved on local where I suggested!)
+
+"}}}
+
+ " How to load this script automaticaly? {{{
+"You can use this script more easily configuring your vim to run it on start...
+"You'll need to put this line in your /etc/vim/vimrc or ~/.vimrc:
+
+" au BufNewFile,BufRead *.xml,*.htm,*.html so ~/.vim/plugin/XMLFolding.vim
+
+" The "*.xml,*.html" can be changed for the file extensions that you want to
+" use with this script.
+ "}}}
+
+ " Limitatios... i.e, when the fold won't occurs {{{
+
+" The syntax need to be perfectly to match correctly... the tags needs to be
+" nested correctly...
+" All the tags nested in the same line will not be folded... like this:
+"
+" <start>blablabla<middle>blablabla</middle>asdsad
+" </start>
+"
+" In this example only "start" will be folded...
+"
+" An other problem will occur when you end the line closing a tag different
+" than the open tag that starts the line, because the matches ignore the lines
+" that starts opening a tag and ends closing a tag...
+"
+" <start><middle>asdasdsd</middle>
+" </start>
+"
+" This will cause an error, because MATCHES ARE NOT MADE BY THE CONTENT OF A
+" TAG, but by the presence of start and end aspect: <----> </----> independent
+" of the tag content... if it encounter an incorrect nesting, the folding for
+" the document will be broken.
+"
+" This way, the script serves as an validator, limited but functional!
+
+ "}}}
+
+
+"}}}
+
+" Folding def commands {{{
+
+ " Basic vim commands for folding definition {{{
+syn sync fromstart
+set foldmethod=syntax
+ "}}}
+
+ " Matches and regions {{{
+
+syn region XMLFold start=+^<\([^/?!><]*[^/]>\)\&.*\(<\1\|[[:alnum:]]\)$+ end=+^</.*[^-?]>$+ fold transparent keepend extend
+
+syn match XMLCData "<!\[CDATA\[\_.\{-}\]\]>" fold transparent extend
+
+syn match XMLCommentFold "<!--\_.\{-}-->" fold transparent extend
+
+
+ "}}}
+
+ " Label shown for folded lines {{{
+set foldtext=XMLFoldLabel()
+ fun! XMLFoldLabel()
+ let getcontent = substitute(getline(v:foldstart), "^[[:space:]]*", "", 'g')
+ let linestart = substitute(v:folddashes, ".", '»', 'g')
+ return linestart . " " . getcontent
+endfunction
+
+ "}}}
+
+"}}}
diff --git a/files/.vimrc b/files/.vimrc
index e23efbe..bf301e1 100644
--- a/files/.vimrc
+++ b/files/.vimrc
@@ -185,6 +185,10 @@ map gf :e <cfile><CR>
map YY "+yy
+" Surrounds double angle quotes «»
+let g:surround_171="« \r »"
+let g:surround_187="«\r»"
+
let s:local_vimrc=$MYVIMRC . ".local"
if filereadable(s:local_vimrc)
silent! execute ':source ' . s:local_vimrc