Skip to content

Commit 395e53f

Browse files
authored
chore: make this a pure lua plugin (#33)
replace plugin/flow.vim with plugin/flow.lua Closes #26
1 parent 6aedbd7 commit 395e53f

File tree

2 files changed

+56
-22
lines changed

2 files changed

+56
-22
lines changed

plugin/flow.lua

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
-- Check if the plugin is already loaded
2+
if vim.g.loaded_flow then
3+
return
4+
end
5+
6+
-- Commands
7+
vim.api.nvim_create_user_command('FlowRunFile', function()
8+
require('flow').run_file()
9+
end, {})
10+
11+
vim.api.nvim_create_user_command('FlowSetCustomCmd', function(opts)
12+
require('flow.cmd').set_custom_cmd(opts.args)
13+
end, { nargs = '?' })
14+
15+
vim.api.nvim_create_user_command('FlowRunCustomCmd', function(opts)
16+
require('flow').run_custom_cmd(opts.args)
17+
end, { nargs = '?' })
18+
19+
vim.api.nvim_create_user_command('FlowReload', function()
20+
require('flow').reload_plugin()
21+
end, {})
22+
23+
vim.api.nvim_create_user_command('FlowRunSelected', function(opts)
24+
require('flow').run_range({opts.line1, opts.line2})
25+
end, { nargs = '*', range = true })
26+
27+
vim.api.nvim_create_user_command('FlowLauncher', function()
28+
require('flow.telescope').custom_cmds()
29+
end, {})
30+
31+
vim.api.nvim_create_user_command('FlowRunLastCmd', function()
32+
require('flow').run_last_custom_cmd()
33+
end, {})
34+
35+
vim.api.nvim_create_user_command('FlowLastOutput', function()
36+
require('flow').show_last_output()
37+
end, {})
38+
39+
vim.api.nvim_create_user_command('FlowRunMDBlock', function()
40+
require('flow').run_block()
41+
end, {})
42+
43+
-- Autocommand
44+
vim.api.nvim_create_autocmd('FileType', {
45+
pattern = 'run-code-output',
46+
callback = function()
47+
vim.api.nvim_create_autocmd('BufDelete', {
48+
callback = function()
49+
require('flow.output').reset_output_win()
50+
end,
51+
})
52+
end,
53+
})
54+
55+
-- Mark the plugin as loaded
56+
vim.g.loaded_flow = 1

plugin/flow.vim

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)