Tools
Neovim 에서 Flutter 플러그인 설정과 명령어
kogun82
2024. 12. 10. 17:21
1. nvim-flutter.lua
return {
"nvim-flutter/flutter-tools.nvim",
lazy = false,
dependencies = {
"nvim-lua/plenary.nvim",
"stevearc/dressing.nvim", -- optional for vim.ui.select
},
config = true,
}
2.conform.lua
return {
"stevearc/conform.nvim",
event = { "BufReadPre", "BufNewFile" },
config = function()
local conform = require("conform")
conform.setup({
formatters_by_ft = {
lua = { "stylua" },
javascript = { "prettierd", "prettier" },
typescript = { "prettierd", "prettier" },
javascriptreact = { "prettierd", "prettier" },
typescriptreact = { "prettierd", "prettier" },
python = { "black", "isort" },
java = { "google-java-format" },
dart = { "dart_format" }, #flutter dart settings
},
format_on_save = {
timeout_ms = 500,
lsp_fallback = true,
},
})
end,
}
3.nvim-treesitter.lua
return {
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
config = function()
local configs = require("nvim-treesitter.configs")
configs.setup({
ensure_installed = { "lua", "javascript", "python", "rust", "bash", "java", "dart" }, # add flutter dart
sync_install = false,
highlight = { enable = true },
indent = { enable = true },
})
end,
}
4.lsp.lua
local keyMapper = require("utils.keyMapper").mapKey
return {
{
"williamboman/mason.nvim",
config = function()
require("mason").setup()
end,
},
{
"williamboman/mason-lspconfig.nvim",
config = function()
require("mason-lspconfig").setup({
ensure_installed = { "lua_ls", "ts_ls", "pyright", "rust_analyzer", "bashls", "jdtls", "ast_grep" }, # flutter ast_grep server settings
})
end,
},
{
"neovim/nvim-lspconfig",
config = function()
local lspconfig = require("lspconfig")
lspconfig.lua_ls.setup({})
lspconfig.ts_ls.setup({})
lspconfig.pyright.setup({})
keyMapper("K", vim.lsp.buf.hover)
keyMapper("gd", vim.lsp.buf.definition)
keyMapper("<leader>ca", vim.lsp.buf.code_action)
end,
},
}
(1) Flutter 프로젝트 실행
:FlutterRun
(2) Flutter 디바이스 확인
:FlutterDevices
(3) Flutter 에뮬레이터 실행
:FlutterEmulators
(4) 디버그 연결
:FlutterAttach
(5) 앱 재시작
:FlutterRestart
(6) 앱 종료
:FlutterQuit
반응형