Skip to content
Closed

vim #2071

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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({})`
{
Expand Down Expand Up @@ -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,
},

Expand Down Expand Up @@ -878,7 +891,7 @@ require('lazy').setup({
-- [[ Configure Treesitter ]] See `:help nvim-treesitter-intro`
config = function()
local parsers = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }
require('nvim-treesitter').install(parsers)
require('nvim-treesitter.install').ensure_installed(parsers)
vim.api.nvim_create_autocmd('FileType', {
callback = function(args)
local buf, filetype = args.buf, args.match
Expand Down Expand Up @@ -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.
Expand Down
106 changes: 106 additions & 0 deletions lua/kickstart/plugins/flutter_pancake.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
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)

vim.api.nvim_create_autocmd("FileType", {
pattern = "dart",
callback = function()
vim.opt_local.shiftwidth = 2
vim.opt_local.tabstop = 2
vim.opt_local.softtabstop = 2
vim.opt_local.expandtab = true
end,
})

local extensions = require('telescope').extensions
vim.keymap.set('n', '<leader>fl', extensions.flutter.commands, { desc = '[F]lutter commands' })
vim.keymap.set(
'n',
'<leader>fd',
'<Cmd>FlutterRun -d macos --flavor dev --dart-define=FLAVOR=dev<CR>',
{ desc = '[F]lutter Run [D]ev Flavor for Desktop' }
)
vim.keymap.set('n', '<leader>fr', '<Cmd>FlutterRun --flavor dev --dart-define=FLAVOR=dev<CR>', { desc = '[F]lutter Run [D]ev Flavor' })
vim.keymap.set(
'n',
'<leader>fw',
'<Cmd>FlutterRun -d chrome --web-experimental-hot-reload --web-browser-flag "--disable-web-security" --web-port 5000<CR>',
{ desc = '[F]lutter Run [W]eb' }
)
vim.keymap.set('n', '<leader>fv', extensions.flutter.fvm, { desc = '[F]lutter version manager' })
vim.keymap.set('n', '<leader>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', '<leader>fc', '<Cmd>FlutterLogClear<CR>', { desc = '[F]lutter Log [C]lear' })
vim.keymap.set('n', '<leader>fo', '<Cmd>FlutterLogToggle<CR>', { desc = '[F]lutter Log T[o]ggle' })
vim.keymap.set('n', '<leader>fq', '<Cmd>FlutterQuit<CR>', { desc = '[F]lutter [Q]uit' })
vim.keymap.set('n', '<leader>fs', '<Cmd>FlutterRestart<CR>', { desc = '[F]lutter Re[s]tart' })
end,
},
}
11 changes: 11 additions & 0 deletions lua/kickstart/plugins/java_setup.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
return {
{
'nvim-java/nvim-java',
dependencies = {
'nvim-lua/plenary.nvim',
'neovim/nvim-lspconfig',
'williamboman/mason.nvim',
'williamboman/mason-lspconfig.nvim',
},
}
}
Loading