|
| 1 | +local iron = require("iron.core") |
| 2 | +local view = require("iron.view") |
| 3 | +local common = require("iron.fts.common") |
| 4 | + |
| 5 | +iron.setup { |
| 6 | + config = { |
| 7 | + -- Whether a repl should be discarded or not |
| 8 | + scratch_repl = true, |
| 9 | + close_window_on_exit = true, |
| 10 | + -- Your repl definitions come here |
| 11 | + repl_definition = { |
| 12 | + sh = { |
| 13 | + -- Can be a table or a function that |
| 14 | + -- returns a table (see below) |
| 15 | + command = { "zsh" } |
| 16 | + }, |
| 17 | + python = { |
| 18 | + command = { "ipython", "--no-autoindent" }, |
| 19 | + --command = { "python3" }, -- or { "ipython", "--no-autoindent" } |
| 20 | + format = common.bracketed_paste_python, |
| 21 | + block_dividers = { "# %%", "#%%" }, |
| 22 | + env = { PYTHON_BASIC_REPL = "1" } --this is needed for python3.13 and up. |
| 23 | + } |
| 24 | + }, |
| 25 | + -- set the file type of the newly created repl to ft |
| 26 | + -- bufnr is the buffer id of the REPL and ft is the filetype of the |
| 27 | + -- language being used for the REPL. |
| 28 | + repl_filetype = function(bufnr, ft) |
| 29 | + return ft |
| 30 | + -- or return a string name such as the following |
| 31 | + -- return "iron" |
| 32 | + end, |
| 33 | + -- Send selections to the DAP repl if an nvim-dap session is running. |
| 34 | + dap_integration = true, |
| 35 | + -- How the repl window will be displayed |
| 36 | + -- See below for more information |
| 37 | + --repl_open_cmd = view.bottom(40), |
| 38 | + |
| 39 | + -- repl_open_cmd can also be an array-style table so that multiple |
| 40 | + -- repl_open_commands can be given. |
| 41 | + -- When repl_open_cmd is given as a table, the first command given will |
| 42 | + -- be the command that `IronRepl` initially toggles. |
| 43 | + -- Moreover, when repl_open_cmd is a table, each key will automatically |
| 44 | + -- be available as a keymap (see `keymaps` below) with the names |
| 45 | + -- toggle_repl_with_cmd_1, ..., toggle_repl_with_cmd_k |
| 46 | + -- For example, |
| 47 | + -- |
| 48 | + repl_open_cmd = { |
| 49 | + view.split.vertical.rightbelow("%40"), -- cmd_1: open a repl to the right |
| 50 | + view.split.rightbelow("%25") -- cmd_2: open a repl below |
| 51 | + } |
| 52 | + |
| 53 | + }, |
| 54 | + -- Iron doesn't set keymaps by default anymore. |
| 55 | + -- You can set them here or manually add keymaps to the functions in iron.core |
| 56 | + keymaps = { |
| 57 | + toggle_repl = "<space>rt", -- toggles the repl open and closed. |
| 58 | + -- If repl_open_command is a table as above, then the following keymaps are |
| 59 | + -- available |
| 60 | + toggle_repl_with_cmd_1 = "<space>r\\", |
| 61 | + toggle_repl_with_cmd_2 = "<space>r-", |
| 62 | + restart_repl = "<space>rR", -- calls `IronRestart` to restart the repl |
| 63 | + send_motion = "<space>rc", |
| 64 | + visual_send = "<space>rr", |
| 65 | + send_file = "<space>rF", |
| 66 | + send_line = "<space>rl", |
| 67 | + send_paragraph = "<space>sp", |
| 68 | + send_until_cursor = "<space>ru", |
| 69 | + send_mark = "<space>rm", |
| 70 | + send_code_block = "<space>rb", |
| 71 | + send_code_block_and_move = "<space>rn", |
| 72 | + mark_motion = "<space>mc", |
| 73 | + mark_visual = "<space>mc", |
| 74 | + remove_mark = "<space>md", |
| 75 | + cr = "<space>r<cr>", |
| 76 | + interrupt = "<space>r<space>", |
| 77 | + exit = "<space>rq", |
| 78 | + clear = "<space>rk", |
| 79 | + }, |
| 80 | + -- If the highlight is on, you can change how it looks |
| 81 | + -- For the available options, check nvim_set_hl |
| 82 | + highlight = { |
| 83 | + italic = true |
| 84 | + }, |
| 85 | + ignore_blank_lines = false, -- ignore blank lines when sending visual select lines |
| 86 | +} |
0 commit comments