diff --git a/.vim/UltiSnips/.svn/entries b/.vim/UltiSnips/.svn/entries
new file mode 100644
index 0000000..48082f7
--- /dev/null
+++ b/.vim/UltiSnips/.svn/entries
@@ -0,0 +1 @@
+12
diff --git a/.vim/UltiSnips/.svn/format b/.vim/UltiSnips/.svn/format
new file mode 100644
index 0000000..48082f7
--- /dev/null
+++ b/.vim/UltiSnips/.svn/format
@@ -0,0 +1 @@
+12
diff --git a/.vim/UltiSnips/.svn/pristine/1c/1c519a8fd27b8af6909c18ed00232eeca8c71673.svn-base b/.vim/UltiSnips/.svn/pristine/1c/1c519a8fd27b8af6909c18ed00232eeca8c71673.svn-base
new file mode 100644
index 0000000..8f72e57
--- /dev/null
+++ b/.vim/UltiSnips/.svn/pristine/1c/1c519a8fd27b8af6909c18ed00232eeca8c71673.svn-base
@@ -0,0 +1,3 @@
+snippet ! "!important"
+!important
+endsnippet
diff --git a/.vim/UltiSnips/.svn/pristine/41/41f42dd55ec2c08b0adc950e8340bdbf631a7997.svn-base b/.vim/UltiSnips/.svn/pristine/41/41f42dd55ec2c08b0adc950e8340bdbf631a7997.svn-base
new file mode 100644
index 0000000..0886749
--- /dev/null
+++ b/.vim/UltiSnips/.svn/pristine/41/41f42dd55ec2c08b0adc950e8340bdbf631a7997.svn-base
@@ -0,0 +1,39 @@
+snippet for "Boucle for"
+{% for item in $1 %}
+
+{% endfor %}
+endsnippet
+
+snippet if "If cond"
+{% if $1 %}
+
+{% else %}
+
+{% endif %}
+endsnippet
+
+snippet dump "Dump function"
+{{ dump($1) }}
+endsnippet
+
+snippet trans "Trans function"
+{{ '$1'|trans }}
+endsnippet
+
+snippet macro "Macro function"
+{% import _self as macros %}
+
+{% macro $1() %}
+
+{% endmacro %}
+
+{{ macros.$1() }}
+endsnippet
+
+snippet {{ "Print"
+{{ $1 }}
+endsnippet
+
+snippet {% "Function"
+{% $1 %}
+endsnippet
diff --git a/.vim/UltiSnips/.svn/pristine/c3/c385b8b67a7adf87194feda4ae35539c6e24a6a3.svn-base b/.vim/UltiSnips/.svn/pristine/c3/c385b8b67a7adf87194feda4ae35539c6e24a6a3.svn-base
new file mode 100644
index 0000000..58f8124
--- /dev/null
+++ b/.vim/UltiSnips/.svn/pristine/c3/c385b8b67a7adf87194feda4ae35539c6e24a6a3.svn-base
@@ -0,0 +1,77 @@
+snippet pf "Create a public function" b
+public function $1()
+{
+ return $this;
+}
+endsnippet
+
+snippet ppf "Create a private function" b
+public function $1()
+{
+ return $this;
+}
+endsnippet
+
+snippet ptf "Create a protected function" b
+public function $1()
+{
+ return $this;
+}
+endsnippet
+
+snippet sf2:c "Create a symfony2 controller function" b
+/**
+ * @param $request
+ * @return \Symfony\Bundle\FrameworkBundle\Controller\Response
+ */
+public function $1Action(Request $request)
+{
+ return $this->defaultRender();
+}
+endsnippet
+
+snippet page "Create trinity page"
+configuration
+ ->setDefaultController('FooBarBundle:MyController:bob')
+ ->setDefaultControllerClass('Foo\Bundle\BarBundle::bobAction')
+ ->setBlock('title', 'Trinity\Bundle\ContentManagerBundle\Form\Type\BlockType')
+ ->setBlock('content', 'Trinity\Bundle\ContentManagerBundle\Form\Type\TinymceAdvancedBlockType')
+ }
+
+ public function getBlockTitle()
+ {
+ return $this->getBlock('title');
+ }
+
+ public function getBlockTitle(Block $block)
+ {
+ return $this->setBlock($block);
+ }
+
+ public function getBlockContent()
+ {
+ return $this->getBlock('content');
+ }
+
+ public function setBlockContent(Block $block)
+ {
+ return $this->setBlock($block);
+ }
+}
+endsnippet
diff --git a/.vim/UltiSnips/.svn/pristine/da/da39a3ee5e6b4b0d3255bfef95601890afd80709.svn-base b/.vim/UltiSnips/.svn/pristine/da/da39a3ee5e6b4b0d3255bfef95601890afd80709.svn-base
new file mode 100644
index 0000000..e69de29
diff --git a/.vim/UltiSnips/.svn/wc.db b/.vim/UltiSnips/.svn/wc.db
new file mode 100644
index 0000000..c614676
Binary files /dev/null and b/.vim/UltiSnips/.svn/wc.db differ
diff --git a/.vim/UltiSnips/php.snippets b/.vim/UltiSnips/php.snippets
new file mode 100644
index 0000000..d2f9897
--- /dev/null
+++ b/.vim/UltiSnips/php.snippets
@@ -0,0 +1,188 @@
+snippet pf "Create a public function" b
+public function $1()
+{
+ return $this;
+}
+endsnippet
+
+snippet ppf "Create a private function" b
+public function $1()
+{
+ return $this;
+}
+endsnippet
+
+snippet ptf "Create a protected function" b
+public function $1()
+{
+ return $this;
+}
+endsnippet
+
+snippet php
+
+endsnippet
+
+snippet gs "Getter and setter"
+public function set${1/\w+\s*/\u$0/g}(\$$1)
+{
+ $this->$1 = \$$1;
+
+ return \$this;
+}
+
+public function get${1/\w+\s*/\u$0/g}()
+{
+ return \$this->$1;
+}
+endsnippet
+
+snippet sf2:a "Create a symfony2 controller function" b
+/**
+ * @param $request
+ * @return \Symfony\Bundle\FrameworkBundle\Controller\Response
+ */
+public function $1Action(Request $request)
+{
+ if ($response = $this->handleNodeSecurity()) {
+ return $response;
+ }
+
+ return $this->defaultRender();
+}
+endsnippet
+
+snippet page "Create trinity page"
+configuration
+ ->setDefaultController('FooBundle:MyController:bob')
+ ->setDefaultControllerClass('Foo\Bundle\BarBundle\Controller\MyController::bobAction')
+ ->setBlock('title', 'Trinity\Bundle\ContentManagerBundle\Form\Type\BlockType')
+ ->setBlock('content', 'Trinity\Bundle\ContentManagerBundle\Form\Type\TinymceAdvancedBlockType');
+ }
+
+ public function getBlockTitle()
+ {
+ return $this->getBlock('title');
+ }
+
+ public function setBlockTitle(Block $block)
+ {
+ return $this->setBlock($block);
+ }
+
+ public function getBlockContent()
+ {
+ return $this->getBlock('content');
+ }
+
+ public function setBlockContent(Block $block)
+ {
+ return $this->setBlock($block);
+ }
+}
+endsnippet
+
+snippet command "Create sf2 command"
+setName('$1')
+ ->setDescription('$2')
+ // ->addArgument('foo', InputArgument::OPTIONAL, '')
+ // ->addOption('bar', null, InputOption::VALUE_NONE, '')
+ ->setHelp("The %command.name% $3");
+ }
+
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ // $this->getContainer()->get('foo.bar');
+ // $output->writeln(sprintf('%s bar.', $example));
+ // $input->getArgument('foo');
+ // $input->getOption('bar');
+ }
+}
+endsnippet
+
+snippet controller "Create trinity controller"
+handleNodeSecurity()) {
+ return $response;
+ }
+
+ return $this->defaultRender();
+ }
+}
+endsnippet
+
+
+snippet form "Create sf2 form"
+ '',
+ );
+
+ public function buildForm(FormBuilderInterface $builder, array $options)
+ {
+ }
+}
+endsnippet
+
+snippet array "Create array"
+array($1)
+endsnippet
+
+snippet foreach "foreach"
+foreach (\$${1}s as \$$1) {
+
+}
+endsnippet
diff --git a/.vim/UltiSnips/scss.snippets b/.vim/UltiSnips/scss.snippets
new file mode 100644
index 0000000..8f72e57
--- /dev/null
+++ b/.vim/UltiSnips/scss.snippets
@@ -0,0 +1,3 @@
+snippet ! "!important"
+!important
+endsnippet
diff --git a/.vim/UltiSnips/snippets.snippets b/.vim/UltiSnips/snippets.snippets
new file mode 100644
index 0000000..e69de29
diff --git a/.vim/UltiSnips/twig.snippets b/.vim/UltiSnips/twig.snippets
new file mode 100644
index 0000000..59b2853
--- /dev/null
+++ b/.vim/UltiSnips/twig.snippets
@@ -0,0 +1,50 @@
+snippet for "Boucle for"
+{% for item in $1 %}
+
+{% endfor %}
+endsnippet
+
+snippet if "If cond"
+{% if $1 %}
+
+{% else %}
+
+{% endif %}
+endsnippet
+
+snippet dump "Dump function"
+{{ dump($1) }}
+endsnippet
+
+snippet trans "Trans function"
+{{ '$1'|trans }}
+endsnippet
+
+snippet macro "Macro function"
+{% import _self as macros %}
+
+{% macro $1() %}
+
+{% endmacro %}
+
+{{ macros.$1() }}
+endsnippet
+
+snippet block "block"
+{% block $1 %}
+
+{% endblock %}
+endsnippet
+
+
+snippet {{ "Print"
+{{ $1 }}
+endsnippet
+
+snippet {% "Function"
+{% $1 %}
+endsnippet
+
+snippet set "Function"
+{% set $1 %}
+endsnippet
diff --git a/.vim/UltiSnips/xml.snippets b/.vim/UltiSnips/xml.snippets
new file mode 100644
index 0000000..aa77995
--- /dev/null
+++ b/.vim/UltiSnips/xml.snippets
@@ -0,0 +1,34 @@
+snippet trans "trans"
+
+
+
+
+endsnippet
+
+snippet schema "schema"
+
+
+ $2
+
+endsnippet
+
+
+snippet table "table"
+
+endsnippet
diff --git a/.vim/autoload/beyondwords-vim-twig-6386c6d/README.markdown b/.vim/autoload/beyondwords-vim-twig-6386c6d/README.markdown
new file mode 100644
index 0000000..514deb3
--- /dev/null
+++ b/.vim/autoload/beyondwords-vim-twig-6386c6d/README.markdown
@@ -0,0 +1,20 @@
+# vim-twig
+
+## About
+Supports Twig PHP templates [http://www.twig-project.org/][1]
+
+Based on Jinja2 syntax highlighting by [Armin Ronacher][2]
+
+-----
+## Installation
+
+This scripts bundles is compatible with [vim-addon-manager][3]
+
+## Changes
+### 2011-07-29
+- Re-based the syntax highlighting to properly support all tags
+- Added support for .html.twig files
+
+[1]: http://www.twig-project.org/
+[2]: http://www.vim.org/scripts/script.php?script_id=1856
+[3]: https://github.com/MarcWeber/vim-addon-manager
diff --git a/.vim/autoload/beyondwords-vim-twig-6386c6d/ftdetect/twig.vim b/.vim/autoload/beyondwords-vim-twig-6386c6d/ftdetect/twig.vim
new file mode 100644
index 0000000..06b70e2
--- /dev/null
+++ b/.vim/autoload/beyondwords-vim-twig-6386c6d/ftdetect/twig.vim
@@ -0,0 +1,5 @@
+" Twig
+autocmd BufNewFile,BufRead *.twig set filetype=twig
+
+" HTML Twig
+autocmd BufNewFile,BufRead *.html.twig set filetype=html.twig
diff --git a/.vim/autoload/beyondwords-vim-twig-6386c6d/ftplugin/twig.vim b/.vim/autoload/beyondwords-vim-twig-6386c6d/ftplugin/twig.vim
new file mode 100644
index 0000000..506adbd
--- /dev/null
+++ b/.vim/autoload/beyondwords-vim-twig-6386c6d/ftplugin/twig.vim
@@ -0,0 +1,18 @@
+" Vim filetype plugin
+" Language: Twig
+" Maintainer: F. Gabriel Gosselin
+
+if exists("b:did_ftplugin")
+ finish
+endif
+
+runtime! ftplugin/html.vim ftplugin/html*.vim ftplugin/html/*.vim
+unlet! b:did_ftplugin
+
+setlocal comments=s:{#,ex:#}
+setlocal formatoptions+=tcqln
+" setlocal formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\|^[-*+]\\s\\+
+
+let b:undo_ftplugin .= "|setl cms< com< fo<"
+
+" vim:set sw=2:
diff --git a/.vim/autoload/beyondwords-vim-twig-6386c6d/snippets/twig.snippets b/.vim/autoload/beyondwords-vim-twig-6386c6d/snippets/twig.snippets
new file mode 100644
index 0000000..fb0202f
--- /dev/null
+++ b/.vim/autoload/beyondwords-vim-twig-6386c6d/snippets/twig.snippets
@@ -0,0 +1,46 @@
+# Basic Twig snippets
+# Maintainer: F. Gabriel Gosselin
+
+# include
+snippet inc
+ {% include '${1}' %}
+# extend
+snippet ext
+ {% extends '${1:template.html.twig}' %}
+# extends
+snippet extends
+ {% extends '${1:template}' %}${2}
+# if
+snippet if
+ {% if ${1} %}
+ ${2}
+ {% endif %}
+# else
+snippet else
+ {% else %}
+ ${1}
+# for
+snippet for
+ {% for ${2:} in ${1} %}
+ ${3}{{ $2 }}
+ {% endfor %}
+# Set
+snippet set
+ {% set ${1:var} = ${2:value} %}${3}
+# Print variable
+snippet }}
+ {{ ${1} }}${2}
+# Single Regular execution block
+snippet %%
+ {% ${1} %}${2}
+# Comment block
+snippet ##
+ {# ${1} #}${2}
+# Open/close block
+snippet %end
+ {% ${1:block} %}${2}{% end$1 %}
+# Named block
+snippet block
+ {% block ${1:name} %}${2}{% endblock %}
+snippet f_date
+ {{ ${1:a_date}|date("${2:m/d/Y}") }}
diff --git a/.vim/autoload/beyondwords-vim-twig-6386c6d/syntax/twig.vim b/.vim/autoload/beyondwords-vim-twig-6386c6d/syntax/twig.vim
new file mode 100644
index 0000000..af3c265
--- /dev/null
+++ b/.vim/autoload/beyondwords-vim-twig-6386c6d/syntax/twig.vim
@@ -0,0 +1,109 @@
+" Vim syntax file
+" Language: Twig template
+" Maintainer: Gabriel Gosselin
+" Last Change: 2011 July 27
+" Version: 1.0
+"
+" Based Jinja syntax by: Armin Ronacher
+"
+" Known Bugs:
+" because of odd limitations dicts and the modulo operator
+" appear wrong in the template.
+"
+" Changes:
+"
+" 2008 May 9: Added support for Jinja2 changes (new keyword rules)
+" 2011 July 27: Changed all references of jinja tp twig
+
+syntax case match
+
+" Jinja template built-in tags and parameters (without filter, macro, is and raw, they
+" have special threatment)
+syn keyword twigStatement containedin=twigVarBlock,twigTagBlock,twigNested contained and if else in not or recursive as import
+
+syn keyword twigStatement containedin=twigVarBlock,twigTagBlock,twigNested contained is filter skipwhite nextgroup=twigFilter
+syn keyword twigStatement containedin=twigTagBlock contained macro skipwhite nextgroup=twigFunction
+syn keyword twigStatement containedin=twigTagBlock contained block skipwhite nextgroup=twigBlockName
+
+" Variable Names
+syn match twigVariable containedin=twigVarBlock,twigTagBlock,twigNested contained skipwhite /[a-zA-Z_][a-zA-Z0-9_]*/
+syn keyword twigSpecial containedin=twigVarBlock,twigTagBlock,twigNested contained false true none loop super caller varargs kwargs
+
+" Filters
+syn match twigOperator "|" containedin=twigVarBlock,twigTagBlock,twigNested contained nextgroup=twigFilter
+syn match twigFilter contained skipwhite /[a-zA-Z_][a-zA-Z0-9_]*/
+syn match twigFunction contained skipwhite /[a-zA-Z_][a-zA-Z0-9_]*/
+syn match twigBlockName contained skipwhite /[a-zA-Z_][a-zA-Z0-9_]*/
+
+" Jinja template constants
+syn region twigString containedin=twigVarBlock,twigTagBlock,twigNested contained start=/"/ skip=/\\"/ end=/"/
+syn region twigString containedin=twigVarBlock,twigTagBlock,twigNested contained start=/'/ skip=/\\'/ end=/'/
+syn match twigNumber containedin=twigVarBlock,twigTagBlock,twigNested contained /[0-9]\+\(\.[0-9]\+\)\?/
+
+" Operators
+syn match twigOperator containedin=twigVarBlock,twigTagBlock,twigNested contained /[+\-*\/<>=!,:]/
+syn match twigPunctuation containedin=twigVarBlock,twigTagBlock,twigNested contained /[()\[\]]/
+syn match twigOperator containedin=twigVarBlock,twigTagBlock,twigNested contained /\./ nextgroup=twigAttribute
+syn match twigAttribute contained /[a-zA-Z_][a-zA-Z0-9_]*/
+
+" Jinja template tag and variable blocks
+syn region twigNested matchgroup=twigOperator start="(" end=")" transparent display containedin=twigVarBlock,twigTagBlock,twigNested contained
+syn region twigNested matchgroup=twigOperator start="\[" end="\]" transparent display containedin=twigVarBlock,twigTagBlock,twigNested contained
+syn region twigNested matchgroup=twigOperator start="{" end="}" transparent display containedin=twigVarBlock,twigTagBlock,twigNested contained
+syn region twigTagBlock matchgroup=twigTagDelim start=/{%-\?/ end=/-\?%}/ skipwhite containedin=ALLBUT,twigTagBlock,twigVarBlock,twigRaw,twigString,twigNested,twigComment
+
+syn region twigVarBlock matchgroup=twigVarDelim start=/{{-\?/ end=/-\?}}/ containedin=ALLBUT,twigTagBlock,twigVarBlock,twigRaw,twigString,twigNested,twigComment
+
+" Jinja template 'raw' tag
+syn region twigRaw matchgroup=twigRawDelim start="{%\s*raw\s*%}" end="{%\s*endraw\s*%}" containedin=ALLBUT,twigTagBlock,twigVarBlock,twigString,twigComment
+
+" Jinja comments
+syn region twigComment matchgroup=twigCommentDelim start="{#" end="#}" containedin=ALLBUT,twigTagBlock,twigVarBlock,twigString
+
+" Block start keywords. A bit tricker. We only highlight at the start of a
+" tag block and only if the name is not followed by a comma or equals sign
+" which usually means that we have to deal with an assignment.
+syn match twigStatement containedin=twigTagBlock contained skipwhite /\({%-\?\s*\)\@<=\<[a-zA-Z_][a-zA-Z0-9_]*\>\(\s*[,=]\)\@!/
+
+" and context modifiers
+syn match twigStatement containedin=twigTagBlock contained /\/ skipwhite
+
+
+" Define the default highlighting.
+" For version 5.7 and earlier: only when not done already
+" For version 5.8 and later: only when an item doesn't have highlighting yet
+if version >= 508 || !exists("did_twig_syn_inits")
+ if version < 508
+ let did_twig_syn_inits = 1
+ command -nargs=+ HiLink hi link
+ else
+ command -nargs=+ HiLink hi def link
+ endif
+
+ HiLink twigPunctuation twigOperator
+ HiLink twigAttribute twigVariable
+ HiLink twigFunction twigFilter
+
+ HiLink twigTagDelim twigTagBlock
+ HiLink twigVarDelim twigVarBlock
+ HiLink twigCommentDelim twigComment
+ HiLink twigRawDelim twig
+
+ HiLink twigSpecial Special
+ HiLink twigOperator Normal
+ HiLink twigRaw Normal
+ HiLink twigTagBlock PreProc
+ HiLink twigVarBlock PreProc
+ HiLink twigStatement Statement
+ HiLink twigFilter Function
+ HiLink twigBlockName Function
+ HiLink twigVariable Identifier
+ HiLink twigString Constant
+ HiLink twigNumber Constant
+ HiLink twigComment Comment
+
+ delcommand HiLink
+endif
+
+let b:current_syntax = "twig"
+
diff --git a/.vim/autoload/beyondwords-vim-twig-6386c6d/vim-twig-addon-info.txt b/.vim/autoload/beyondwords-vim-twig-6386c6d/vim-twig-addon-info.txt
new file mode 100644
index 0000000..e08538a
--- /dev/null
+++ b/.vim/autoload/beyondwords-vim-twig-6386c6d/vim-twig-addon-info.txt
@@ -0,0 +1,9 @@
+{
+ "name" : "vim-twig",
+ "version" : "0.1",
+ "author" : "F. Gabriel Gosselin ",
+ "maintainer" : "F. Gabriel Gosselin ",
+ "repository": { "type" : "git", "url" : "git://github.com/beyondwords/vim-twig.git"},
+ "dependencies" : {},
+ "description" : "Support Twig template language"
+}
diff --git a/.vim/autoload/colorizer.vim b/.vim/autoload/colorizer.vim
new file mode 100644
index 0000000..19b10be
--- /dev/null
+++ b/.vim/autoload/colorizer.vim
@@ -0,0 +1,377 @@
+" colorizer.vim Colorize all text in the form #rrggbb or #rgb; autoload functions
+" Maintainer: lilydjwg
+" Version: 1.4.1
+" License: Vim License (see vim's :help license)
+"
+" See plugin/colorizer.vim for more info.
+
+let s:keepcpo = &cpo
+set cpo&vim
+
+function! s:FGforBG(bg) "{{{1
+ " takes a 6hex color code and returns a matching color that is visible
+ let pure = substitute(a:bg,'^#','','')
+ let r = eval('0x'.pure[0].pure[1])
+ let g = eval('0x'.pure[2].pure[3])
+ let b = eval('0x'.pure[4].pure[5])
+ let fgc = g:colorizer_fgcontrast
+ if r*30 + g*59 + b*11 > 12000
+ return s:predefined_fgcolors['dark'][fgc]
+ else
+ return s:predefined_fgcolors['light'][fgc]
+ end
+endfunction
+
+function! s:Rgb2xterm(color) "{{{1
+ " selects the nearest xterm color for a rgb value like #FF0000
+ let best_match=0
+ let smallest_distance = 10000000000
+ let r = eval('0x'.a:color[1].a:color[2])
+ let g = eval('0x'.a:color[3].a:color[4])
+ let b = eval('0x'.a:color[5].a:color[6])
+ let colortable = s:GetXterm2rgbTable()
+ for c in range(0,254)
+ let d = pow(colortable[c][0]-r,2) + pow(colortable[c][1]-g,2) + pow(colortable[c][2]-b,2)
+ if d=16 && a:color<=232
+ let l:color=a:color-16
+ let r = s:valuerange[(l:color/36)%6]
+ let g = s:valuerange[(l:color/6)%6]
+ let b = s:valuerange[l:color%6]
+ endif
+
+ " gray tone
+ if a:color>=233 && a:color<=253
+ let r=8+(a:color-232)*0x0a
+ let g=r
+ let b=r
+ endif
+ let rgb=[r,g,b]
+ return rgb
+endfunction
+
+function! s:SetMatcher(color, pat) "{{{1
+ " "color" is the converted color and "pat" is what to highlight
+ let group = 'Color' . strpart(a:color, 1)
+ if !hlexists(group) || s:force_group_update
+ let fg = g:colorizer_fgcontrast < 0 ? a:color : s:FGforBG(a:color)
+ if &t_Co == 256
+ exe 'hi '.group.' ctermfg='.s:Rgb2xterm(fg).' ctermbg='.s:Rgb2xterm(a:color)
+ endif
+ " Always set gui* as user may switch to GUI version and it's cheap
+ exe 'hi '.group.' guifg='.fg.' guibg='.a:color
+ endif
+ if !exists("w:colormatches[a:pat]")
+ let w:colormatches[a:pat] = matchadd(group, a:pat)
+ endif
+endfunction
+
+"ColorFinders {{{1
+function! s:HexCode(str, lineno) "{{{2
+ let ret = []
+ let place = 0
+ let colorpat = '#[0-9A-Fa-f]\{3\}\>\|#[0-9A-Fa-f]\{6\}\>'
+ while 1
+ let foundcolor = matchstr(a:str, colorpat, place)
+ if foundcolor == ''
+ break
+ endif
+ let place = matchend(a:str, colorpat, place)
+ let pat = foundcolor . '\>'
+ if len(foundcolor) == 4
+ let foundcolor = substitute(foundcolor, '[[:xdigit:]]', '&&', 'g')
+ endif
+ call add(ret, [foundcolor, pat])
+ endwhile
+ return ret
+endfunction
+
+function! s:RgbColor(str, lineno) "{{{2
+ let ret = []
+ let place = 0
+ let colorpat = '\ 255 || g > 255 || b > 255
+ break
+ endif
+ let pat = printf('\ 255 || ag > 255 || ab > 255
+ break
+ endif
+ let alpha = str2float(foundcolor[5])
+ if alpha < 0
+ let alpha = 0.0
+ elseif alpha > 1
+ let alpha = 1.0
+ endif
+ let pat = printf('\ 255
+ let r = 255
+ endif
+ if g > 255
+ let g = 255
+ endif
+ if b > 255
+ let b = 255
+ endif
+ let l:color = printf('#%02x%02x%02x', r, g, b)
+ call add(ret, [l:color, pat])
+ endwhile
+ return ret
+endfunction
+
+function! s:RgbaColorForTerm(str, lineno) "{{{2
+ let ret = []
+ let place = 0
+ let colorpat = '\ 255 || ag > 255 || ab > 255
+ break
+ endif
+ let pat = printf('\ 704 || v:version == 704 && has('patch143')
+ autocmd TextChangedI * silent call s:TextChanged()
+ else
+ " TextChangedI does not work as expected
+ autocmd CursorMovedI * silent call s:CursorMoved()
+ endif
+ else
+ autocmd CursorMoved,CursorMovedI * silent call s:CursorMoved()
+ endif
+ " rgba handles differently, so need updating
+ autocmd GUIEnter * silent call colorizer#ColorHighlight(1)
+ autocmd BufRead * silent call colorizer#ColorHighlight(1)
+ autocmd WinEnter * silent call colorizer#ColorHighlight(1)
+ autocmd ColorScheme * let s:force_group_update=1 | silent call colorizer#ColorHighlight(1)
+ augroup END
+endfunction
+
+function! colorizer#ColorClear() "{{{1
+ augroup Colorizer
+ au!
+ augroup END
+ let save_tab = tabpagenr()
+ let save_win = winnr()
+ tabdo windo call s:ClearMatches()
+ exe 'tabn '.save_tab
+ exe save_win . 'wincmd w'
+endfunction
+
+function! s:ClearMatches() "{{{1
+ if !exists('w:colormatches')
+ return
+ endif
+ for i in values(w:colormatches)
+ call matchdelete(i)
+ endfor
+ unlet w:colormatches
+endfunction
+
+function! colorizer#ColorToggle() "{{{1
+ if exists('#Colorizer#BufRead')
+ call colorizer#ColorClear()
+ echomsg 'Disabled color code highlighting.'
+ else
+ call colorizer#ColorHighlight(0)
+ echomsg 'Enabled color code highlighting.'
+ endif
+endfunction
+
+function! s:GetXterm2rgbTable()
+ if !exists('s:table_xterm2rgb')
+ let s:table_xterm2rgb = []
+ for c in range(0, 254)
+ let s:color = s:Xterm2rgb(c)
+ call add(s:table_xterm2rgb, s:color)
+ endfor
+ endif
+ return s:table_xterm2rgb
+endfun
+
+" Setups {{{1
+let s:ColorFinder = [function('s:HexCode'), function('s:RgbColor'), function('s:RgbaColor')]
+let s:force_group_update = 0
+let s:predefined_fgcolors = {}
+let s:predefined_fgcolors['dark'] = ['#444444', '#222222', '#000000']
+let s:predefined_fgcolors['light'] = ['#bbbbbb', '#dddddd', '#ffffff']
+if !exists("g:colorizer_fgcontrast")
+ " Default to black / white
+ let g:colorizer_fgcontrast = len(s:predefined_fgcolors['dark']) - 1
+elseif g:colorizer_fgcontrast >= len(s:predefined_fgcolors['dark'])
+ echohl WarningMsg
+ echo "g:colorizer_fgcontrast value invalid, using default"
+ echohl None
+ let g:colorizer_fgcontrast = len(s:predefined_fgcolors['dark']) - 1
+endif
+let s:saved_fgcontrast = g:colorizer_fgcontrast
+
+" Restoration and modelines {{{1
+let &cpo = s:keepcpo
+unlet s:keepcpo
+" vim:ft=vim:fdm=marker:fmr={{{,}}}:
diff --git a/.vim/autoload/conque_term.vim b/.vim/autoload/conque_term.vim
new file mode 100644
index 0000000..719d59e
--- /dev/null
+++ b/.vim/autoload/conque_term.vim
@@ -0,0 +1,1494 @@
+" FILE: autoload/conque_term.vim {{{
+" AUTHOR: Nico Raffo
+" WEBSITE: http://conque.googlecode.com
+" MODIFIED: 2011-04-04
+" VERSION: 2.1, for Vim 7.0
+" LICENSE:
+" Conque - Vim terminal/console emulator
+" Copyright (C) 2009-2011 Nico Raffo
+"
+" MIT License
+"
+" Permission is hereby granted, free of charge, to any person obtaining a copy
+" of this software and associated documentation files (the "Software"), to deal
+" in the Software without restriction, including without limitation the rights
+" to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+" copies of the Software, and to permit persons to whom the Software is
+" furnished to do so, subject to the following conditions:
+"
+" The above copyright notice and this permission notice shall be included in
+" all copies or substantial portions of the Software.
+"
+" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+" OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+" THE SOFTWARE.
+" }}}
+
+" **********************************************************************************************************
+" **** GLOBAL INITIALIZATION *******************************************************************************
+" **********************************************************************************************************
+
+" {{{
+
+" load plugin file if it hasn't already been loaded (e.g. conque_term#foo() is used in .vimrc)
+if !exists('g:ConqueTerm_Loaded')
+ runtime! plugin/conque_term.vim
+endif
+
+" path to conque install directories
+let s:scriptdir = expand(":h") . '/'
+let s:scriptdirpy = expand(":h") . '/conque_term/'
+
+" global list of terminal instances
+let s:term_obj = {'idx': 1, 'var': '', 'is_buffer': 1, 'active': 1, 'buffer_name': '', 'command': ''}
+let g:ConqueTerm_Terminals = {}
+
+" global lists of registered functions
+let s:hooks = { 'after_startup': [], 'buffer_enter': [], 'buffer_leave': [], 'after_keymap': [] }
+
+" required for session support
+if g:ConqueTerm_SessionSupport == 1
+ set sessionoptions+=globals
+ try
+ sil! let s:saved_terminals = eval(g:ConqueTerm_TerminalsString)
+ catch
+ let s:saved_terminals = {}
+ endtry
+endif
+
+" more session support
+let g:ConqueTerm_TerminalsString = ''
+
+" init terminal counter
+let g:ConqueTerm_Idx = 0
+
+" we clobber this value later
+let s:save_updatetime = &updatetime
+
+" have we called the init() function yet?
+let s:initialized = 0
+
+
+" }}}
+
+" **********************************************************************************************************
+" **** SYSTEM DETECTION ************************************************************************************
+" **********************************************************************************************************
+
+" {{{
+
+" Display various error messages
+function! conque_term#fail(feature) " {{{
+
+ " create a new buffer
+ new
+ setlocal buftype=nofile
+ setlocal nonumber
+ setlocal foldcolumn=0
+ setlocal wrap
+ setlocal noswapfile
+
+ " missing vim features
+ if a:feature == 'python'
+
+ call append('$', 'Conque ERROR: Python interface cannot be loaded')
+ call append('$', '')
+
+ if !executable("python")
+ call append('$', 'Your version of Vim appears to be installed without the Python interface. In ')
+ call append('$', 'addition, you may need to install Python.')
+ else
+ call append('$', 'Your version of Vim appears to be installed without the Python interface.')
+ endif
+
+ call append('$', '')
+
+ if has('unix') == 1
+ call append('$', "You are using a Unix-like operating system. Most, if not all, of the popular ")
+ call append('$', "Linux package managers have Python-enabled Vim available. For example ")
+ call append('$', "vim-gnome or vim-gtk on Ubuntu will get you everything you need.")
+ call append('$', "")
+ call append('$', "If you are compiling Vim from source, make sure you use the --enable-pythoninterp ")
+ call append('$', "configure option. You will also need to install Python and the Python headers.")
+ call append('$', "")
+ call append('$', "If you are using OS X, MacVim will give you Python support by default.")
+ else
+ call append('$', "You appear to be using Windows. The official Vim 7.3 installer available at ")
+ call append('$', "http://www.vim.org comes with the required Python interfaces. You will also ")
+ call append('$', "need to install Python 2.7 and/or Python 3.1, both available at http://www.python.org")
+ endif
+
+ elseif a:feature == 'python_exe'
+
+ call append('$', "Conque ERROR: Can't find Python executable")
+ call append('$', "")
+ call append('$', "Conque needs to know the full path to python.exe on Windows systems. By default, ")
+ call append('$', "Conque will check your system path as well as the most common installation path ")
+ call append('$', "C:\\PythonXX\\python.exe. To fix this error either:")
+ call append('$', "")
+ call append('$', "Set the g:ConqueTerm_PyExe option in your .vimrc. E.g.")
+ call append('$', " let g:ConqueTerm_PyExe = 'C:\Program Files\Python27\python.exe'")
+ call append('$', "")
+ call append('$', "Add the directory where you installed python to your system path. This isn't a bad ")
+ call append('$', "idea in general.")
+
+ elseif a:feature == 'ctypes'
+
+ call append('$', 'Conque ERROR: Python cannot load the ctypes module')
+ call append('$', "")
+ call append('$', "Conque requires the 'ctypes' python module. This has been a standard module since Python 2.5.")
+ call append('$', "")
+ call append('$', "The recommended fix is to make sure you're using the latest official GVim version 7.3, ")
+ call append('$', "and have at least one of the two compatible versions of Python installed, ")
+ call append('$', "2.7 or 3.1. You can download the GVim 7.3 installer from http://www.vim.org. You ")
+ call append('$', "can download the Python 2.7 or 3.1 installer from http://www.python.org")
+
+ endif
+
+endfunction " }}}
+
+" Go through various system checks before attempting to launch conque
+function! conque_term#dependency_check() " {{{
+
+ " don't recheck the second time 'round
+ if s:initialized == 1
+ return 1
+ endif
+
+ " choose a python version
+ let s:py = ''
+ if g:ConqueTerm_PyVersion == 3
+ let pytest = 'python3'
+ else
+ let pytest = 'python'
+ let g:ConqueTerm_PyVersion = 2
+ endif
+
+ " first test the requested version
+ if has(pytest)
+ if pytest == 'python3'
+ let s:py = 'py3'
+ else
+ let s:py = 'py'
+ endif
+
+ " otherwise use the other version
+ else
+ let py_alternate = 5 - g:ConqueTerm_PyVersion
+ if py_alternate == 3
+ let pytest = 'python3'
+ else
+ let pytest = 'python'
+ endif
+ if has(pytest)
+ echohl WarningMsg | echomsg "Python " . g:ConqueTerm_PyVersion . " interface is not installed, using Python " . py_alternate . " instead" | echohl None
+ let g:ConqueTerm_PyVersion = py_alternate
+ if pytest == 'python3'
+ let s:py = 'py3'
+ else
+ let s:py = 'py'
+ endif
+ endif
+ endif
+
+ " test if we actually found a python version
+ if s:py == ''
+ call conque_term#fail('python')
+ return 0
+ endif
+
+ " quick and dirty platform declaration
+ if has('unix') == 1
+ let s:platform = 'unix'
+ sil exe s:py . " CONQUE_PLATFORM = 'unix'"
+ else
+ let s:platform = 'windows'
+ sil exe s:py . " CONQUE_PLATFORM = 'windows'"
+ endif
+
+ " if we're using Windows, make sure ctypes is available
+ if s:platform == 'windows'
+ try
+ sil exe s:py . " import ctypes"
+ catch
+ call conque_term#fail('ctypes')
+ return 0
+ endtry
+ endif
+
+ " if we're using Windows, make sure we can finde python executable
+ if s:platform == 'windows' && conque_term#find_python_exe() == ''
+ call conque_term#fail('python_exe')
+ return 0
+ endif
+
+ " check for global cursorhold/cursormove events
+ let o = ''
+ silent redir => o
+ silent autocmd CursorHoldI,CursorMovedI
+ redir END
+ for line in split(o, "\n")
+ if line =~ '^ ' || line =~ '^--' || line =~ 'matchparen'
+ continue
+ endif
+ echohl WarningMsg | echomsg "Warning: Global CursorHoldI and CursorMovedI autocommands may cause ConqueTerm to run slowly." | echohl None
+ endfor
+
+ " check for compatible mode
+ if &compatible == 1
+ echohl WarningMsg | echomsg "Warning: Conque may not function normally in 'compatible' mode." | echohl None
+ endif
+
+ " check for fast mode
+ if g:ConqueTerm_FastMode
+ sil exe s:py . " CONQUE_FAST_MODE = True"
+ else
+ sil exe s:py . " CONQUE_FAST_MODE = False"
+ endif
+
+ " if we're all good, load python files
+ call conque_term#load_python()
+
+ return 1
+
+endfunction " }}}
+
+" }}}
+
+" **********************************************************************************************************
+" **** STARTUP MESSAGES ************************************************************************************
+" **********************************************************************************************************
+
+" {{{
+if g:ConqueTerm_StartMessages
+ let msg_file = s:scriptdirpy . 'version.vim'
+ let msg_show = 1
+ let msg_ct = 1
+
+ " we can write to conque_term directory
+ if filewritable(s:scriptdirpy) == 2
+
+ if filewritable(msg_file)
+
+ " read current message file
+ try
+ silent execute "source " . msg_file
+ if exists('g:ConqueTerm_MsgCt') && exists('g:ConqueTerm_MsgVer')
+ if g:ConqueTerm_MsgVer == g:ConqueTerm_Version && g:ConqueTerm_MsgCt > 2
+ let msg_show = 0
+ else
+ let msg_ct = g:ConqueTerm_MsgCt + 1
+ endif
+ endif
+ catch
+ endtry
+ endif
+
+ " update message file
+ if msg_show
+ let file_contents = ['let g:ConqueTerm_MsgCt = ' . msg_ct, 'let g:ConqueTerm_MsgVer = ' . g:ConqueTerm_Version]
+ call writefile(file_contents, msg_file)
+ endif
+ endif
+
+ " save our final decision
+ let g:ConqueTerm_StartMessages = msg_show
+endif
+" }}}
+
+" **********************************************************************************************************
+" **** WINDOWS VK CODES ************************************************************************************
+" **********************************************************************************************************
+
+" Windows Virtual Key Codes {{{
+let s:windows_vk = {
+\ 'VK_ADD' : 107,
+\ 'VK_APPS' : 93,
+\ 'VK_ATTN' : 246,
+\ 'VK_BACK' : 8,
+\ 'VK_BROWSER_BACK' : 166,
+\ 'VK_BROWSER_FORWARD' : 167,
+\ 'VK_CANCEL' : 3,
+\ 'VK_CAPITAL' : 20,
+\ 'VK_CLEAR' : 12,
+\ 'VK_CONTROL' : 17,
+\ 'VK_CONVERT' : 28,
+\ 'VK_CRSEL' : 247,
+\ 'VK_DECIMAL' : 110,
+\ 'VK_DELETE' : 46,
+\ 'VK_DIVIDE' : 111,
+\ 'VK_DOWN' : 40,
+\ 'VK_DOWN_CTL' : '40;1024',
+\ 'VK_END' : 35,
+\ 'VK_EREOF' : 249,
+\ 'VK_ESCAPE' : 27,
+\ 'VK_EXECUTE' : 43,
+\ 'VK_EXSEL' : 248,
+\ 'VK_F1' : 112,
+\ 'VK_F10' : 121,
+\ 'VK_F11' : 122,
+\ 'VK_F12' : 123,
+\ 'VK_F13' : 124,
+\ 'VK_F14' : 125,
+\ 'VK_F15' : 126,
+\ 'VK_F16' : 127,
+\ 'VK_F17' : 128,
+\ 'VK_F18' : 129,
+\ 'VK_F19' : 130,
+\ 'VK_F2' : 113,
+\ 'VK_F20' : 131,
+\ 'VK_F21' : 132,
+\ 'VK_F22' : 133,
+\ 'VK_F23' : 134,
+\ 'VK_F24' : 135,
+\ 'VK_F3' : 114,
+\ 'VK_F4' : 115,
+\ 'VK_F5' : 116,
+\ 'VK_F6' : 117,
+\ 'VK_F7' : 118,
+\ 'VK_F8' : 119,
+\ 'VK_F9' : 120,
+\ 'VK_FINAL' : 24,
+\ 'VK_HANGEUL' : 21,
+\ 'VK_HANGUL' : 21,
+\ 'VK_HANJA' : 25,
+\ 'VK_HELP' : 47,
+\ 'VK_HOME' : 36,
+\ 'VK_INSERT' : 45,
+\ 'VK_JUNJA' : 23,
+\ 'VK_KANA' : 21,
+\ 'VK_KANJI' : 25,
+\ 'VK_LBUTTON' : 1,
+\ 'VK_LCONTROL' : 162,
+\ 'VK_LEFT' : 37,
+\ 'VK_LEFT_CTL' : '37;1024',
+\ 'VK_LMENU' : 164,
+\ 'VK_LSHIFT' : 160,
+\ 'VK_LWIN' : 91,
+\ 'VK_MBUTTON' : 4,
+\ 'VK_MEDIA_NEXT_TRACK' : 176,
+\ 'VK_MEDIA_PLAY_PAUSE' : 179,
+\ 'VK_MEDIA_PREV_TRACK' : 177,
+\ 'VK_MENU' : 18,
+\ 'VK_MODECHANGE' : 31,
+\ 'VK_MULTIPLY' : 106,
+\ 'VK_NEXT' : 34,
+\ 'VK_NONAME' : 252,
+\ 'VK_NONCONVERT' : 29,
+\ 'VK_NUMLOCK' : 144,
+\ 'VK_NUMPAD0' : 96,
+\ 'VK_NUMPAD1' : 97,
+\ 'VK_NUMPAD2' : 98,
+\ 'VK_NUMPAD3' : 99,
+\ 'VK_NUMPAD4' : 100,
+\ 'VK_NUMPAD5' : 101,
+\ 'VK_NUMPAD6' : 102,
+\ 'VK_NUMPAD7' : 103,
+\ 'VK_NUMPAD8' : 104,
+\ 'VK_NUMPAD9' : 105,
+\ 'VK_OEM_CLEAR' : 254,
+\ 'VK_PA1' : 253,
+\ 'VK_PAUSE' : 19,
+\ 'VK_PLAY' : 250,
+\ 'VK_PRINT' : 42,
+\ 'VK_PRIOR' : 33,
+\ 'VK_PROCESSKEY' : 229,
+\ 'VK_RBUTTON' : 2,
+\ 'VK_RCONTROL' : 163,
+\ 'VK_RETURN' : 13,
+\ 'VK_RIGHT' : 39,
+\ 'VK_RIGHT_CTL' : '39;1024',
+\ 'VK_RMENU' : 165,
+\ 'VK_RSHIFT' : 161,
+\ 'VK_RWIN' : 92,
+\ 'VK_SCROLL' : 145,
+\ 'VK_SELECT' : 41,
+\ 'VK_SEPARATOR' : 108,
+\ 'VK_SHIFT' : 16,
+\ 'VK_SNAPSHOT' : 44,
+\ 'VK_SPACE' : 32,
+\ 'VK_SUBTRACT' : 109,
+\ 'VK_TAB' : 9,
+\ 'VK_UP' : 38,
+\ 'VK_UP_CTL' : '38;1024',
+\ 'VK_VOLUME_DOWN' : 174,
+\ 'VK_VOLUME_MUTE' : 173,
+\ 'VK_VOLUME_UP' : 175,
+\ 'VK_XBUTTON1' : 5,
+\ 'VK_XBUTTON2' : 6,
+\ 'VK_ZOOM' : 251
+\ }
+" }}}
+
+" **********************************************************************************************************
+" **** ACTUAL CONQUE FUNCTIONS! ***************************************************************************
+" **********************************************************************************************************
+
+" {{{
+
+" launch conque
+function! conque_term#open(...) "{{{
+ let command = get(a:000, 0, '')
+ let vim_startup_commands = get(a:000, 1, [])
+ let return_to_current = get(a:000, 2, 0)
+ let is_buffer = get(a:000, 3, 1)
+
+ " dependency check
+ if !conque_term#dependency_check()
+ return 0
+ endif
+
+ " switch to buffer if needed
+ if is_buffer && return_to_current
+ let save_sb = &switchbuf
+ sil set switchbuf=usetab
+ let current_buffer = bufname("%")
+ endif
+
+ " bare minimum validation
+ if s:py == ''
+ echohl WarningMsg | echomsg "Conque requires the Python interface to be installed. See :help ConqueTerm for more information." | echohl None
+ return 0
+ endif
+ if empty(command)
+ echohl WarningMsg | echomsg "Invalid usage: no program path given. Use :ConqueTerm YOUR PROGRAM, e.g. :ConqueTerm ipython" | echohl None
+ return 0
+ else
+ let cmd_args = split(command, '[^\\]\@<=\s')
+ let cmd_args[0] = substitute(cmd_args[0], '\\ ', ' ', 'g')
+ if !executable(cmd_args[0])
+ echohl WarningMsg | echomsg "Not an executable: " . cmd_args[0] | echohl None
+ return 0
+ endif
+ endif
+
+ " initialize global identifiers
+ let g:ConqueTerm_Idx += 1
+ let g:ConqueTerm_Var = 'ConqueTerm_' . g:ConqueTerm_Idx
+ let g:ConqueTerm_BufName = substitute(command, ' ', '\\ ', 'g') . "\\ -\\ " . g:ConqueTerm_Idx
+
+ " initialize global mappings if needed
+ call conque_term#init()
+
+ " set Vim buffer window options
+ if is_buffer
+ call conque_term#set_buffer_settings(command, vim_startup_commands)
+
+ let b:ConqueTerm_Idx = g:ConqueTerm_Idx
+ let b:ConqueTerm_Var = g:ConqueTerm_Var
+ endif
+
+ " save terminal instance
+ let t_obj = conque_term#create_terminal_object(g:ConqueTerm_Idx, is_buffer, g:ConqueTerm_BufName, command)
+ let g:ConqueTerm_Terminals[g:ConqueTerm_Idx] = t_obj
+
+ " required for session support
+ let g:ConqueTerm_TerminalsString = string(g:ConqueTerm_Terminals)
+
+ " open command
+ try
+ let options = {}
+ let options["TERM"] = g:ConqueTerm_TERM
+ let options["CODE_PAGE"] = g:ConqueTerm_CodePage
+ let options["color"] = g:ConqueTerm_Color
+ let options["offset"] = g:ConqueTerm_StartMessages * 10
+
+ if s:platform == 'unix'
+ execute s:py . ' ' . g:ConqueTerm_Var . ' = Conque()'
+ execute s:py . ' ' . g:ConqueTerm_Var . ".open()"
+ else
+ " find python.exe and communicator
+ let py_exe = conque_term#find_python_exe()
+ let py_vim = s:scriptdirpy . 'conque_sole_communicator.py'
+ execute s:py . ' ' . g:ConqueTerm_Var . ' = ConqueSole()'
+ execute s:py . ' ' . g:ConqueTerm_Var . ".open()"
+
+ if g:ConqueTerm_ColorMode == 'conceal'
+ call conque_term#init_conceal_color()
+ endif
+ endif
+ catch
+ echohl WarningMsg | echomsg "An error occurred: " . command | echohl None
+ return 0
+ endtry
+
+ " set key mappings and auto commands
+ if is_buffer
+ call conque_term#set_mappings('start')
+ endif
+
+ " call user defined functions
+ call conque_term#call_hooks('after_startup', t_obj)
+
+ " switch to buffer if needed
+ if is_buffer && return_to_current
+ sil exe ":sb " . current_buffer
+ sil exe ":set switchbuf=" . save_sb
+ elseif is_buffer
+ startinsert!
+ endif
+
+ return t_obj
+
+endfunction "}}}
+
+" open(), but no buffer
+function! conque_term#subprocess(command) " {{{
+
+ let t_obj = conque_term#open(a:command, [], 0, 0)
+ if !exists('b:ConqueTerm_Var')
+ call conque_term#on_blur()
+ sil exe s:py . ' ' . g:ConqueTerm_Var . '.idle()'
+ endif
+ return t_obj
+
+endfunction " }}}
+
+" set buffer options
+function! conque_term#set_buffer_settings(command, vim_startup_commands) "{{{
+
+ " optional hooks to execute, e.g. 'split'
+ for h in a:vim_startup_commands
+ sil exe h
+ endfor
+ sil exe 'edit ++enc=utf-8 ' . g:ConqueTerm_BufName
+
+ " buffer settings
+ setlocal fileencoding=utf-8 " file encoding, even tho there's no file
+ setlocal nopaste " conque won't work in paste mode
+ setlocal buftype=nofile " this buffer is not a file, you can't save it
+ setlocal nonumber " hide line numbers
+ if v:version >= 703
+ setlocal norelativenumber " hide relative line numbers (VIM >= 7.3)
+ endif
+ setlocal foldcolumn=0 " reasonable left margin
+ setlocal nowrap " default to no wrap (esp with MySQL)
+ setlocal noswapfile " don't bother creating a .swp file
+ setlocal scrolloff=0 " don't use buffer lines. it makes the 'clear' command not work as expected
+ setlocal sidescrolloff=0 " don't use buffer lines. it makes the 'clear' command not work as expected
+ setlocal sidescroll=1 " don't use buffer lines. it makes the 'clear' command not work as expected
+ setlocal foldmethod=manual " don't fold on {{{}}} and stuff
+ setlocal bufhidden=hide " when buffer is no longer displayed, don't wipe it out
+ setlocal noreadonly " this is not actually a readonly buffer
+ if v:version >= 703
+ setlocal conceallevel=3
+ setlocal concealcursor=nic
+ endif
+ setfiletype conque_term " useful
+ sil exe "setlocal syntax=" . g:ConqueTerm_Syntax
+
+ " temporary global settings go in here
+ call conque_term#on_focus(1)
+
+endfunction " }}}
+
+" send normal character key press to terminal
+function! conque_term#key_press() "{{{
+ sil exe s:py . ' ' . b:ConqueTerm_Var . ".write_ord(" . char2nr(v:char) . ")"
+ sil let v:char = ''
+endfunction " }}}
+
+" set key mappings and auto commands
+function! conque_term#set_mappings(action) "{{{
+
+ " set action {{{
+ if a:action == 'toggle'
+ if exists('b:conque_on') && b:conque_on == 1
+ let l:action = 'stop'
+ echohl WarningMsg | echomsg "Terminal is paused" | echohl None
+ else
+ let l:action = 'start'
+ echohl WarningMsg | echomsg "Terminal is resumed" | echohl None
+ endif
+ else
+ let l:action = a:action
+ endif
+
+ " if mappings are being removed, add 'un'
+ let map_modifier = 'nore'
+ if l:action == 'stop'
+ let map_modifier = 'un'
+ endif
+ " }}}
+
+ " auto commands {{{
+ if l:action == 'stop'
+ sil exe 'autocmd! ' . b:ConqueTerm_Var
+
+ else
+ sil exe 'augroup ' . b:ConqueTerm_Var
+
+ " handle unexpected closing of shell, passes HUP to parent and all child processes
+ sil exe 'autocmd ' . b:ConqueTerm_Var . ' BufUnload ' . s:py . ' ' . b:ConqueTerm_Var . '.close()'
+
+ " check for resized/scrolled buffer when entering buffer
+ sil exe 'autocmd ' . b:ConqueTerm_Var . ' BufEnter ' . s:py . ' ' . b:ConqueTerm_Var . '.update_window_size()'
+ sil exe 'autocmd ' . b:ConqueTerm_Var . ' VimResized ' . s:py . ' ' . b:ConqueTerm_Var . '.update_window_size()'
+
+ " set/reset updatetime on entering/exiting buffer
+ sil exe 'autocmd ' . b:ConqueTerm_Var . ' BufEnter call conque_term#on_focus()'
+ sil exe 'autocmd ' . b:ConqueTerm_Var . ' BufLeave call conque_term#on_blur()'
+
+ " reposition cursor when going into insert mode
+ sil exe 'autocmd ' . b:ConqueTerm_Var . ' InsertEnter ' . s:py . ' ' . b:ConqueTerm_Var . '.insert_enter()'
+
+ " poll for more output
+ sil exe 'autocmd ' . b:ConqueTerm_Var . ' CursorHoldI ' . s:py . ' ' . b:ConqueTerm_Var . '.auto_read()'
+ endif
+ " }}}
+
+ " map ASCII 1-31 {{{
+ for c in range(1, 31)
+ "
+ if c == 27 || c == 3
+ continue
+ endif
+ if l:action == 'start'
+ sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write_ord(' . c . ')'
+ else
+ sil exe 'i' . map_modifier . 'map '
+ endif
+ endfor
+ " bonus mapping: send in normal mode to terminal as well for panic interrupts
+ if l:action == 'start'
+ sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write_ord(3)'
+ sil exe 'n' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write_ord(3)'
+ else
+ sil exe 'i' . map_modifier . 'map '
+ sil exe 'n' . map_modifier . 'map '
+ endif
+
+ " leave insert mode
+ if !exists('g:ConqueTerm_EscKey') || g:ConqueTerm_EscKey == ''
+ " use to send to terminal
+ if l:action == 'start'
+ sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write_ord(27)'
+ else
+ sil exe 'i' . map_modifier . 'map '
+ endif
+ else
+ " use to send to terminal
+ if l:action == 'start'
+ sil exe 'i' . map_modifier . 'map ' . g:ConqueTerm_EscKey . ' '
+ sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write_ord(27)'
+ else
+ sil exe 'i' . map_modifier . 'map ' . g:ConqueTerm_EscKey
+ sil exe 'i' . map_modifier . 'map '
+ endif
+ endif
+
+ " Map in insert mode
+ if exists('g:ConqueTerm_CWInsert') && g:ConqueTerm_CWInsert == 1
+ inoremap j j
+ inoremap k k
+ inoremap h h
+ inoremap l l
+ inoremap
+ inoremap
+ inoremap
+ inoremap
+ inoremap
+ inoremap w w
+ endif
+ " }}}
+
+ " map 33 and beyond {{{
+ if exists('##InsertCharPre')
+ if l:action == 'start'
+ autocmd InsertCharPre call conque_term#key_press()
+ else
+ autocmd! InsertCharPre
+ endif
+ else
+ for i in range(33, 127)
+ "
+ if i == 124
+ if l:action == 'start'
+ sil exe "i" . map_modifier . "map :" . s:py . ' ' . b:ConqueTerm_Var . ".write_ord(124)"
+ else
+ sil exe "i" . map_modifier . "map "
+ endif
+ continue
+ endif
+ if l:action == 'start'
+ sil exe "i" . map_modifier . "map " . nr2char(i) . " :" . s:py . ' ' . b:ConqueTerm_Var . ".write_ord(" . i . ")"
+ else
+ sil exe "i" . map_modifier . "map " . nr2char(i)
+ endif
+ endfor
+ endif
+ " }}}
+
+ " Special keys {{{
+ if l:action == 'start'
+ if s:platform == 'unix'
+ sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write(u("\x08"))'
+ sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write(u(" "))'
+ sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write(u("\x1b[A"))'
+ sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write(u("\x1b[B"))'
+ sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write(u("\x1b[C"))'
+ sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write(u("\x1b[D"))'
+ sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write(u("\x1bOH"))'
+ sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write(u("\x1bOF"))'
+ else
+ sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write(u("\x08"))'
+ sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write(u(" "))'
+
+ sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write_vk(' . s:windows_vk.VK_UP . ')'
+ sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write_vk(' . s:windows_vk.VK_DOWN . ')'
+ sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write_vk(' . s:windows_vk.VK_RIGHT . ')'
+ sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write_vk(' . s:windows_vk.VK_LEFT . ')'
+
+ sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write_vk("' . s:windows_vk.VK_UP_CTL . '")'
+ sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write_vk("' . s:windows_vk.VK_DOWN_CTL . '")'
+ sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write_vk("' . s:windows_vk.VK_RIGHT_CTL . '")'
+ sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write_vk("' . s:windows_vk.VK_LEFT_CTL . '")'
+
+ sil exe 'i' . map_modifier . 'map :' . s:py . ' ' . b:ConqueTerm_Var . '.write_vk(' . s:windows_vk.VK_DELETE . ')'
+ sil exe 'i' . map_modifier . 'map