Browse Source

Configuration refactored

master
Simon Vieille 2 years ago
parent
commit
65ebd36472
100 changed files with 1 additions and 489682 deletions
  1. 1
    0
      .gitignore
  2. 0
    1
      .vim/UltiSnips/.svn/entries
  3. 0
    1
      .vim/UltiSnips/.svn/format
  4. 0
    3
      .vim/UltiSnips/.svn/pristine/1c/1c519a8fd27b8af6909c18ed00232eeca8c71673.svn-base
  5. 0
    39
      .vim/UltiSnips/.svn/pristine/41/41f42dd55ec2c08b0adc950e8340bdbf631a7997.svn-base
  6. 0
    77
      .vim/UltiSnips/.svn/pristine/c3/c385b8b67a7adf87194feda4ae35539c6e24a6a3.svn-base
  7. 0
    0
      .vim/UltiSnips/.svn/pristine/da/da39a3ee5e6b4b0d3255bfef95601890afd80709.svn-base
  8. BIN
      .vim/UltiSnips/.svn/wc.db
  9. 0
    34
      .vim/UltiSnips/xml.snippets
  10. 0
    20
      .vim/autoload/beyondwords-vim-twig-6386c6d/README.markdown
  11. 0
    5
      .vim/autoload/beyondwords-vim-twig-6386c6d/ftdetect/twig.vim
  12. 0
    18
      .vim/autoload/beyondwords-vim-twig-6386c6d/ftplugin/twig.vim
  13. 0
    46
      .vim/autoload/beyondwords-vim-twig-6386c6d/snippets/twig.snippets
  14. 0
    109
      .vim/autoload/beyondwords-vim-twig-6386c6d/syntax/twig.vim
  15. 0
    9
      .vim/autoload/beyondwords-vim-twig-6386c6d/vim-twig-addon-info.txt
  16. 0
    377
      .vim/autoload/colorizer.vim
  17. 0
    1494
      .vim/autoload/conque_term.vim
  18. 0
    1141
      .vim/autoload/conque_term/conque.py
  19. 0
    319
      .vim/autoload/conque_term/conque_globals.py
  20. 0
    230
      .vim/autoload/conque_term/conque_screen.py
  21. 0
    458
      .vim/autoload/conque_term/conque_sole.py
  22. 0
    183
      .vim/autoload/conque_term/conque_sole_communicator.py
  23. 0
    210
      .vim/autoload/conque_term/conque_sole_shared_memory.py
  24. 0
    762
      .vim/autoload/conque_term/conque_sole_subprocess.py
  25. 0
    278
      .vim/autoload/conque_term/conque_sole_wrapper.py
  26. 0
    198
      .vim/autoload/conque_term/conque_subprocess.py
  27. 0
    448
      .vim/autoload/conque_term/conque_win32_util.py
  28. 0
    659
      .vim/autoload/delimitMate.vim
  29. 0
    67
      .vim/autoload/gitv-1.1/README.markdown
  30. BIN
      .vim/autoload/gitv-1.1/doc/.DS_Store
  31. 0
    482
      .vim/autoload/gitv-1.1/doc/gitv.txt
  32. 0
    1075
      .vim/autoload/gitv-1.1/plugin/gitv.vim
  33. 0
    230
      .vim/autoload/pathogen.vim
  34. 0
    82
      .vim/autoload/php-cs-fixer.vim
  35. 0
    1
      .vim/autoload/zencoding-vim/.gitignore
  36. 0
    3
      .vim/autoload/zencoding-vim/.gitmodules
  37. 0
    11
      .vim/autoload/zencoding-vim/Makefile
  38. 0
    62
      .vim/autoload/zencoding-vim/README.mkd
  39. 0
    212
      .vim/autoload/zencoding-vim/TUTORIAL
  40. 0
    383
      .vim/autoload/zencoding-vim/doc/zencoding.txt
  41. 0
    528
      .vim/autoload/zencoding-vim/unittest.vim
  42. 0
    243
      .vim/autoload/zencoding-vim/zencoding.vim.vimup
  43. 0
    2164
      .vim/autoload/zencoding.vim
  44. 0
    2
      .vim/bundle/Vundle.vim/.gitignore
  45. 0
    111
      .vim/bundle/Vundle.vim/CONTRIBUTING.md
  46. 0
    7
      .vim/bundle/Vundle.vim/LICENSE-MIT.txt
  47. 0
    158
      .vim/bundle/Vundle.vim/README.md
  48. 0
    83
      .vim/bundle/Vundle.vim/autoload/vundle.vim
  49. 0
    278
      .vim/bundle/Vundle.vim/autoload/vundle/config.vim
  50. 0
    534
      .vim/bundle/Vundle.vim/autoload/vundle/installer.vim
  51. 0
    257
      .vim/bundle/Vundle.vim/autoload/vundle/scripts.vim
  52. 0
    22
      .vim/bundle/Vundle.vim/changelog.md
  53. 0
    397
      .vim/bundle/Vundle.vim/doc/vundle.txt
  54. 0
    20
      .vim/bundle/Vundle.vim/test/files/test.erl
  55. 0
    8
      .vim/bundle/Vundle.vim/test/minirc.vim
  56. 0
    81
      .vim/bundle/Vundle.vim/test/vimrc
  57. 0
    1
      .vim/bundle/ack.vim/.gitignore
  58. 0
    157
      .vim/bundle/ack.vim/README.md
  59. 0
    227
      .vim/bundle/ack.vim/autoload/ack.vim
  60. 0
    256
      .vim/bundle/ack.vim/doc/ack.txt
  61. 0
    14
      .vim/bundle/ack.vim/doc/ack_quick_help.txt
  62. 0
    9
      .vim/bundle/ack.vim/ftplugin/qf.vim
  63. 0
    79
      .vim/bundle/ack.vim/plugin/ack.vim
  64. 0
    1
      .vim/bundle/command-t/.gitattributes
  65. 0
    5
      .vim/bundle/command-t/.gitignore
  66. 0
    9
      .vim/bundle/command-t/.gitmodules
  67. 0
    8
      .vim/bundle/command-t/.mailmap
  68. 0
    1
      .vim/bundle/command-t/.rspec
  69. 0
    2
      .vim/bundle/command-t/.vim_org.yml
  70. 0
    7
      .vim/bundle/command-t/Gemfile
  71. 0
    48
      .vim/bundle/command-t/Gemfile.lock
  72. 0
    22
      .vim/bundle/command-t/LICENSE
  73. 0
    21
      .vim/bundle/command-t/Makefile
  74. 0
    1
      .vim/bundle/command-t/README.txt
  75. 0
    195
      .vim/bundle/command-t/Rakefile
  76. 0
    12
      .vim/bundle/command-t/appstream/vim-command-t.metainfo.xml
  77. 0
    177
      .vim/bundle/command-t/autoload/commandt.vim
  78. 0
    33
      .vim/bundle/command-t/bin/benchmarks/matcher.rb
  79. 0
    76
      .vim/bundle/command-t/bin/benchmarks/watchman.rb
  80. 0
    36
      .vim/bundle/command-t/command-t.gemspec
  81. 0
    10
      .vim/bundle/command-t/compile-test.sh
  82. 0
    471581
      .vim/bundle/command-t/data/benchmark.yml
  83. 0
    1
      .vim/bundle/command-t/doc/.gitignore
  84. 0
    1480
      .vim/bundle/command-t/doc/command-t.txt
  85. 0
    1
      .vim/bundle/command-t/fixtures/bar/abc
  86. 0
    1
      .vim/bundle/command-t/fixtures/bar/xyz
  87. 0
    1
      .vim/bundle/command-t/fixtures/baz
  88. 0
    1
      .vim/bundle/command-t/fixtures/bing
  89. 0
    1
      .vim/bundle/command-t/fixtures/foo/alpha/t1
  90. 0
    1
      .vim/bundle/command-t/fixtures/foo/alpha/t2
  91. 0
    1
      .vim/bundle/command-t/fixtures/foo/beta
  92. 0
    25
      .vim/bundle/command-t/multi-spec.sh
  93. 0
    26
      .vim/bundle/command-t/plugin/command-t.vim
  94. 0
    6
      .vim/bundle/command-t/ruby/command-t/.gitignore
  95. 0
    430
      .vim/bundle/command-t/ruby/command-t/controller.rb
  96. 0
    4
      .vim/bundle/command-t/ruby/command-t/depend
  97. 0
    40
      .vim/bundle/command-t/ruby/command-t/ext.c
  98. 0
    17
      .vim/bundle/command-t/ruby/command-t/ext.h
  99. 0
    38
      .vim/bundle/command-t/ruby/command-t/extconf.rb
  100. 0
    0
      .vim/bundle/command-t/ruby/command-t/finder.rb

