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
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',
# 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') }
('<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")
# 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'), }
# 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') }
# 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')}
('<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,
# 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') }
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, }
# 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')}
# 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') }
# 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') }
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, }
('<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,
# 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'), }
# 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'), }
# encoding:utf-8 """TCL repl definitions""" from iron.repls.utils.cmd import detect_fn repl = {'command': 'tclsh', 'language': 'tcl', 'detect': detect_fn("tclsh")}
# 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') }
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'),
# 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'), }
# 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') }
# 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'), }
# 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'), }
# 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'), }
# 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')}
# 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') }
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']), }
# 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') }