Skip to content

Commit ece7cee

Browse files
committed
Added flutter-tools plugin
1 parent bbdb00f commit ece7cee

3 files changed

Lines changed: 74 additions & 0 deletions

File tree

lazy-lock.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
77
"fidget.nvim": { "branch": "main", "commit": "7fa433a83118a70fe24c1ce88d5f0bd3453c0970" },
88
"flash.nvim": { "branch": "main", "commit": "fcea7ff883235d9024dc41e638f164a450c14ca2" },
9+
"flutter-tools.nvim": { "branch": "main", "commit": "677cc07c16e8b89999108d2ebeefcfc5f539b73c" },
910
"fzf-lua": { "branch": "main", "commit": "54669c347fe94d5be41322bd5526095f3e528713" },
1011
"gitsigns.nvim": { "branch": "main", "commit": "7c4faa3540d0781a28588cafbd4dd187a28ac6e3" },
1112
"guess-indent.nvim": { "branch": "main", "commit": "84a4987ff36798c2fc1169cbaff67960aed9776f" },
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
-- Make sure to install fvm in yout system for this to work
2+
return {
3+
'nvim-flutter/flutter-tools.nvim',
4+
lazy = false,
5+
dependencies = {
6+
'nvim-lua/plenary.nvim',
7+
'folke/snacks.nvim', -- optional for vim.ui.select
8+
},
9+
opts = {
10+
fvm = true,
11+
},
12+
config = function(_, config_opts)
13+
local root_patterns = { '.fvm' }
14+
local root_dir = vim.fs.dirname(vim.fs.find(root_patterns, { upward = true })[1])
15+
if not root_dir then
16+
return
17+
end
18+
19+
require('flutter-tools').setup(config_opts)
20+
local commands = {
21+
-- Commands
22+
'FlutterRun',
23+
'FlutterDebug',
24+
'FlutterLspRestart',
25+
'FlutterAttach',
26+
'FlutterDetach',
27+
'FlutterReload',
28+
'FlutterRestart',
29+
'FlutterQuit',
30+
'FlutterVisualDebug',
31+
'FlutterChangeTargetPlatform',
32+
'FlutterToggleBrightness',
33+
-- Lists
34+
'FlutterDevices',
35+
'FlutterEmulators',
36+
--- Outline
37+
'FlutterOutlineOpen',
38+
'FlutterOutlineToggle',
39+
--- Dev tools
40+
'FlutterDevTools',
41+
'FlutterDevToolsActivate',
42+
'FlutterCopyProfilerUrl',
43+
'FlutterOpenDevTools',
44+
'FlutterInspectWidget',
45+
'FlutterPubGet',
46+
'FlutterPubUpgrade',
47+
--- Log
48+
'FlutterLogClear',
49+
'FlutterLogToggle',
50+
--- LSP
51+
'FlutterSuper',
52+
'FlutterReanalyze',
53+
'FlutterRename',
54+
}
55+
56+
local opts = {}
57+
opts.prompt = 'Flutter Tools> '
58+
opts.actions = {
59+
['default'] = function(selected)
60+
vim.cmd(selected)
61+
end,
62+
}
63+
64+
vim.api.nvim_create_autocmd('BufEnter', {
65+
callback = function()
66+
vim.keymap.set('n', '<leader>F', function()
67+
require('fzf-lua').fzf_exec(commands, opts)
68+
end, { desc = 'Flutter Tools Commands' })
69+
end,
70+
})
71+
end,
72+
}

lua/lazy-plugins.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ require('lazy').setup({
4040
require 'custom/plugins/theme',
4141
require 'custom/plugins/indent-blankline',
4242
-- require 'custom/plugins/leetcode',
43+
require 'custom/plugins/flutter-tools',
4344
}, {
4445
ui = {
4546
-- If you are using a Nerd Font: set icons to an empty table which will use the

0 commit comments

Comments
 (0)