예제 #1
0
import sublime
import sublime_plugin

import sys, os

print(os.path.dirname(__file__))
sys.path.append(os.path.dirname(__file__))

from vex.ex_command_parser import parse_command
from vex.ex_command_parser import EX_COMMANDS
from vex import ex_error


COMPLETIONS = sorted([x[0] for x in list(EX_COMMANDS.keys())])

EX_HISTORY_MAX_LENGTH = 20
EX_HISTORY = {"cmdline": [], "searches": []}


def update_command_line_history(item, slot_name):
    if len(EX_HISTORY[slot_name]) >= EX_HISTORY_MAX_LENGTH:
        EX_HISTORY[slot_name] = EX_HISTORY[slot_name][1:]
    if item in EX_HISTORY[slot_name]:
        EX_HISTORY[slot_name].pop(EX_HISTORY[slot_name].index(item))
    EX_HISTORY[slot_name].append(item)


class ViColonInput(sublime_plugin.WindowCommand):
    def is_enabled(self):
        return len(self.window.views()) > 0
예제 #2
0
import sublime
import sublime_plugin

from vex.ex_command_parser import parse_command
from vex.ex_command_parser import EX_COMMANDS
from vex import ex_error

COMPLETIONS = sorted([x[0] for x in EX_COMMANDS.keys()])

EX_HISTORY_MAX_LENGTH = 20
EX_HISTORY = {'cmdline': [], 'searches': []}


#______________________________________________________________________________
def update_command_line_history(item, slot_name):
    if len(EX_HISTORY[slot_name]) >= EX_HISTORY_MAX_LENGTH:
        EX_HISTORY[slot_name] = EX_HISTORY[slot_name][1:]
    if item in EX_HISTORY[slot_name]:
        EX_HISTORY[slot_name].pop(EX_HISTORY[slot_name].index(item))
    EX_HISTORY[slot_name].append(item)


#______________________________________________________________________________
class ViColonInput(sublime_plugin.WindowCommand):
    def is_enabled(self):
        return len(self.window.views()) > 0

    def __init__(self, window):
        sublime_plugin.WindowCommand.__init__(self, window)

    def run(self, initial_text=':', cmd_line=''):
예제 #3
0
import sublime
import sublime_plugin

from vex.ex_command_parser import parse_command
from vex.ex_command_parser import EX_COMMANDS
from vex import ex_error


COMPLETIONS = sorted([x[0] for x in EX_COMMANDS.keys()])

EX_HISTORY_MAX_LENGTH = 20
EX_HISTORY = {
    'cmdline': [],
    'searches': []
}


#______________________________________________________________________________
def update_command_line_history(item, slot_name):
    if len(EX_HISTORY[slot_name]) >= EX_HISTORY_MAX_LENGTH:
        EX_HISTORY[slot_name] = EX_HISTORY[slot_name][1:]
    if item in EX_HISTORY[slot_name]:
        EX_HISTORY[slot_name].pop(EX_HISTORY[slot_name].index(item))
    EX_HISTORY[slot_name].append(item)


#______________________________________________________________________________
class ViColonInput(sublime_plugin.WindowCommand):
    def is_enabled(self):
        return len(self.window.views()) > 0
        
예제 #4
0
import sublime
import sublime_plugin

import sys, os
print(os.path.dirname(__file__))
sys.path.append(os.path.dirname(__file__))

from vex.ex_command_parser import parse_command
from vex.ex_command_parser import EX_COMMANDS
from vex import ex_error


COMPLETIONS = sorted([x[0] for x in list(EX_COMMANDS.keys())])

EX_HISTORY_MAX_LENGTH = 20
EX_HISTORY = {
    'cmdline': [],
    'searches': []
}


def update_command_line_history(item, slot_name):
    if len(EX_HISTORY[slot_name]) >= EX_HISTORY_MAX_LENGTH:
        EX_HISTORY[slot_name] = EX_HISTORY[slot_name][1:]
    if item in EX_HISTORY[slot_name]:
        EX_HISTORY[slot_name].pop(EX_HISTORY[slot_name].index(item))
    EX_HISTORY[slot_name].append(item)


class ViColonInput(sublime_plugin.WindowCommand):
    def is_enabled(self):