Skip to content

Commit ec0744a

Browse files
committed
Merge remote-tracking branch 'origin/main' into amro/upgrade-nvim
Signed-off-by: Amro <amro@picklerobot.com>
2 parents c76ac8a + 9a944e7 commit ec0744a

8 files changed

Lines changed: 394 additions & 13 deletions

File tree

ansible/tasks/setup_nvim.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,11 @@
2424
remote_src: true
2525
creates: "/opt/nvim-linux64-{{ nvim_version }}"
2626

27-
- name: Move from temp to opt
28-
ansible.builtin.command: mv /tmp/nvim-linux-x86_64 "/opt/nvim-linux64-{{ nvim_version }}"
29-
args:
30-
creates: "/opt/nvim-linux64-{{ nvim_version }}"
27+
- name: Copy from temp to opt
28+
ansible.builtin.copy:
29+
src: /tmp/nvim-linux64/
30+
dest: "/opt/nvim-linux64-{{ nvim_version }}"
31+
remote_src: true
3132

3233
- name: Symlink nvim
3334
ansible.builtin.file:

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/lsp/mason.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ local servers = {
66
"lua_ls",
77
"jsonls",
88
"pyright",
9+
"ruff",
910
}
1011

1112
local settings = {
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
return {
2+
settings = {
3+
pyright = {
4+
-- Using Ruff's import organizer
5+
disableOrganizeImports = false,
6+
},
7+
python = {
8+
analysis = {
9+
-- Ignore all files for analysis to exclusively use Ruff for linting
10+
ignore = { '*' },
11+
},
12+
},
13+
},
14+
init_options = {
15+
settings = {
16+
logLevel = 'info', -- Defaults to 'info'
17+
}
18+
}
19+
}

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ return packer.startup(function(use)
119119
use { "nvimtools/none-ls.nvim" } -- for formatters and linters
120120
use { "RRethy/vim-illuminate" }
121121
use { "nvim-telescope/telescope.nvim", commit = "84b9ba06" }
122-
use { "nvim-treesitter/nvim-treesitter" }
123-
use { "nvim-treesitter/nvim-treesitter-context" } -- View context at the current cursor functions/classes
122+
use { "nvim-treesitter/nvim-treesitter", commit = "v0.10.0" }
123+
use { "nvim-treesitter/nvim-treesitter-context", commit = "660861b" } -- View context at the current cursor functions/classes
124124
use { "lewis6991/gitsigns.nvim", commit = "v0.8.1" }
125125

126126
use('tpope/vim-fugitive') -- Git comments
@@ -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: 4 additions & 5 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>",
@@ -201,7 +202,7 @@ local mappings = {
201202
"Workspace Diagnostics",
202203
},
203204
f = { "<cmd>lua vim.lsp.buf.format{async=true}<cr>", "Format" },
204-
F = { "<cmd>!python -m ruff check % --fix --select F841 --fixable F841 --select F401 --fixable F401 && python -m ruff format %<cr>", "Format" },
205+
F = { "<cmd>!python -m ruff check % --fix && python -m ruff format %<cr>", "Format" },
205206
J = { "<cmd>!prettier --write % --log-level warn<cr>", "Format" },
206207
i = { "<cmd>LspInfo<cr>", "Info" },
207208
I = { "<cmd>Mason<cr>", "Installer Info" },
@@ -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)