Example #1
0
    def _fill_in_detect_key(repls):
        """Fill in missing "detect" keys in the available_repls list

        This will only work correctly if the only thing that needs to be
        detected is the command given in the 'command' key.  For more complex
        cases the detect key has to be given explicitly.
        """
        for repl in repls:
            if 'detect' not in repl:
                new = repl.copy()
                new['detect'] = detect_fn(shlex.split(repl['command'])[0])
                yield new
            else:
                yield repl
Example #2
0
def sbt_test_this_file(iron):
    data = "test {}.{}".format(get_ns(iron), get_class(iron))
    return iron.send_to_repl((data, "sbt.scala"))


mappings = [
    ('<leader>sa', 'import_all', scala_import_all_ns),
    ('<leader>si', 'import', scala_import),
    ('<leader>sb', 'block', scala_send_block),
    ('<leader>sl', 'line', scala_send_line),
]

sbt_file = {
    'command': 'sbt',
    'language': 'sbt.scala',
    'detect': detect_fn('sbt'),
    'mappings': mappings,
    'multiline': (':paste\n', '\x04'),
}

sbt_cmd = {
    'command': 'sbt',
    'language': 'scala',
    'detect': detect_fn('sbt', ['build.sbt', 'project/build.sbt']),
    'mappings': mappings,
    'multiline': (':paste\n', '\x04'),
}

scala = {
    'command': 'scala',
    'language': 'scala',
Example #3
0
# encoding:utf-8
"""Node repl definition for iron.nvim. """
from iron.repls.utils.cmd import detect_fn

repl = {
    'command': 'node',
    'language': 'javascript',
    'detect': detect_fn('node')
}
Example #4
0
    ('<leader>si', 'import', scala_import),
    ('<leader>sb', 'block', scala_send_block),
    ('<leader>sl', 'line', scala_send_line),
]

sbt_file = {
    'command': 'sbt',
    'language': 'sbt.scala',
    'mappings': mappings,
    'multiline': (':paste\n', '\x04'),
}

sbt_cmd = {
    'command': 'sbt',
    'language': 'scala',
    'detect': detect_fn('sbt', ['build.sbt', 'project/build.sbt']),
    'mappings': mappings,
    'multiline': (':paste\n', '\x04'),
}

scala = {
    'command': 'scala',
    'language': 'scala',
    'mappings': mappings,
    'multiline': (':paste\n', '\x04'),
}

def do_stuff():
    nvim.command("2 wincmd w")
    nvim.command("""global/get_ns/normal! 0f "Gyt(""")
    return nvim.funcs.getreg("g")
Example #5
0
# encoding:utf-8
"""Haskell repl definitions for iron.nvim. """
from iron.repls.utils.cmd import detect_fn

ghci = {
    'command': 'ghci',
    'language': 'haskell',
    'detect': detect_fn('ghci'),
}

stackghci = {
    'command': 'stack ghci',
    'language': 'haskell',
    'detect': detect_fn('stack'),
}
Example #6
0
# encoding:utf-8
"""OCaml repl definitions for iron.nvim. """
from iron.repls.utils.cmd import detect_fn

ocamltop = {
    'command': 'ocamltop',
    'language': 'ocaml',
    'detect': detect_fn('ocamltop')
}

utop = {
    'command': 'utop',
    'language': 'ocaml',
    'detect': detect_fn('utop')
}
Example #7
0
# encoding:utf-8
"""Scheme repl definitions for iron.nvim. """
from iron.repls.utils.cmd import detect_fn

repl = {'command': 'guile', 'language': 'scheme', 'detect': detect_fn('guile')}
Example #8
0
    ('<leader>si', 'import', lein_import),
    ('<leader>sn', 'switch-ns', lein_switch_ns),
    ('<leader>sr', 'require-file', lein_require_file),
    ('<leader>sR', 'require-with-ns', lein_require_with_ns),
    ('<leader>s.', 'prompt-require', lein_prompt_require),
    ('<leader>s/', 'prompt-require-as', lein_prompt_require_as),
    ('<leader>ss', 'send-block', lein_send),
    ('<leader>mf', 'midje-load-facts', midje_load_facts),
    ('<leader>ma', 'midje-autotest', midje_autotest),
]

repl = {
    'command': 'lein repl',
    'language': 'clojure',
    'priority': 0,
    'detect': detect_fn('lein'),
    'mappings': mappings
}

connect = {
    'command': 'lein repl :connect',
    'language': 'clojure',
    'priority': 10,
    'detect': detect_fn('lein', ['.nrepl-port']),
    'mappings': mappings
}

