From b1526c066d4d248fbfb397881c9ad36fbfbf4875 Mon Sep 17 00:00:00 2001 From: pqwy Date: Fri, 10 Feb 2017 17:38:33 +0000 Subject: [PATCH 1/4] make xml re-parsing a little faster --- autoload/coqtop.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autoload/coqtop.py b/autoload/coqtop.py index 688699a..3a181d0 100644 --- a/autoload/coqtop.py +++ b/autoload/coqtop.py @@ -1,7 +1,7 @@ import os import re import subprocess -import xml.etree.ElementTree as ET +import xml.etree.cElementTree as ET import signal from collections import deque, namedtuple @@ -165,7 +165,7 @@ def get_answer(): data = '' while True: try: - data += os.read(fd, 0x4000) + data += os.read(fd, 0x10000) try: elt = ET.fromstring('' + escape(data) + '') shouldWait = True From 570b06767310c17fe913ed86802f1f3f8f98f266 Mon Sep 17 00:00:00 2001 From: Emmanuel Beffara Date: Mon, 10 Apr 2017 13:42:18 +0200 Subject: [PATCH 2/4] Decode the input before building XML commands. --- autoload/coqtop.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autoload/coqtop.py b/autoload/coqtop.py index 233b60d..98bd75f 100644 --- a/autoload/coqtop.py +++ b/autoload/coqtop.py @@ -104,7 +104,7 @@ def encode_value(v): xml = build('bool', str(v).lower()) xml.text = str(v) return xml - elif isinstance(v, str): + elif isinstance(v, str) or isinstance(v, unicode): xml = build('string') xml.text = v return xml @@ -244,7 +244,7 @@ def cur_state(): def advance(cmd, encoding = 'utf-8'): global state_id - r = call('Add', ((cmd, -1), (cur_state(), True)), encoding) + r = call('Add', ((cmd.decode(encoding), -1), (cur_state(), True)), encoding) if r is None: return r if isinstance(r, Err): From bd32cbdbe05a8d3060d107859b48a8690fdbdc59 Mon Sep 17 00:00:00 2001 From: Alireza Mahmoudian Date: Thu, 18 Apr 2019 14:58:40 +0430 Subject: [PATCH 3/4] added shortcuts for queries --- autoload/coquille.vim | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/autoload/coquille.vim b/autoload/coquille.vim index 0e5045f..5cda762 100644 --- a/autoload/coquille.vim +++ b/autoload/coquille.vim @@ -61,10 +61,18 @@ function! coquille#FNMapping() map :CoqUndo map :CoqNext map :CoqToCursor + map :call coquille#RawQuery("Check " . VisualSelection() . ".") + map :call coquille#RawQuery("Print " . VisualSelection() . ".") + map :call coquille#RawQuery("Search " . VisualSelection() . ".") + map :CoqKill imap :CoqUndo imap :CoqNext imap :CoqToCursor + imap :call coquille#RawQuery("Check " . VisualSelection() . ".") + imap :call coquille#RawQuery("Print " . VisualSelection() . ".") + imap :call coquille#RawQuery("Search " . VisualSelection() . ".") + imap :CoqKill endfunction function! coquille#CoqideMapping() @@ -124,3 +132,24 @@ function! coquille#Register() command! -bar -buffer -nargs=* -complete=file CoqLaunch call coquille#Launch() endfunction + +function! VisualSelection() + if mode()=="v" + let [line_start, column_start] = getpos("v")[1:2] + let [line_end, column_end] = getpos(".")[1:2] + else + let [line_start, column_start] = getpos("'<")[1:2] + let [line_end, column_end] = getpos("'>")[1:2] + end + if (line2byte(line_start)+column_start) > (line2byte(line_end)+column_end) + let [line_start, column_start, line_end, column_end] = + \ [line_end, column_end, line_start, column_start] + end + let lines = getline(line_start, line_end) + if len(lines) == 0 + return '' + endif + let lines[-1] = lines[-1][: column_end - 1] + let lines[0] = lines[0][column_start - 1:] + return join(lines, "\n") +endfunction From 6d03b1572dd7127148d553686a23ca41d73bf14a Mon Sep 17 00:00:00 2001 From: Alireza Mahmoudian Date: Mon, 13 May 2019 11:36:56 +0430 Subject: [PATCH 4/4] transparent split borders --- autoload/coquille.vim | 3 +++ 1 file changed, 3 insertions(+) diff --git a/autoload/coquille.vim b/autoload/coquille.vim index 5cda762..5f42605 100644 --- a/autoload/coquille.vim +++ b/autoload/coquille.vim @@ -25,6 +25,9 @@ py if not vim.eval("s:current_dir") in sys.path: \ sys.path.append(vim.eval("s:current_dir")) py import coquille +hi Vertsplit cterm=NONE +hi StatusLineNC cterm=NONE + function! coquille#ShowPanels() " open the Goals & Infos panels before going back to the main window let l:winnb = winnr()