Add flutter key bindings to readme

This commit is contained in:
2026-04-20 10:45:36 +02:00
parent 43b72217c1
commit 8077029290
4 changed files with 38 additions and 6 deletions

View File

@@ -60,6 +60,19 @@ The **Leader Key** is set to `Space`.
| **References** | `gr` | List all places where a symbol is used. | | **References** | `gr` | List all places where a symbol is used. |
| **Rename** | `<leader>rn` | Rename all occurrences of the symbol. | | **Rename** | `<leader>rn` | Rename all occurrences of the symbol. |
### LSP & Development
| Action | Keybinding | Description |
| :--- | :--- | :--- |
| **Run App** | `:FRun` | Start the flutter application. |
| **Run Target**| `:FRunT <path to file>` | Run Flutter with a specific target file (e.g., main_dev.dart). |
| **Hot Reload** | `:FReload` | Trigger a Hot Reload for the running app. |
| **Hot Restart** | `:FRestart` | Trigger a Hot Restart for the running app. |
| **Quit App** | `:FQuit` | Stop the running Flutter session. |
| **List Emulators** | `:FEmulators` | Show and launch available emulators. |
| **List Devices** | `:FDevices` | Show a list of available physical/virtual devices. |
| **Toggle Logs** | `:FLogs` | Open or close the Flutter Dev Log split. |
| **Clear Logs** | `:FLogsClear` | Clear the current Flutter Dev Log buffer. |
### Diagnostics (Errors & Warnings) ### Diagnostics (Errors & Warnings)
| Action | Keybinding | Description | | Action | Keybinding | Description |
| :--- | :--- | :--- | | :--- | :--- | :--- |

View File

@@ -1,6 +1,7 @@
{ {
"Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
"LuaSnip": { "branch": "master", "commit": "a62e1083a3cfe8b6b206e7d3d33a51091df25357" }, "LuaSnip": { "branch": "master", "commit": "a62e1083a3cfe8b6b206e7d3d33a51091df25357" },
"ansi.nvim": { "branch": "main", "commit": "95de464c315ecbe9d7ca3d9a203ef85def0cf6aa" },
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" }, "cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
"cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" }, "cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" },
"cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" }, "cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" },
@@ -10,6 +11,7 @@
"flutter-tools.nvim": { "branch": "main", "commit": "677cc07c16e8b89999108d2ebeefcfc5f539b73c" }, "flutter-tools.nvim": { "branch": "main", "commit": "677cc07c16e8b89999108d2ebeefcfc5f539b73c" },
"harpoon": { "branch": "harpoon2", "commit": "87b1a3506211538f460786c23f98ec63ad9af4e5" }, "harpoon": { "branch": "harpoon2", "commit": "87b1a3506211538f460786c23f98ec63ad9af4e5" },
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
"log-highlight.nvim": { "branch": "main", "commit": "ca88628f6dd3b9bb46f9a7401669e24cf7de47a4" },
"lualine.nvim": { "branch": "master", "commit": "a905eeebc4e63fdc48b5135d3bf8aea5618fb21c" }, "lualine.nvim": { "branch": "master", "commit": "a905eeebc4e63fdc48b5135d3bf8aea5618fb21c" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "0a3b42c3e503df87aef6d6513e13148381495c3a" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "0a3b42c3e503df87aef6d6513e13148381495c3a" },
"mason.nvim": { "branch": "main", "commit": "b03fb0f20bc1d43daf558cda981a2be22e73ac42" }, "mason.nvim": { "branch": "main", "commit": "b03fb0f20bc1d43daf558cda981a2be22e73ac42" },

View File

@@ -8,17 +8,18 @@ return {
}, },
config = function() config = function()
vim.opt.termguicolors = true vim.opt.termguicolors = true
vim.env.FLUTTER_FORCE_COLOR = "1" -- vim.env.FLUTTER_FORCE_COLOR = "1"
-- Auto scroll & Color logs when new logs appear
vim.api.nvim_create_autocmd({ "TextChanged", "BufWinEnter" }, { vim.api.nvim_create_autocmd({ "TextChanged", "BufWinEnter" }, {
pattern = "*__FLUTTER_DEV_LOG__*", -- Default name for flutter-tools logs pattern = "*__FLUTTER_DEV_LOG__*",
callback = function() callback = function()
local buf = vim.api.nvim_get_current_buf() local buf = vim.api.nvim_get_current_buf()
-- Check if we are in the log buffer
-- Auto-scroll logic
if vim.bo[buf].filetype == "log" or vim.fn.bufname(buf):match("flutter%-dev%.log") then if vim.bo[buf].filetype == "log" or vim.fn.bufname(buf):match("flutter%-dev%.log") then
local win = vim.api.nvim_get_current_win() local win = vim.api.nvim_get_current_win()
local last_line = vim.api.nvim_buf_line_count(buf) local last_line = vim.api.nvim_buf_line_count(buf)
-- Only scroll if we aren't currently in Insert mode
if vim.api.nvim_get_mode().mode ~= 'i' then if vim.api.nvim_get_mode().mode ~= 'i' then
vim.api.nvim_win_set_cursor(win, { last_line, 0 }) vim.api.nvim_win_set_cursor(win, { last_line, 0 })
end end
@@ -62,7 +63,7 @@ return {
-- Simple Aliases -- Simple Aliases
-- user_command("FRun", "FlutterRun", {}) -- user_command("FRun", "FlutterRun", {})
-- user_command("FRun", "FlutterRun --color", {}) -- user_command("FRun", "FlutterRun --color", {})
user_command("FRun", "FlutterRun --color", {}) user_command("FRun", "FlutterRun", {})
user_command("FReload", "FlutterReload", {}) user_command("FReload", "FlutterReload", {})
user_command("FRestart", "FlutterRestart", {}) user_command("FRestart", "FlutterRestart", {})
@@ -74,7 +75,7 @@ return {
-- Target-specific Run Command -- Target-specific Run Command
user_command("FRunT", function(opts) user_command("FRunT", function(opts)
vim.cmd("FlutterRun --color --target=" .. opts.args) vim.cmd("FlutterRun --target=" .. opts.args)
end, { end, {
nargs = 1, nargs = 1,
complete = "file", complete = "file",

View File

@@ -0,0 +1,16 @@
return {
{
'fei6409/log-highlight.nvim',
opts = {},
},
{
'0xferrous/ansi.nvim',
config = function()
require('ansi').setup({
auto_enable = true, -- Auto-enable for configured filetypes
auto_enable_stdin = true, -- Auto-enable for piped stdin content
filetypes = { 'log', 'ansi' },
})
end
},
}