boot = {
    'command': 'boot repl',
    'language': 'clojure',
    'priority': 0,
Example #9
0
# encoding:utf-8
"""R repl definitions for iron.nvim. """
from iron.repls.utils.cmd import detect_fn

repl = {
    'command': 'R',
    'language': 'r',
    'detect': detect_fn('R')
}
Example #10
0
def prompt_cmd(iron):
    try:
        cmd = iron.prompt("command")
    except:
        iron.call_cmd("echo 'Aborting'")
    else:
        return iron.send_to_repl((cmd, "sh"))

global_mappings = [
    ('<leader>sx', 'prompt_cmd', prompt_cmd),
]

zsh_sh = {
    'command': 'zsh',
    'language': 'sh',
    'detect': detect_fn('zsh'),
    'global_mappings': global_mappings,
}

zsh_zsh = {
    'command': 'zsh',
    'language': 'zsh',
    'detect': detect_fn('zsh'),
}

bash_sh = {
    'command': 'bash',
    'language': 'sh',
    'detect': detect_fn('bash'),
    'global_mappings': global_mappings,
}
Example #11
0
# encoding:utf-8
"""Scheme repl definitions for iron.nvim. """
from iron.repls.utils.cmd import detect_fn

guile = {
    'command': 'guile',
    'language': 'scheme',
    'detect': detect_fn('guile')
}

chicken = {'command': 'csi', 'language': 'scheme', 'detect': detect_fn('csi')}
Example #12
0
# encoding:utf-8
"""Elm repl definitions for iron.nvim. """
from iron.repls.utils.cmd import detect_fn

repl = {
    'command': 'elm-repl',
    'language': 'elm',
    'detect': detect_fn('elm-repl'),
    'multiline' : ('', '', '\n', '\\\n')
}
Example #13
0
# encoding:utf-8
"""Ruby repl definitions for iron.nvim. """
from iron.repls.utils.cmd import detect_fn

repl = {
    'command': 'irb',
    'language': 'ruby',
    'detect': detect_fn('irb')
}
Example #14
0
    try:
        cmd = iron.prompt("command")
    except:
        iron.call_cmd("echo 'Aborting'")
    else:
        return iron.send_to_repl((cmd, "sh"))


global_mappings = [
    ('<leader>sx', 'prompt_cmd', prompt_cmd),
]

zsh_sh = {
    'command': 'zsh',
    'language': 'sh',
    'detect': detect_fn('zsh'),
    'global_mappings': global_mappings,
}

zsh_zsh = {
    'command': 'zsh',
    'language': 'zsh',
    'detect': detect_fn('zsh'),
}

bash_sh = {
    'command': 'bash',
    'language': 'sh',
    'detect': detect_fn('bash'),
    'global_mappings': global_mappings,
}
Example #15
0
    ('<leader>sn', 'switch-ns', lein_switch_ns),
    ('<leader>sr', 'require-file', lein_require_file),
    ('<leader>sR', 'require-with-ns', lein_require_with_ns),
    ('<leader>s.', 'prompt-require', lein_prompt_require),
    ('<leader>s/', 'prompt-require-as', lein_prompt_require_as),
    ('<leader>ss', 'send-block', lein_send),

    ('<leader>mf', 'midje-load-facts', midje_load_facts),
    ('<leader>ma', 'midje-autotest', midje_autotest),
]

repl = {
    'command': 'lein repl',
    'language': 'clojure',
    'priority': 0,
    'detect': detect_fn('lein'),
    'mappings': mappings
}

connect = {
    'command': 'lein repl :connect',
    'language': 'clojure',
    'priority': 10,
    'detect': detect_fn('lein', ['.nrepl-port']),
    'mappings': mappings
}