+ 1
- 0
.gitignore View File

@@ -0,0 +1 @@
vim/bundle/*

+ 0
- 1
.vim/UltiSnips/.svn/entries View File

@@ -1 +0,0 @@
12

+ 0
- 1
.vim/UltiSnips/.svn/format View File

@@ -1 +0,0 @@
12

+ 0
- 3
.vim/UltiSnips/.svn/pristine/1c/1c519a8fd27b8af6909c18ed00232eeca8c71673.svn-base View File

@@ -1,3 +0,0 @@
snippet ! "!important"
!important
endsnippet

+ 0
- 39
.vim/UltiSnips/.svn/pristine/41/41f42dd55ec2c08b0adc950e8340bdbf631a7997.svn-base View File

@@ -1,39 +0,0 @@
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

+ 0
- 77
.vim/UltiSnips/.svn/pristine/c3/c385b8b67a7adf87194feda4ae35539c6e24a6a3.svn-base View File

@@ -1,77 +0,0 @@
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"
<?php

`!p snip.rv = os.popen('/home/simon/bin/namespace ' + path).readline().strip()`

use Trinity\Bundle\ContentManagerBundle\Model\Page;
use Trinity\Bundle\ContentManagerBundle\Model\Block;

class `!p snip.rv = snip.basename` extends Page
{
public function __construct($template = '$1')
{
parent::__construct($template);
}

public function getConfiguration()
{
return $this->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

+ 0
- 0
.vim/UltiSnips/.svn/pristine/da/da39a3ee5e6b4b0d3255bfef95601890afd80709.svn-base View File


BIN
.vim/UltiSnips/.svn/wc.db View File


+ 0
- 34
.vim/UltiSnips/xml.snippets View File

@@ -1,34 +0,0 @@
snippet trans "trans"
<trans-unit id="$1">
<source><![CDATA[$2]]></source>
<target><![CDATA[$3]]></target>
</trans-unit>
endsnippet

snippet schema "schema"
<?xml version="1.0" encoding="UTF-8"?>
<database defaultIdMethod="native" name="default" namespace="$1">
$2
</database>
endsnippet


snippet table "table"
<table name="$1" isCrossRef="$2">
<column name="id" type="INTEGER" primaryKey="true" required="true" autoIncrement="true"/>

<behavior name="timestampable"/>

<!--
<foreign-key foreignTable="foo" onDelete="none" onUpdate="cascade">
<reference local="foo_id" foreign="id"/>
</foreign-key>

<behavior name="sortable"/>
<behavior name="uploadable">
<parameter name="fields" value="picture"/>
<parameter name="paths" value="uploads/post/"/>
</behavior>
-->
</table>
endsnippet

+ 0
- 20
.vim/autoload/beyondwords-vim-twig-6386c6d/README.markdown View File

@@ -1,20 +0,0 @@
# 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

+ 0
- 5
.vim/autoload/beyondwords-vim-twig-6386c6d/ftdetect/twig.vim View File

@@ -1,5 +0,0 @@
" Twig
autocmd BufNewFile,BufRead *.twig set filetype=twig

" HTML Twig
autocmd BufNewFile,BufRead *.html.twig set filetype=html.twig

+ 0
- 18
.vim/autoload/beyondwords-vim-twig-6386c6d/ftplugin/twig.vim View File

@@ -1,18 +0,0 @@
" Vim filetype plugin
" Language: Twig
" Maintainer: F. Gabriel Gosselin <gabrielNOSPAM@evidens.ca>

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:

+ 0
- 46
.vim/autoload/beyondwords-vim-twig-6386c6d/snippets/twig.snippets View File

@@ -1,46 +0,0 @@
# Basic Twig snippets
# Maintainer: F. Gabriel Gosselin <gabrielNOSPAM@evidens.ca>

# 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}") }}

+ 0
- 109
.vim/autoload/beyondwords-vim-twig-6386c6d/syntax/twig.vim View File

@@ -1,109 +0,0 @@
" Vim syntax file
" Language: Twig template
" Maintainer: Gabriel Gosselin <gabrielNOSPAM@evidens.ca>
" Last Change: 2011 July 27
" Version: 1.0
"
" Based Jinja syntax by: Armin Ronacher <armin.ronacher@active-4.com>
"
" 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 /\<with\(out\)\?\s\+context\>/ 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 <args>
else
command -nargs=+ HiLink hi def link <args>
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"


+ 0
- 9
.vim/autoload/beyondwords-vim-twig-6386c6d/vim-twig-addon-info.txt View File

@@ -1,9 +0,0 @@
{
"name" : "vim-twig",
"version" : "0.1",
"author" : "F. Gabriel Gosselin <gabriel@evidens.ca>",
"maintainer" : "F. Gabriel Gosselin <gabriel@evidens.ca>",
"repository": { "type" : "git", "url" : "git://github.com/beyondwords/vim-twig.git"},
"dependencies" : {},
"description" : "Support Twig template language"
}

+ 0
- 377
.vim/autoload/colorizer.vim View File

@@ -1,377 +0,0 @@
" colorizer.vim Colorize all text in the form #rrggbb or #rgb; autoload functions
" Maintainer: lilydjwg <lilydjwg@gmail.com>
" 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<smallest_distance
let smallest_distance = d
let best_match = c
endif
endfor
return best_match
endfunction

"" the 6 value iterations in the xterm color cube {{{1
let s:valuerange = [0x00, 0x5F, 0x87, 0xAF, 0xD7, 0xFF]

"" 16 basic colors {{{1
let s:basic16 = [
\ [0x00, 0x00, 0x00], [0xCD, 0x00, 0x00],
\ [0x00, 0xCD, 0x00], [0xCD, 0xCD, 0x00],
\ [0x00, 0x00, 0xEE], [0xCD, 0x00, 0xCD],
\ [0x00, 0xCD, 0xCD], [0xE5, 0xE5, 0xE5],
\ [0x7F, 0x7F, 0x7F], [0xFF, 0x00, 0x00],
\ [0x00, 0xFF, 0x00], [0xFF, 0xFF, 0x00],
\ [0x5C, 0x5C, 0xFF], [0xFF, 0x00, 0xFF],
\ [0x00, 0xFF, 0xFF], [0xFF, 0xFF, 0xFF]]

function! s:Xterm2rgb(color) "{{{1
" 16 basic colors
let r = 0
let g = 0
let b = 0
if a:color<16
let r = s:basic16[a:color][0]
let g = s:basic16[a:color][1]
let b = s:basic16[a:color][2]
endif

" color cube color
if a:color>=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 = '\<rgb(\v\s*(\d+(\%)?)\s*,\s*(\d+%(\2))\s*,\s*(\d+%(\2))\s*\)'
while 1
let foundcolor = matchlist(a:str, colorpat, place)
if empty(foundcolor)
break
endif
let place = matchend(a:str, colorpat, place)
if foundcolor[2] == '%'
let r = foundcolor[1] * 255 / 100
let g = foundcolor[3] * 255 / 100
let b = foundcolor[4] * 255 / 100
else
let r = foundcolor[1]
let g = foundcolor[3]
let b = foundcolor[4]
endif
if r > 255 || g > 255 || b > 255
break
endif
let pat = printf('\<rgb(\v\s*%s\s*,\s*%s\s*,\s*%s\s*\)', foundcolor[1], foundcolor[3], foundcolor[4])
if foundcolor[2] == '%'
let pat = substitute(pat, '%', '\\%', 'g')
endif
let l:color = printf('#%02x%02x%02x', r, g, b)
call add(ret, [l:color, pat])
endwhile
return ret
endfunction

function! s:RgbaColor(str, lineno) "{{{2
if has("gui_running")
let bg = synIDattr(synIDtrans(hlID("Normal")), "bg")
let bg_r = str2nr(bg[1].bg[2], 16)
let bg_g = str2nr(bg[3].bg[4], 16)
let bg_b = str2nr(bg[5].bg[6], 16)
else
" translucent colors would display incorrectly, so ignore the alpha value
return s:RgbaColorForTerm(a:str, a:lineno)
endif
let ret = []
let place = 0
let colorpat = '\<rgba(\v\s*(\d+(\%)?)\s*,\s*(\d+%(\2))\s*,\s*(\d+%(\2))\s*,\s*(-?[.[:digit:]]+)\s*\)'
while 1
let foundcolor = matchlist(a:str, colorpat, place)
if empty(foundcolor)
break
endif
let place = matchend(a:str, colorpat, place)
if foundcolor[2] == '%'
let ar = foundcolor[1] * 255 / 100
let ag = foundcolor[3] * 255 / 100
let ab = foundcolor[4] * 255 / 100
else
let ar = foundcolor[1]
let ag = foundcolor[3]
let ab = foundcolor[4]
endif
if ar > 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('\<rgba(\v\s*%s\s*,\s*%s\s*,\s*%s\s*,\s*%s0*\s*\)', foundcolor[1], foundcolor[3], foundcolor[4], foundcolor[5])
if foundcolor[2] == '%'
let pat = substitute(pat, '%', '\\%', 'g')
endif
let r = float2nr(ceil(ar * alpha) + ceil(bg_r * (1 - alpha)))
let g = float2nr(ceil(ag * alpha) + ceil(bg_g * (1 - alpha)))
let b = float2nr(ceil(ab * alpha) + ceil(bg_b * (1 - alpha)))
if r > 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 = '\<rgba(\v\s*(\d+(\%)?)\s*,\s*(\d+%(\2))\s*,\s*(\d+%(\2))\s*,\s*(-?[.[:digit:]]+)\s*\)'
while 1
let foundcolor = matchlist(a:str, colorpat, place)
if empty(foundcolor)
break
endif
let place = matchend(a:str, colorpat, place)
if foundcolor[2] == '%'
let ar = foundcolor[1] * 255 / 100
let ag = foundcolor[3] * 255 / 100
let ab = foundcolor[4] * 255 / 100
else
let ar = foundcolor[1]
let ag = foundcolor[3]
let ab = foundcolor[4]
endif
if ar > 255 || ag > 255 || ab > 255
break
endif
let pat = printf('\<rgba(\v\s*%s\s*,\s*%s\s*,\s*%s\s*,\ze\s*(-?[.[:digit:]]+)\s*\)', foundcolor[1], foundcolor[3], foundcolor[4])
if foundcolor[2] == '%'
let pat = substitute(pat, '%', '\\%', 'g')
endif
let l:color = printf('#%02x%02x%02x', ar, ag, ab)
call add(ret, [l:color, pat])
endwhile
return ret
endfunction

function! s:PreviewColorInLine(where) "{{{1
let line = getline(a:where)
for Func in s:ColorFinder
let ret = Func(line, a:where)
" returned a list of a list: color as #rrggbb, text pattern to highlight
for r in ret
call s:SetMatcher(r[0], r[1])
endfor
endfor
endfunction

function! s:CursorMoved() "{{{1
if !exists('w:colormatches')
return
endif
if exists('b:colorizer_last_update')
if b:colorizer_last_update == b:changedtick
" Nothing changed
return
endif
endif
call s:PreviewColorInLine('.')
let b:colorizer_last_update = b:changedtick
endfunction

function! s:TextChanged() "{{{1
if !exists('w:colormatches')
return
endif
echomsg "TextChanged"
call s:PreviewColorInLine('.')
endfunction

function! colorizer#ColorHighlight(update, ...) "{{{1
if exists('w:colormatches')
if !a:update
return
endif
call s:ClearMatches()
endif
let w:colormatches = {}
if g:colorizer_fgcontrast != s:saved_fgcontrast || (exists("a:1") && a:1 == '!')
let s:force_group_update = 1
endif
for i in range(1, line("$"))
call s:PreviewColorInLine(i)
endfor
let s:force_group_update = 0
let s:saved_fgcontrast = g:colorizer_fgcontrast
augroup Colorizer
au!
if exists('##TextChanged')
autocmd TextChanged * silent call s:TextChanged()
if v:version > 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={{{,}}}:

+ 0
- 1494
.vim/autoload/conque_term.vim
File diff suppressed because it is too large
View File


+ 0
- 1141
.vim/autoload/conque_term/conque.py
File diff suppressed because it is too large
View File


+ 0
- 319
.vim/autoload/conque_term/conque_globals.py View File

@@ -1,319 +0,0 @@
# FILE: autoload/conque_term/conque_globals.py
# AUTHOR: Nico Raffo <nicoraffo@gmail.com>
# 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.

"""Common global constants and functions for Conque."""

import sys
import re




# PYTHON VERSION
CONQUE_PYTHON_VERSION = sys.version_info[0]

# Encoding

try:
# Vim's character encoding
import vim
CONQUE_VIM_ENCODING = vim.eval('&encoding')

except:
CONQUE_VIM_ENCODING = 'utf-8'


def u(str_val, str_encoding='utf-8', errors='strict'):
""" Foolhardy attempt to make unicode string syntax compatible with both python 2 and 3. """

if not str_val:
str_val = ''

if CONQUE_PYTHON_VERSION == 3:
return str_val

else:
return unicode(str_val, str_encoding, errors)

def uchr(str):
""" Foolhardy attempt to make unicode string syntax compatible with both python 2 and 3. """

if CONQUE_PYTHON_VERSION == 3:
return chr(str)

else:
return unichr(str)


# Logging
















# Unix escape sequence settings

CONQUE_CTL = {
1: 'soh', # start of heading
2: 'stx', # start of text
7: 'bel', # bell
8: 'bs', # backspace
9: 'tab', # tab
10: 'nl', # new line
13: 'cr', # carriage return
14: 'so', # shift out
15: 'si' # shift in
}
# 11 : 'vt', # vertical tab
# 12 : 'ff', # form feed

# Escape sequences
CONQUE_ESCAPE = {
'm': 'font',
'J': 'clear_screen',
'K': 'clear_line',
'@': 'add_spaces',
'A': 'cursor_up',
'B': 'cursor_down',
'C': 'cursor_right',
'D': 'cursor_left',
'G': 'cursor_to_column',
'H': 'cursor',
'P': 'delete_chars',
'f': 'cursor',
'g': 'tab_clear',
'r': 'set_coords',
'h': 'set',
'l': 'reset'
}
# 'L': 'insert_lines',
# 'M': 'delete_lines',
# 'd': 'cusor_vpos',

# Alternate escape sequences, no [
CONQUE_ESCAPE_PLAIN = {
'D': 'scroll_up',
'E': 'next_line',
'H': 'set_tab',
'M': 'scroll_down'
}
# 'N': 'single_shift_2',
# 'O': 'single_shift_3',
# '=': 'alternate_keypad',
# '>': 'numeric_keypad',
# '7': 'save_cursor',
# '8': 'restore_cursor',

# Character set escape sequences, with "("
CONQUE_ESCAPE_CHARSET = {
'A': 'uk',
'B': 'us',
'0': 'graphics'
}

# Uber alternate escape sequences, with # or ?
CONQUE_ESCAPE_QUESTION = {
'1h': 'new_line_mode',
'3h': '132_cols',
'4h': 'smooth_scrolling',
'5h': 'reverse_video',
'6h': 'relative_origin',
'7h': 'set_auto_wrap',
'8h': 'set_auto_repeat',
'9h': 'set_interlacing_mode',
'1l': 'set_cursor_key',
'2l': 'set_vt52',
'3l': '80_cols',
'4l': 'set_jump_scrolling',
'5l': 'normal_video',
'6l': 'absolute_origin',
'7l': 'reset_auto_wrap',
'8l': 'reset_auto_repeat',
'9l': 'reset_interlacing_mode'
}

CONQUE_ESCAPE_HASH = {
'8': 'screen_alignment_test'
}
# '3': 'double_height_top',
# '4': 'double_height_bottom',
# '5': 'single_height_single_width',
# '6': 'single_height_double_width',

CONQUE_GRAPHICS_SET = [
0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007,
0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F,
0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017,
0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F,
0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027,
0x0028, 0x0029, 0x002A, 0x2192, 0x2190, 0x2191, 0x2193, 0x002F,
0x2588, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F,
0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047,
0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E, 0x004F,
0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057,
0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E, 0x00A0,
0x25C6, 0x2592, 0x2409, 0x240C, 0x240D, 0x240A, 0x00B0, 0x00B1,
0x2591, 0x240B, 0x2518, 0x2510, 0x250C, 0x2514, 0x253C, 0xF800,
0xF801, 0x2500, 0xF803, 0xF804, 0x251C, 0x2524, 0x2534, 0x252C,
0x2502, 0x2264, 0x2265, 0x03C0, 0x2260, 0x00A3, 0x00B7, 0x007F,
0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087,
0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F,
0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097,
0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F,
0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7,
0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF,
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7,
0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF,
0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7,
0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF,
0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7,
0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF,
0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7,
0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF,
0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7,
0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF
]

# Font codes
CONQUE_FONT = {
0: {'description': 'Normal (default)', 'attributes': {'cterm': 'NONE', 'ctermfg': 'NONE', 'ctermbg': 'NONE', 'gui': 'NONE', 'guifg': 'NONE', 'guibg': 'NONE'}, 'normal': True},
1: {'description': 'Bold', 'attributes': {'cterm': 'BOLD', 'gui': 'BOLD'}, 'normal': False},
4: {'description': 'Underlined', 'attributes': {'cterm': 'UNDERLINE', 'gui': 'UNDERLINE'}, 'normal': False},
5: {'description': 'Blink (appears as Bold)', 'attributes': {'cterm': 'BOLD', 'gui': 'BOLD'}, 'normal': False},
7: {'description': 'Inverse', 'attributes': {'cterm': 'REVERSE', 'gui': 'REVERSE'}, 'normal': False},
8: {'description': 'Invisible (hidden)', 'attributes': {'ctermfg': '0', 'ctermbg': '0', 'guifg': '#000000', 'guibg': '#000000'}, 'normal': False},
22: {'description': 'Normal (neither bold nor faint)', 'attributes': {'cterm': 'NONE', 'gui': 'NONE'}, 'normal': True},
24: {'description': 'Not underlined', 'attributes': {'cterm': 'NONE', 'gui': 'NONE'}, 'normal': True},
25: {'description': 'Steady (not blinking)', 'attributes': {'cterm': 'NONE', 'gui': 'NONE'}, 'normal': True},
27: {'description': 'Positive (not inverse)', 'attributes': {'cterm': 'NONE', 'gui': 'NONE'}, 'normal': True},
28: {'description': 'Visible (not hidden)', 'attributes': {'ctermfg': 'NONE', 'ctermbg': 'NONE', 'guifg': 'NONE', 'guibg': 'NONE'}, 'normal': True},
30: {'description': 'Set foreground color to Black', 'attributes': {'ctermfg': '16', 'guifg': '#000000'}, 'normal': False},
31: {'description': 'Set foreground color to Red', 'attributes': {'ctermfg': '1', 'guifg': '#ff0000'}, 'normal': False},
32: {'description': 'Set foreground color to Green', 'attributes': {'ctermfg': '2', 'guifg': '#00ff00'}, 'normal': False},
33: {'description': 'Set foreground color to Yellow', 'attributes': {'ctermfg': '3', 'guifg': '#ffff00'}, 'normal': False},
34: {'description': 'Set foreground color to Blue', 'attributes': {'ctermfg': '4', 'guifg': '#0000ff'}, 'normal': False},
35: {'description': 'Set foreground color to Magenta', 'attributes': {'ctermfg': '5', 'guifg': '#990099'}, 'normal': False},
36: {'description': 'Set foreground color to Cyan', 'attributes': {'ctermfg': '6', 'guifg': '#009999'}, 'normal': False},
37: {'description': 'Set foreground color to White', 'attributes': {'ctermfg': '7', 'guifg': '#ffffff'}, 'normal': False},
39: {'description': 'Set foreground color to default (original)', 'attributes': {'ctermfg': 'NONE', 'guifg': 'NONE'}, 'normal': True},
40: {'description': 'Set background color to Black', 'attributes': {'ctermbg': '16', 'guibg': '#000000'}, 'normal': False},
41: {'description': 'Set background color to Red', 'attributes': {'ctermbg': '1', 'guibg': '#ff0000'}, 'normal': False},
42: {'description': 'Set background color to Green', 'attributes': {'ctermbg': '2', 'guibg': '#00ff00'}, 'normal': False},
43: {'description': 'Set background color to Yellow', 'attributes': {'ctermbg': '3', 'guibg': '#ffff00'}, 'normal': False},
44: {'description': 'Set background color to Blue', 'attributes': {'ctermbg': '4', 'guibg': '#0000ff'}, 'normal': False},
45: {'description': 'Set background color to Magenta', 'attributes': {'ctermbg': '5', 'guibg': '#990099'}, 'normal': False},
46: {'description': 'Set background color to Cyan', 'attributes': {'ctermbg': '6', 'guibg': '#009999'}, 'normal': False},
47: {'description': 'Set background color to White', 'attributes': {'ctermbg': '7', 'guibg': '#ffffff'}, 'normal': False},
49: {'description': 'Set background color to default (original).', 'attributes': {'ctermbg': 'NONE', 'guibg': 'NONE'}, 'normal': True},
90: {'description': 'Set foreground color to Black', 'attributes': {'ctermfg': '8', 'guifg': '#000000'}, 'normal': False},
91: {'description': 'Set foreground color to Red', 'attributes': {'ctermfg': '9', 'guifg': '#ff0000'}, 'normal': False},
92: {'description': 'Set foreground color to Green', 'attributes': {'ctermfg': '10', 'guifg': '#00ff00'}, 'normal': False},
93: {'description': 'Set foreground color to Yellow', 'attributes': {'ctermfg': '11', 'guifg': '#ffff00'}, 'normal': False},
94: {'description': 'Set foreground color to Blue', 'attributes': {'ctermfg': '12', 'guifg': '#0000ff'}, 'normal': False},
95: {'description': 'Set foreground color to Magenta', 'attributes': {'ctermfg': '13', 'guifg': '#990099'}, 'normal': False},
96: {'description': 'Set foreground color to Cyan', 'attributes': {'ctermfg': '14', 'guifg': '#009999'}, 'normal': False},
97: {'description': 'Set foreground color to White', 'attributes': {'ctermfg': '15', 'guifg': '#ffffff'}, 'normal': False},
100: {'description': 'Set background color to Black', 'attributes': {'ctermbg': '8', 'guibg': '#000000'}, 'normal': False},
101: {'description': 'Set background color to Red', 'attributes': {'ctermbg': '9', 'guibg': '#ff0000'}, 'normal': False},
102: {'description': 'Set background color to Green', 'attributes': {'ctermbg': '10', 'guibg': '#00ff00'}, 'normal': False},
103: {'description': 'Set background color to Yellow', 'attributes': {'ctermbg': '11', 'guibg': '#ffff00'}, 'normal': False},
104: {'description': 'Set background color to Blue', 'attributes': {'ctermbg': '12', 'guibg': '#0000ff'}, 'normal': False},
105: {'description': 'Set background color to Magenta', 'attributes': {'ctermbg': '13', 'guibg': '#990099'}, 'normal': False},
106: {'description': 'Set background color to Cyan', 'attributes': {'ctermbg': '14', 'guibg': '#009999'}, 'normal': False},
107: {'description': 'Set background color to White', 'attributes': {'ctermbg': '15', 'guibg': '#ffffff'}, 'normal': False}
}


# regular expression matching (almost) all control sequences
CONQUE_SEQ_REGEX = re.compile("(\x1b\[?\??#?[0-9;]*[a-zA-Z0-9@=>]|\x1b\][0-9];.*?\x07|[\x01-\x0f]|\x1b\([AB0])")
CONQUE_SEQ_REGEX_CTL = re.compile("^[\x01-\x0f]$")
CONQUE_SEQ_REGEX_CSI = re.compile("^\x1b\[")
CONQUE_SEQ_REGEX_TITLE = re.compile("^\x1b\]")
CONQUE_SEQ_REGEX_HASH = re.compile("^\x1b#")
CONQUE_SEQ_REGEX_ESC = re.compile("^\x1b.$")
CONQUE_SEQ_REGEX_CHAR = re.compile("^\x1b[()]")

# match table output
CONQUE_TABLE_OUTPUT = re.compile("^\s*\|\s.*\s\|\s*$|^\s*\+[=+-]+\+\s*$")

# basic terminal colors
CONQUE_COLOR_SEQUENCE = (
'000', '009', '090', '099', '900', '909', '990', '999',
'000', '00f', '0f0', '0ff', 'f00', 'f0f', 'ff0', 'fff'
)


# Windows subprocess constants

# shared memory size
CONQUE_SOLE_BUFFER_LENGTH = 1000
CONQUE_SOLE_INPUT_SIZE = 1000
CONQUE_SOLE_STATS_SIZE = 1000
CONQUE_SOLE_COMMANDS_SIZE = 255
CONQUE_SOLE_RESCROLL_SIZE = 255
CONQUE_SOLE_RESIZE_SIZE = 255

# interval of screen redraw
# larger number means less frequent
CONQUE_SOLE_SCREEN_REDRAW = 50

# interval of full buffer redraw
# larger number means less frequent
CONQUE_SOLE_BUFFER_REDRAW = 500

# interval of full output bucket replacement
# larger number means less frequent, 1 = every time
CONQUE_SOLE_MEM_REDRAW = 1000

# maximum number of lines with terminal colors
# ignored if g:ConqueTerm_Color = 2
CONQUE_MAX_SYNTAX_LINES = 200

# windows input splitting on special keys
CONQUE_WIN32_REGEX_VK = re.compile("(\x1b\[[0-9;]+VK)")

# windows attribute string splitting
CONQUE_WIN32_REGEX_ATTR = re.compile("((.)\\2*)", re.DOTALL)

# special key attributes
CONQUE_VK_ATTR_CTRL_PRESSED = u('1024')



+ 0
- 230
.vim/autoload/conque_term/conque_screen.py View File

@@ -1,230 +0,0 @@
# FILE: autoload/conque_term/conque_screen.py
# AUTHOR: Nico Raffo <nicoraffo@gmail.com>
# 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.

"""
ConqueScreen is an extention of the vim.current.buffer object

Unix terminal escape sequences usually reference line numbers relative to the
top of the visible screen. However the visible portion of the Vim buffer
representing the terminal probably doesn't start at the first line of the
buffer.

The ConqueScreen class allows access to the Vim buffer with screen-relative
line numbering. And handles a few other related tasks, such as setting the
correct cursor position.

E.g.:
s = ConqueScreen()
...
s[5] = 'Set 5th line in terminal to this line'
s.append('Add new line to terminal')
s[5] = 'Since previous append() command scrolled the terminal down, this is a different line than first cb[5] call'

"""

import vim


class ConqueScreen(object):

# the buffer
buffer = None

# screen and scrolling regions
screen_top = 1

# screen width
screen_width = 80
screen_height = 80

# char encoding for vim buffer
screen_encoding = 'utf-8'


def __init__(self):
""" Initialize screen size and character encoding. """

self.buffer = vim.current.buffer

# initialize screen size
self.screen_top = 1
self.screen_width = vim.current.window.width
self.screen_height = vim.current.window.height

# save screen character encoding type
self.screen_encoding = vim.eval('&fileencoding')


def __len__(self):
""" Define the len() function for ConqueScreen objects. """
return len(self.buffer)


def __getitem__(self, key):
""" Define value access for ConqueScreen objects. """
buffer_line = self.get_real_idx(key)

# if line is past buffer end, add lines to buffer
if buffer_line >= len(self.buffer):
for i in range(len(self.buffer), buffer_line + 1):
self.append(' ')

return u(self.buffer[buffer_line], 'utf-8')


def __setitem__(self, key, value):
""" Define value assignments for ConqueScreen objects. """
buffer_line = self.get_real_idx(key)

if CONQUE_PYTHON_VERSION == 2:
val = value.encode(self.screen_encoding)
else:
# XXX / Vim's python3 interface doesn't accept bytes object
val = str(value)

# if line is past end of screen, append
if buffer_line == len(self.buffer):
self.buffer.append(val)
else:
self.buffer[buffer_line] = val


def __delitem__(self, key):
""" Define value deletion for ConqueScreen objects. """
del self.buffer[self.screen_top + key - 2]


def append(self, value):
""" Define value appending for ConqueScreen objects. """

if len(self.buffer) > self.screen_top + self.screen_height - 1:
self.buffer[len(self.buffer) - 1] = value
else:
self.buffer.append(value)

if len(self.buffer) > self.screen_top + self.screen_height - 1:
self.screen_top += 1

if vim.current.buffer.number == self.buffer.number:
vim.command('normal! G')


def insert(self, line, value):
""" Define value insertion for ConqueScreen objects. """

l = self.screen_top + line - 2
self.buffer.append(value, l)


def get_top(self):
""" Get the Vim line number representing the top of the visible terminal. """
return self.screen_top


def get_real_idx(self, line):
""" Get the zero index Vim line number corresponding to the provided screen line. """
return (self.screen_top + line - 2)


def get_buffer_line(self, line):
""" Get the Vim line number corresponding to the provided screen line. """
return (self.screen_top + line - 1)


def set_screen_width(self, width):
""" Set the screen width. """
self.screen_width = width


def clear(self):
""" Clear the screen. Does not clear the buffer, just scrolls down past all text. """

self.screen_width = width
self.buffer.append(' ')
vim.command('normal! Gzt')
self.screen_top = len(self.buffer)


def set_cursor(self, line, column):
""" Set cursor position. """

# figure out line
buffer_line = self.screen_top + line - 1
if buffer_line > len(self.buffer):
for l in range(len(self.buffer) - 1, buffer_line):
self.buffer.append('')

# figure out column
real_column = column
if len(self.buffer[buffer_line - 1]) < real_column:
self.buffer[buffer_line - 1] = self.buffer[buffer_line - 1] + ' ' * (real_column - len(self.buffer[buffer_line - 1]))

if not CONQUE_FAST_MODE:
# set cursor at byte index of real_column'th character
vim.command('call cursor(' + str(buffer_line) + ', byteidx(getline(' + str(buffer_line) + '), ' + str(real_column) + '))')

else:
# old version
# python version is occasionally grumpy
try:
vim.current.window.cursor = (buffer_line, real_column - 1)
except:
vim.command('call cursor(' + str(buffer_line) + ', ' + str(real_column) + ')')


def reset_size(self, line):
""" Change screen size """





# save cursor line number
buffer_line = self.screen_top + line

# reset screen size
self.screen_width = vim.current.window.width
self.screen_height = vim.current.window.height
self.screen_top = len(self.buffer) - vim.current.window.height + 1
if self.screen_top < 1:
self.screen_top = 1


# align bottom of buffer to bottom of screen
vim.command('normal! ' + str(self.screen_height) + 'kG')

# return new relative line number
return (buffer_line - self.screen_top)


def align(self):
""" align bottom of buffer to bottom of screen """
vim.command('normal! ' + str(self.screen_height) + 'kG')



+ 0
- 458
.vim/autoload/conque_term/conque_sole.py View File

@@ -1,458 +0,0 @@
# FILE: autoload/conque_term/conque_sole.py
# AUTHOR: Nico Raffo <nicoraffo@gmail.com>
# 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.

"""
Windows Console Emulator

This is the main interface to the Windows emulator. It reads new output from the background console
and updates the Vim buffer.
"""

import vim


class ConqueSole(Conque):

window_top = None
window_bottom = None

color_cache = {}
attribute_cache = {}
color_mode = None
color_conceals = {}

buffer = None
encoding = None

# counters for periodic rendering
buffer_redraw_ct = 1
screen_redraw_ct = 1

# line offset, shifts output down
offset = 0


def open(self):
""" Start command and initialize this instance

Arguments:
command - Command string, e.g. "Powershell.exe"
options - Dictionary of config options
python_exe - Path to the python.exe executable. Usually C:\PythonXX\python.exe
communicator_py - Path to subprocess controller script in user's vimfiles directory
"""
# get arguments
command = vim.eval('command')
options = vim.eval('options')
python_exe = vim.eval('py_exe')
communicator_py = vim.eval('py_vim')

# init size
self.columns = vim.current.window.width
self.lines = vim.current.window.height
self.window_top = 0
self.window_bottom = vim.current.window.height - 1

# color mode
self.color_mode = vim.eval('g:ConqueTerm_ColorMode')

# line offset
self.offset = int(options['offset'])

# init color
self.enable_colors = options['color'] and not CONQUE_FAST_MODE

# open command
self.proc = ConqueSoleWrapper()
self.proc.open(command, self.lines, self.columns, python_exe, communicator_py, options)

self.buffer = vim.current.buffer
self.screen_encoding = vim.eval('&fileencoding')


def read(self, timeout=1, set_cursor=True, return_output=False, update_buffer=True):
""" Read from console and update Vim buffer. """

try:
stats = self.proc.get_stats()

if not stats:
return

# disable screen and buffer redraws in fast mode
if not CONQUE_FAST_MODE:
self.buffer_redraw_ct += 1
self.screen_redraw_ct += 1

update_top = 0
update_bottom = 0
lines = []

# full buffer redraw, our favorite!
#if self.buffer_redraw_ct == CONQUE_SOLE_BUFFER_REDRAW:
# self.buffer_redraw_ct = 0
# update_top = 0
# update_bottom = stats['top_offset'] + self.lines
# (lines, attributes) = self.proc.read(update_top, update_bottom)
# if return_output:
# output = self.get_new_output(lines, update_top, stats)
# if update_buffer:
# for i in range(update_top, update_bottom + 1):
# if CONQUE_FAST_MODE:
# self.plain_text(i, lines[i], None, stats)
# else:
# self.plain_text(i, lines[i], attributes[i], stats)

# full screen redraw
if stats['cursor_y'] + 1 != self.l or stats['top_offset'] != self.window_top or self.screen_redraw_ct >= CONQUE_SOLE_SCREEN_REDRAW:

self.screen_redraw_ct = 0
update_top = self.window_top
update_bottom = max([stats['top_offset'] + self.lines + 1, stats['cursor_y']])
(lines, attributes) = self.proc.read(update_top, update_bottom - update_top + 1)
if return_output:
output = self.get_new_output(lines, update_top, stats)
if update_buffer:
for i in range(update_top, update_bottom + 1):
if CONQUE_FAST_MODE:
self.plain_text(i, lines[i - update_top], None, stats)
else:
self.plain_text(i, lines[i - update_top], attributes[i - update_top], stats)


# single line redraw
else:
update_top = stats['cursor_y']
(lines, attributes) = self.proc.read(update_top, 1)
if return_output:
output = self.get_new_output(lines, update_top, stats)
if update_buffer:
if lines[0].rstrip() != u(self.buffer[update_top].rstrip()):
if CONQUE_FAST_MODE:
self.plain_text(update_top, lines[0], None, stats)
else:
self.plain_text(update_top, lines[0], attributes[0], stats)


# reset current position
self.window_top = stats['top_offset']
self.l = stats['cursor_y'] + 1
self.c = stats['cursor_x'] + 1

# reposition cursor if this seems plausible
if set_cursor:
self.set_cursor(self.l, self.c)

if return_output:
return output

except:

pass


def get_new_output(self, lines, update_top, stats):
""" Calculate the "new" output from this read. Fake but useful """

if not (stats['cursor_y'] + 1 > self.l or (stats['cursor_y'] + 1 == self.l and stats['cursor_x'] + 1 > self.c)):
return ""






try:
num_to_return = stats['cursor_y'] - self.l + 2

lines = lines[self.l - update_top - 1:]


new_output = []

# first line
new_output.append(lines[0][self.c - 1:].rstrip())

# the rest
for i in range(1, num_to_return):
new_output.append(lines[i].rstrip())

except:

pass



return "\n".join(new_output)


def plain_text(self, line_nr, text, attributes, stats):
""" Write plain text to Vim buffer. """





# handle line offset
line_nr += self.offset

self.l = line_nr + 1

# remove trailing whitespace
text = text.rstrip()

# if we're using concealed text for color, then s- is weird
if self.color_mode == 'conceal':

text = self.add_conceal_color(text, attributes, stats, line_nr)


# deal with character encoding
if CONQUE_PYTHON_VERSION == 2:
val = text.encode(self.screen_encoding)
else:
# XXX / Vim's python3 interface doesn't accept bytes object
val = str(text)

# update vim buffer
if len(self.buffer) <= line_nr:
self.buffer.append(val)
else:
self.buffer[line_nr] = val

if self.enable_colors and not self.color_mode == 'conceal' and line_nr > self.l - CONQUE_MAX_SYNTAX_LINES:
relevant = attributes[0:len(text)]
if line_nr not in self.attribute_cache or self.attribute_cache[line_nr] != relevant:
self.do_color(attributes=relevant, stats=stats)
self.attribute_cache[line_nr] = relevant


def add_conceal_color(self, text, attributes, stats, line_nr):
""" Add 'conceal' color strings to output text """

# stop here if coloration is disabled
if not self.enable_colors:
return text

# if no colors for this line, clear everything out
if len(attributes) == 0 or attributes == u(chr(stats['default_attribute'])) * len(attributes):
return text

new_text = ''
self.color_conceals[line_nr] = []

attribute_chunks = CONQUE_WIN32_REGEX_ATTR.findall(attributes)
offset = 0
ends = []
for attr in attribute_chunks:
attr_num = ord(attr[1])
ends = []
if attr_num != stats['default_attribute']:

color = self.translate_color(attr_num)

new_text += chr(27) + 'sf' + color['fg_code'] + ';'
ends.append(chr(27) + 'ef' + color['fg_code'] + ';')
self.color_conceals[line_nr].append(offset)

if attr_num > 15:
new_text += chr(27) + 'sb' + color['bg_code'] + ';'
ends.append(chr(27) + 'eb' + color['bg_code'] + ';')
self.color_conceals[line_nr].append(offset)

new_text += text[offset:offset + len(attr[0])]

# close color regions
ends.reverse()
for i in range(0, len(ends)):
self.color_conceals[line_nr].append(len(new_text))
new_text += ends[i]

offset += len(attr[0])

return new_text


def do_color(self, start=0, end=0, attributes='', stats=None):
""" Convert Windows console attributes into Vim syntax highlighting """

# if no colors for this line, clear everything out
if len(attributes) == 0 or attributes == u(chr(stats['default_attribute'])) * len(attributes):
self.color_changes = {}
self.apply_color(1, len(attributes), self.l)
return

attribute_chunks = CONQUE_WIN32_REGEX_ATTR.findall(attributes)
offset = 0
for attr in attribute_chunks:
attr_num = ord(attr[1])
if attr_num != stats['default_attribute']:
self.color_changes = self.translate_color(attr_num)
self.apply_color(offset + 1, offset + len(attr[0]) + 1, self.l)
offset += len(attr[0])


def translate_color(self, attr):
""" Convert Windows console attributes into RGB colors """

# check for cached color
if attr in self.color_cache:
return self.color_cache[attr]






# convert attribute integer to bit string
bit_str = bin(attr)
bit_str = bit_str.replace('0b', '')

# slice foreground and background portions of bit string
fg = bit_str[-4:].rjust(4, '0')
bg = bit_str[-8:-4].rjust(4, '0')

# ok, first create foreground #rbg
red = int(fg[1]) * 204 + int(fg[0]) * int(fg[1]) * 51
green = int(fg[2]) * 204 + int(fg[0]) * int(fg[2]) * 51
blue = int(fg[3]) * 204 + int(fg[0]) * int(fg[3]) * 51
fg_str = "#%02x%02x%02x" % (red, green, blue)
fg_code = "%02x%02x%02x" % (red, green, blue)
fg_code = fg_code[0] + fg_code[2] + fg_code[4]

# ok, first create foreground #rbg
red = int(bg[1]) * 204 + int(bg[0]) * int(bg[1]) * 51
green = int(bg[2]) * 204 + int(bg[0]) * int(bg[2]) * 51
blue = int(bg[3]) * 204 + int(bg[0]) * int(bg[3]) * 51
bg_str = "#%02x%02x%02x" % (red, green, blue)
bg_code = "%02x%02x%02x" % (red, green, blue)
bg_code = bg_code[0] + bg_code[2] + bg_code[4]

# build value for color_changes

color = {'guifg': fg_str, 'guibg': bg_str}

if self.color_mode == 'conceal':
color['fg_code'] = fg_code
color['bg_code'] = bg_code

self.color_cache[attr] = color

return color


def write_vk(self, vk_code):
""" write virtual key code to shared memory using proprietary escape seq """

self.proc.write_vk(vk_code)


def update_window_size(self):
""" Resize underlying console if Vim buffer size has changed """

if vim.current.window.width != self.columns or vim.current.window.height != self.lines:



# reset all window size attributes to default
self.columns = vim.current.window.width
self.lines = vim.current.window.height
self.working_columns = vim.current.window.width
self.working_lines = vim.current.window.height
self.bottom = vim.current.window.height

self.proc.window_resize(vim.current.window.height, vim.current.window.width)


def set_cursor(self, line, column):
""" Update cursor position in Vim buffer """



# handle offset
line += self.offset

# shift cursor position to handle concealed text
if self.enable_colors and self.color_mode == 'conceal':
if line - 1 in self.color_conceals:
for c in self.color_conceals[line - 1]:
if c < column:
column += 7
else:
break



# figure out line
buffer_line = line
if buffer_line > len(self.buffer):
for l in range(len(self.buffer) - 1, buffer_line):
self.buffer.append('')

# figure out column
real_column = column
if len(self.buffer[buffer_line - 1]) < real_column:
self.buffer[buffer_line - 1] = self.buffer[buffer_line - 1] + ' ' * (real_column - len(self.buffer[buffer_line - 1]))

# python version is occasionally grumpy
try:
vim.current.window.cursor = (buffer_line, real_column - 1)
except:
vim.command('call cursor(' + str(buffer_line) + ', ' + str(real_column) + ')')


def idle(self):
""" go into idle mode """

self.proc.idle()


def resume(self):
""" resume from idle mode """

self.proc.resume()


def close(self):
""" end console subprocess """
self.proc.close()


def abort(self):
""" end subprocess forcefully """
self.proc.close()


def get_buffer_line(self, line):
""" get buffer line """
return line


# vim:foldmethod=marker

+ 0
- 183
.vim/autoload/conque_term/conque_sole_communicator.py View File

@@ -1,183 +0,0 @@
# FILE: autoload/conque_term/conque_sole_communicator.py
# AUTHOR: Nico Raffo <nicoraffo@gmail.com>
# 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.

"""

ConqueSoleCommunicator

This script will create a new Windows console and start the requested program
inside of it. This process is launched independently from the parent Vim
program, so it has no access to the vim module.

The main loop in this script reads data from the console and syncs it onto
blocks of memory shared with the Vim process. In this way the Vim process
and this script can communicate with each other.

"""

import time
import sys

from conque_globals import *
from conque_win32_util import *
from conque_sole_subprocess import *
from conque_sole_shared_memory import *

##############################################################
# only run if this file was run directly

if __name__ == '__main__':

# attempt to catch ALL exceptions to fend of zombies
try:

# simple arg validation

if len(sys.argv) < 5:

exit()

# maximum time this thing reads. 0 means no limit. Only for testing.
max_loops = 0

# read interval, in seconds
sleep_time = 0.01

# idle read interval, in seconds
idle_sleep_time = 0.10

# are we idled?
is_idle = False

# mem key
mem_key = sys.argv[1]

# console width
console_width = int(sys.argv[2])

# console height
console_height = int(sys.argv[3])

# code page
code_page = int(sys.argv[4])

# code page
fast_mode = int(sys.argv[5])

# the actual subprocess to run
cmd_line = " ".join(sys.argv[6:])


# width and height
options = {'LINES': console_height, 'COLUMNS': console_width, 'CODE_PAGE': code_page, 'FAST_MODE': fast_mode}



# set initial idle status
shm_command = ConqueSoleSharedMemory(CONQUE_SOLE_COMMANDS_SIZE, 'command', mem_key, serialize=True)
shm_command.create('write')

cmd = shm_command.read()
if cmd:

if cmd['cmd'] == 'idle':
is_idle = True
shm_command.clear()


##############################################################
# Create the subprocess

proc = ConqueSoleSubprocess()
res = proc.open(cmd_line, mem_key, options)

if not res:

exit()

##############################################################
# main loop!

loops = 0

while True:

# check for idle/resume
if is_idle or loops % 25 == 0:

# check process health
if not proc.is_alive():

proc.close()
break

# check for change in buffer focus
cmd = shm_command.read()
if cmd:

if cmd['cmd'] == 'idle':
is_idle = True
shm_command.clear()

elif cmd['cmd'] == 'resume':
is_idle = False
shm_command.clear()


# sleep between loops if moderation is requested
if sleep_time > 0:
if is_idle:
time.sleep(idle_sleep_time)
else:
time.sleep(sleep_time)

# write, read, etc
proc.write()
proc.read()

# increment loops, and exit if max has been reached
loops += 1
if max_loops and loops >= max_loops:

break

##############################################################
# all done!



proc.close()

# if an exception was thrown, croak
except:

proc.close()


# vim:foldmethod=marker

+ 0
- 210
.vim/autoload/conque_term/conque_sole_shared_memory.py View File

@@ -1,210 +0,0 @@
# FILE: autoload/conque_term/conque_sole_shared_memory.py
# AUTHOR: Nico Raffo <nicoraffo@gmail.com>
# 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.

"""
Wrapper class for shared memory between Windows python processes

Adds a small amount of functionality to the standard mmap module.

"""

import mmap
import sys