We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d0ddb50 commit 88cfc94Copy full SHA for 88cfc94
after/ftplugin/python.lua
@@ -3,3 +3,15 @@ if (vim.o.textwidth or 0) > 0 then
3
macchiato_line_length = vim.o.textwidth
4
end
5
vim.opt_local.formatprg = 'black-macchiato -l ' .. macchiato_line_length
6
+
7
+vim.keymap.set('n', '<leader>is', function()
8
+ local bufnr = vim.api.nvim_get_current_buf()
9
+ local modified = vim.api.nvim_get_option_value("modified", { buf = bufnr })
10
11
+ if modified then
12
+ print('*** Save your changes first!' ***)
13
+ return
14
+ end
15
+ local file_name = vim.api.nvim_buf_get_name(0) -- Get file name of file in current buffer
16
+ vim.cmd(":!isort -l 1000000 --wl 0 --sl " .. file_name)
17
+end, { desc = 'Run isort on the current buffer' })
0 commit comments