boot = {
    'command': 'boot repl',
    'language': 'clojure',
    'priority': 0,
Example #16
0
# encoding:utf-8
"""Haskell repl definitions for iron.nvim. """
from iron.repls.utils.cmd import detect_fn

ghci = {
    'command': 'ghci',
    'language': 'haskell',
    'detect': detect_fn('ghci'),
}

stackghci = {
    'command': 'stack ghci',
    'language': 'haskell',
    'detect': detect_fn('stack'),
}

intero = {
    'command': 'stack ghci --with-ghc intero',
    'language': 'haskell',
    'detect': detect_fn('intero'),
}
Example #17
0
# encoding:utf-8
"""Elixir repl definition for iron.nvim. """
from iron.repls.utils.cmd import detect_fn

repl = {
    'command': 'iex',
    'language': 'elixir',
    'detect': detect_fn('iex'),
}
Example #18
0
# encoding:utf-8
"""TCL repl definitions"""
from iron.repls.utils.cmd import detect_fn

repl = {'command': 'tclsh', 'language': 'tcl', 'detect': detect_fn("tclsh")}
Example #19
0
# encoding:utf-8
"""Lua repl definition for iron.nvim. """
from iron.repls.utils.cmd import detect_fn

repl = {
    'command': 'lua',
    'language': 'lua',
    'detect': detect_fn('lua')
}
Example #20
0

def set_pdb(iron):
    iron.send_to_repl("pdb")



mappings = [
    ('<leader>pp', 'set_pdb', set_pdb),
]


python = {
    'command': 'python',
    'language': 'python',
    'detect': detect_fn('python'),
}

ipython = {
    'command':   'ipython',
    'language':  'python',
    'multiline': ('\x1b[200~', '\x1b[201~', '\r'),
    'detect': detect_fn('ipython'),
}


ptpython = {
    'command': 'ptpython',
    'language': 'python',
    'multiline': ('\x1b[200~', '\x1b[201~', '\r'),
    'detect': detect_fn('ptpython'),
Example #21
0
# encoding:utf-8
"""Pure-lang repl definitions for iron.nvim. """
from iron.repls.utils.cmd import detect_fn

def pure_send_block(iron):
    iron.call_cmd("""normal! Vi{"sy""")
    data = "{}".format(iron.register('s'))
    return iron.send_to_repl((data, "pure"))

def pure_send_line(iron):
    iron.call_cmd("""normal! 0"sy$""")
    data = "{}".format(iron.register('s'))
    return iron.send_to_repl((data, "pure"))

mappings = [
    ('<leader>sb', 'block', pure_send_block),
    ('<leader>sl', 'line', pure_send_line),
]

repl = {
    'command': 'pure',
    'language': 'pure',
    'detect': detect_fn('pure'),
    'mappings': mappings,
    'multiline': (':paste\n', '\x04'),
}
Example #22
0
# encoding:utf-8
"""Elm repl definitions for iron.nvim. """
from iron.repls.utils.cmd import detect_fn

repl = {
    'command': 'elm-repl',
    'language': 'elm',
    'detect': detect_fn('elm-repl')
}
Example #23
0
# encoding:utf-8
"""Erlang repl definition for iron.nvim. """
from iron.repls.utils.cmd import detect_fn

repl = {
    'command': 'erl',
    'language': 'erlang',
    'detect': detect_fn('erl'),
}
Example #24
0
# encoding:utf-8
"""PHP repl definition for iron.nvim. """
from iron.repls.utils.cmd import detect_fn

php = {
    'command': 'php -a',
    'language': 'php',
    'detect': detect_fn('php'),
}

psyshell = {
    'command': 'psysh',
    'language': 'php',
    'detect': detect_fn('psysh'),
}
Example #25
0
# encoding:utf-8
"""Haskell repl definitions for iron.nvim. """
from iron.repls.utils.cmd import detect_fn

ghci = {
    'command': 'ghci',
    'language': 'haskell',
}

stackghci = {
    'command': 'stack ghci',
    'language': 'haskell',
}

intero = {
    'command': 'stack ghci --with-ghc intero',
    'language': 'haskell',
    'detect': detect_fn('intero'),
}
Example #26
0
# encoding:utf-8
"""R repl definitions for iron.nvim. """
from iron.repls.utils.cmd import detect_fn

repl = {'command': 'R', 'language': 'r', 'detect': detect_fn('R')}
Example #27
0
# encoding:utf-8
"""Lisp repl definition for iron.nvim. """
from iron.repls.utils.cmd import detect_fn

sbcl = {
    'command': 'sbcl',
    'language': 'lisp',
    'detect': detect_fn('sbcl')
}

clisp = {
    'command': 'clisp',
    'language': 'lisp',
    'detect': detect_fn('clisp')
}
Example #28
0
    iron.send_to_repl("pdb")


mappings = [
    ('<leader>pp', 'set_pdb', set_pdb),
]

python = {
    'command': 'python',
    'language': 'python',
}

ipython = {
    'command': 'ipython',
    'language': 'python',
    'multiline': ('\x1b[200~', '\x1b[201~', '\r'),
}

ptpython = {
    'command': 'ptpython',
    'language': 'python',
    'multiline': ('\x1b[200~', '\x1b[201~', '\r'),
}

ptipython = {
    'command': 'ptipython',
    'language': 'python',
    'multiline': ('\x1b[200~', '\x1b[201~', '\r'),
    'detect': detect_fn(['ptipython', 'ipython']),
}
Example #29
0
# encoding:utf-8
"""Scheme repl definitions for iron.nvim. """
from iron.repls.utils.cmd import detect_fn

repl = {
    'command': 'racket',
    'language': 'racket',
    'detect': detect_fn('racket')
}