diff --git a/init.lua b/init.lua index 3593ca2e..a2424bb2 100644 --- a/init.lua +++ b/init.lua @@ -480,11 +480,24 @@ require('lazy').setup({ }, -- LSP Plugins + { + -- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins + -- used for completion, annotations and signatures of Neovim apis + 'folke/lazydev.nvim', + ft = 'lua', + opts = { + library = { + -- Load luvit types when the `vim.uv` word is found + { path = '${3rd}/luv/library', words = { 'vim%.uv' } }, + }, + }, + }, + { -- Main LSP Configuration 'neovim/nvim-lspconfig', dependencies = { - -- Automatically install LSPs and related tools to stdpath for Neovim + -- Autiomatically install LSPs and related tools to stdpath for Neovim -- Mason must be loaded before its dependents so we need to set it up here. -- NOTE: `opts = {}` is the same as calling `require('mason').setup({})` { @@ -819,7 +832,7 @@ require('lazy').setup({ -- Load the colorscheme here. -- Like many other themes, this one has different styles, and you could load -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'. - vim.cmd.colorscheme 'tokyonight-night' + vim.cmd.colorscheme 'tokyonight-moon' end, }, @@ -918,6 +931,7 @@ require('lazy').setup({ -- require 'kickstart.plugins.autopairs', -- require 'kickstart.plugins.neo-tree', -- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps + require 'kickstart.plugins.flutter_pancake', -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` -- This is the easiest way to modularize your config. diff --git a/lua/kickstart/plugins/flutter_pancake.lua b/lua/kickstart/plugins/flutter_pancake.lua new file mode 100644 index 00000000..f55bcefd --- /dev/null +++ b/lua/kickstart/plugins/flutter_pancake.lua @@ -0,0 +1,96 @@ +return { + { + 'akinsho/flutter-tools.nvim', + lazy = false, + dependencies = { + 'nvim-lua/plenary.nvim', + 'stevearc/dressing.nvim', + }, + opts = { + dev_log = { + enabled = true, + open_cmd = '50vnew', + focus_on_open = false, + }, + flutter_lookup_cmd = 'mise where flutter', + decorations = { + statusline = { + -- set to true to be able use the 'flutter_tools_decorations.app_version' in your statusline + -- this will show the current version of the flutter app from the pubspec.yaml file + app_version = true, + -- set to true to be able use the 'flutter_tools_decorations.device' in your statusline + -- this will show the currently running device if an application was started with a specific + -- device + device = true, + -- set to true to be able use the 'flutter_tools_decorations.project_config' in your statusline + -- this will show the currently selected project configuration + project_config = true, + }, + }, + lsp = { + color = { -- show the derived colours for dart variables + enabled = true, -- whether or not to highlight color variables at all, only supported on flutter >= 2.10 + background = false, -- highlight the background + background_color = nil, -- required, when background is transparent (i.e. background_color = { r = 19, g = 17, b = 24},) + foreground = false, -- highlight the foreground + virtual_text = true, -- show the highlight using virtual text + virtual_text_str = '■', -- the virtual text character to highlight + }, + settings = { + -- lineLength = 120, -- max line length that the LSP will report when formatting + showTodos = true, + completeFunctionCalls = true, + renameFilesWithClasses = 'prompt', -- "always" + enableSnippets = true, + updateImportsOnRename = true, -- Whether to update imports and other directives when files are renamed. Required for `FlutterRename` command. + }, + }, + }, + root_patterns = { 'mise.toml' }, + config = function(_, opts) + require('flutter-tools').setup(opts) + + local extensions = require('telescope').extensions + vim.keymap.set('n', 'fl', extensions.flutter.commands, { desc = '[F]lutter commands' }) + vim.keymap.set( + 'n', + 'fd', + 'FlutterRun -d macos --flavor dev --dart-define=FLAVOR=dev', + { desc = '[F]lutter Run [D]ev Flavor for Desktop' } + ) + vim.keymap.set('n', 'fr', 'FlutterRun --flavor dev --dart-define=FLAVOR=dev', { desc = '[F]lutter Run [D]ev Flavor' }) + vim.keymap.set( + 'n', + 'fw', + 'FlutterRun -d chrome --web-experimental-hot-reload --web-browser-flag "--disable-web-security" --web-port 5000', + { desc = '[F]lutter Run [W]eb' } + ) + vim.keymap.set('n', 'fv', extensions.flutter.fvm, { desc = '[F]lutter version manager' }) + vim.keymap.set('n', 'dl', function() + local buf = vim.fn.bufnr '__FLUTTER_DEV_LOG__' + if buf == -1 then + vim.notify('Flutter dev log buffer not found', vim.log.levels.WARN) + return + end + + local lines = vim.api.nvim_buf_get_lines(buf, 0, -1, false) + local file = io.open('/tmp/dart_debug.log', 'w') -- "a" means append + if not file then + vim.notify('Failed to open file for writing', vim.log.levels.ERROR) + return + end + + for _, line in ipairs(lines) do + file:write(line .. '\n') + end + file:close() + vim.notify('Appended Flutter dev log to /tmp/dart_debug.log', vim.log.levels.INFO) + end, { desc = 'Append Flutter dev log to file' }) + + vim.keymap.set('n', 'fc', 'FlutterLogClear', { desc = '[F]lutter Log [C]lear' }) + vim.keymap.set('n', 'fo', 'FlutterLogToggle', { desc = '[F]lutter Log T[o]ggle' }) + vim.keymap.set('n', 'fq', 'FlutterQuit', { desc = '[F]lutter [Q]uit' }) + vim.keymap.set('n', 'fs', 'FlutterRestart', { desc = '[F]lutter Re[s]tart' }) + end, + }, +} \ No newline at end of file diff --git a/lua/kickstart/plugins/java_setup.lua b/lua/kickstart/plugins/java_setup.lua new file mode 100644 index 00000000..de977567 --- /dev/null +++ b/lua/kickstart/plugins/java_setup.lua @@ -0,0 +1,11 @@ +return { + { + 'nvim-java/nvim-java', + dependencies = { + 'nvim-lua/plenary.nvim', + 'neovim/nvim-lspconfig', + 'williamboman/mason.nvim', + 'williamboman/mason-lspconfig.nvim', + }, + } +} \ No newline at end of file