Skip to content

Commit 0eb880b

Browse files
committed
Merge branch 'main' of github.com:aalbaali/workstation_setup
2 parents 80bc3bb + 089d64c commit 0eb880b

4 files changed

Lines changed: 91 additions & 4 deletions

File tree

stow/nvim/.config/nvim/init.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,4 @@ require "user.harpoon"
4343
require "user.possession"
4444
require "user.dap"
4545
require "user.lazydev"
46+
require "user.iron"
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
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+
}

stow/nvim/.config/nvim/lua/user/plugins.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,4 +261,5 @@ return packer.startup(function(use)
261261
}
262262
end
263263
}
264+
use { 'Vigemus/iron.nvim' }
264265
end)

stow/nvim/.config/nvim/lua/user/whichkey.lua

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,9 @@ local mappings = {
152152
r = {
153153
name = "run",
154154
p = { "<cmd>split<CR><cmd>term python %<CR>", "Run python" },
155-
r = { "<cmd>split<CR><cmd>term ./%<CR>", "Run script" },
155+
s = { "<cmd>split<CR><cmd>term ./%<CR>", "Run script" },
156+
f = { "<cmd>IronFocus<cr>", "Run focus" },
157+
h = { "<cmd>IronHide<cr>", "Run hide" },
156158
},
157159

158160
p = {
@@ -179,7 +181,6 @@ local mappings = {
179181
"Undo Stage Hunk",
180182
},
181183
o = { "<cmd>Telescope git_status<cr>", "Open changed file" },
182-
b = { "<cmd>Telescope git_branches<cr>", "Checkout branch" },
183184
c = { "<cmd>Telescope git_commits<cr>", "Checkout commit" },
184185
d = {
185186
"<cmd>Gitsigns diffthis HEAD<cr>",
@@ -232,8 +233,6 @@ local mappings = {
232233
s = {
233234
name = "Search",
234235
a = { "<cmd>Ag<cr>", "Ag search" },
235-
b = { "<cmd>Telescope git_branches<cr>", "Checkout branch" },
236-
c = { "<cmd>Telescope colorscheme<cr>", "Colorscheme" },
237236
h = { "<cmd>Telescope help_tags<cr>", "Find Help" },
238237
M = { "<cmd>Telescope man_pages<cr>", "Man Pages" },
239238
r = { "<cmd>Telescope oldfiles<cr>", "Open Recent File" },

0 commit comments

Comments
 (0)