feat: added initial configs for flutter, python and svelte

This commit is contained in:
Anup Sebastian 2025-10-29 21:07:26 -05:00
parent a92991b8e2
commit dd2e744f0b
8 changed files with 1044 additions and 31 deletions

View file

@ -0,0 +1,132 @@
-- ========================================================================
-- FLUTTER/DART PROFILE - Language-specific plugins and LSP configuration
-- ========================================================================
--
-- This file contains all Flutter and Dart-specific plugins and configurations.
-- These plugins will ONLY load when you open a .dart file, keeping your
-- startup time fast and avoiding conflicts with other languages.
--
-- Key features to configure here:
-- - Flutter tools (hot reload, device management, widget inspector)
-- - Dart LSP (dartls via flutter-tools)
-- - Dart-specific formatters and linters
-- - Flutter-specific keymaps (e.g., <leader>fr for Flutter Run)
--
-- Usage: Just open a .dart file and these plugins will automatically load!
-- ========================================================================
return {
-- ========================================================================
-- FLUTTER TOOLS - Complete Flutter development environment
-- ========================================================================
-- Provides Flutter-specific features like hot reload, device management,
-- widget inspector, and integrates the Dart LSP server.
--
-- Flutter-specific keymaps (available in .dart files):
-- <leader>fr - Flutter Run (start app)
-- <leader>fq - Flutter Quit (stop app)
-- <leader>fR - Flutter Hot Restart
-- <leader>fd - Flutter Devices (show connected devices)
-- <leader>fe - Flutter Emulators (launch emulator)
-- <leader>fo - Flutter Outline (toggle outline/widget tree)
-- <leader>fc - Flutter Copy Profile URL (for DevTools)
-- ========================================================================
{
'nvim-flutter/flutter-tools.nvim',
ft = 'dart', -- Only load when opening Dart files
dependencies = {
'nvim-lua/plenary.nvim',
'stevearc/dressing.nvim', -- Optional: better UI for Flutter commands
},
config = function()
-- Get shared LSP capabilities from blink.cmp
local capabilities = require('blink.cmp').get_lsp_capabilities()
require('flutter-tools').setup {
-- Flutter SDK path (usually auto-detected, but you can specify if needed)
-- flutter_path = '/path/to/flutter/bin/flutter',
lsp = {
capabilities = capabilities,
-- Settings passed to the Dart LSP
settings = {
-- Show TODOs in the problems pane
showTodos = true,
-- Completion settings
completeFunctionCalls = true,
-- Enable/disable specific lints
-- analysisExcludedFolders = {},
renameFilesWithClasses = 'prompt',
enableSnippets = true,
},
},
-- Flutter-specific settings
decorations = {
statusline = {
-- Set to true to show Flutter app info in statusline
app_version = false,
device = true, -- Show device name
},
},
widget_guides = {
enabled = true, -- Show visual guides for widget nesting
},
closing_tags = {
highlight = 'Comment', -- Highlight color for closing tags
prefix = '// ', -- Text to show before closing tag
enabled = true, -- Show closing tags for widgets
},
dev_log = {
enabled = true,
open_cmd = 'tabedit', -- Open logs in a new tab
},
debugger = {
enabled = true, -- Enable Flutter debugger integration
run_via_dap = false, -- Use Flutter tools debugger (not DAP)
},
}
-- ========================================================================
-- FLUTTER-SPECIFIC KEYMAPS
-- ========================================================================
-- These keymaps are only available when editing Dart files
-- They provide quick access to common Flutter commands
-- ========================================================================
vim.api.nvim_create_autocmd('FileType', {
pattern = 'dart',
callback = function()
local opts = { buffer = true, silent = true }
-- Flutter run/quit
vim.keymap.set('n', '<leader>fr', '<cmd>FlutterRun<cr>', vim.tbl_extend('force', opts, { desc = '[F]lutter [R]un' }))
vim.keymap.set('n', '<leader>fq', '<cmd>FlutterQuit<cr>', vim.tbl_extend('force', opts, { desc = '[F]lutter [Q]uit' }))
vim.keymap.set('n', '<leader>fR', '<cmd>FlutterRestart<cr>', vim.tbl_extend('force', opts, { desc = '[F]lutter Hot [R]estart' }))
-- Device management
vim.keymap.set('n', '<leader>fd', '<cmd>FlutterDevices<cr>', vim.tbl_extend('force', opts, { desc = '[F]lutter [D]evices' }))
vim.keymap.set('n', '<leader>fe', '<cmd>FlutterEmulators<cr>', vim.tbl_extend('force', opts, { desc = '[F]lutter [E]mulators' }))
-- Dev tools
vim.keymap.set('n', '<leader>fo', '<cmd>FlutterOutlineToggle<cr>', vim.tbl_extend('force', opts, { desc = '[F]lutter [O]utline Toggle' }))
vim.keymap.set(
'n',
'<leader>fc',
'<cmd>FlutterCopyProfilerUrl<cr>',
vim.tbl_extend('force', opts, { desc = '[F]lutter [C]opy Profiler URL' })
)
vim.keymap.set('n', '<leader>fl', '<cmd>FlutterLspRestart<cr>', vim.tbl_extend('force', opts, { desc = '[F]lutter [L]SP Restart' }))
-- Register Flutter group with which-key
require('which-key').add {
{ '<leader>f', group = '[F]lutter', mode = 'n' },
}
end,
})
end,
},
}

View file

@ -1,5 +1,124 @@
-- You can add your own plugins here or in other files in this directory!
-- I promise not to create any merge conflicts in this directory :)
-- ========================================================================
-- COMMON PLUGINS - Loaded for all filetypes/profiles
-- ========================================================================
--
-- This file contains plugins that are always loaded regardless of what
-- file type you're working with. These are your "core" plugins that
-- provide functionality across all your language profiles.
--
-- Examples: file explorers, git tools, common UI elements, copilot, etc.
--
-- See the kickstart.nvim README for more information
return {}
-- ========================================================================
return {
-- ========================================================================
-- FILE EXPLORER - Neo-tree
-- ========================================================================
-- Neo-tree provides a modern file explorer sidebar similar to VS Code.
-- It's loaded for all profiles so you can browse files regardless of
-- what language you're working with.
--
-- Keybindings:
-- \ (backslash) - Toggle Neo-tree file explorer
-- Within Neo-tree:
-- a - Add file/folder
-- d - Delete
-- r - Rename
-- x - Cut
-- c - Copy
-- p - Paste
-- ? - Show help (see all keybindings)
--
-- Note: This references the existing neo-tree configuration from
-- kickstart/plugins/neo-tree.lua. We're just ensuring it's loaded.
-- ========================================================================
-- {
-- 'nvim-neo-tree/neo-tree.nvim',
-- version = '*',
-- dependencies = {
-- 'nvim-lua/plenary.nvim',
-- 'nvim-tree/nvim-web-devicons', -- not strictly required, but recommended
-- 'MunifTanjim/nui.nvim',
-- },
-- cmd = 'Neotree', -- Lazy load on command
-- keys = {
-- { '\\', ':Neotree reveal<CR>', desc = 'NeoTree reveal', silent = true },
-- },
-- opts = {
-- filesystem = {
-- window = {
-- mappings = {
-- ['\\'] = 'close_window',
-- },
-- },
-- follow_current_file = {
-- enabled = true, -- Focus on the current file when opening
-- },
-- hijack_netrw_behavior = 'open_current', -- Use neo-tree instead of netrw
-- },
-- },
-- },
-- ========================================================================
-- GITHUB COPILOT - AI pair programming assistant
-- ========================================================================
-- GitHub Copilot provides AI-powered code completions and suggestions.
-- Works across all file types and integrates with your completion engine.
--
-- Setup:
-- 1. After installing, run :Copilot setup
-- 2. Follow the authentication flow
-- 3. You'll need an active GitHub Copilot subscription
--
-- Usage:
-- - Copilot suggestions appear automatically as you type
-- - Press Tab to accept a suggestion
-- - Press Ctrl+] to see next suggestion
-- - Press Ctrl+[ to see previous suggestion
-- - :Copilot panel - Open completion panel with multiple suggestions
--
-- Commands:
-- :Copilot setup - Authenticate with GitHub
-- :Copilot status - Check authentication status
-- :Copilot enable - Enable Copilot
-- :Copilot disable - Disable Copilot
-- ========================================================================
{
'github/copilot.vim',
lazy = false, -- Load immediately on startup (not lazy-loaded)
config = function()
-- Copilot keybindings (optional customization)
-- By default, Tab accepts suggestions, but this might conflict with completion
-- Uncomment below to use Ctrl+J to accept instead:
-- vim.keymap.set('i', '<C-J>', 'copilot#Accept("\\<CR>")', {
-- expr = true,
-- replace_keycodes = false,
-- })
-- vim.g.copilot_no_tab_map = true
-- Optional: Disable Copilot for certain filetypes
-- vim.g.copilot_filetypes = {
-- ['*'] = true,
-- ['markdown'] = false,
-- ['text'] = false,
-- }
end,
},
-- ========================================================================
-- ADDITIONAL COMMON PLUGINS
-- ========================================================================
-- You can add more common plugins here that should be available across
-- all language profiles. Examples:
--
-- - Better terminal integration
-- - Git integration enhancements (beyond gitsigns in init.lua)
-- - Session management
-- - Project management
-- - Alternative completion sources
-- - UI enhancements
--
-- Just add them to this return table following the same pattern as above.
-- ========================================================================
}

View file

@ -0,0 +1,105 @@
-- ========================================================================
-- PYTHON PROFILE - Language-specific plugins and LSP configuration
-- ========================================================================
--
-- This file contains all Python-specific plugins and configurations.
-- These plugins will ONLY load when you open a .py file, keeping your
-- startup time fast and avoiding conflicts with other languages.
--
-- Key features to configure here:
-- - Python LSP (pyright or pylsp)
-- - Python formatters (black, ruff, isort, etc.)
-- - Python linters and type checkers
-- - Debugger integration (debugpy)
-- - Testing tools (pytest)
-- - Virtual environment detection
-- - Python-specific keymaps
--
-- Usage: Just open a .py file and these plugins will automatically load!
-- ========================================================================
return {
-- ========================================================================
-- PYTHON LSP - Language Server Protocol for Python
-- ========================================================================
-- Provides intelligent code completion, go-to-definition, type checking,
-- and more for Python files using pyright (fast, feature-rich LSP)
-- ========================================================================
{
'neovim/nvim-lspconfig',
ft = 'python', -- Only load when opening Python files
dependencies = {
'WhoIsSethDaniel/mason-tool-installer.nvim', -- For installing pyright
},
config = function()
-- Get shared LSP capabilities from blink.cmp
local capabilities = require('blink.cmp').get_lsp_capabilities()
-- Setup pyright LSP server
require('lspconfig').pyright.setup {
capabilities = capabilities,
settings = {
python = {
analysis = {
-- Type checking mode: "off", "basic", or "strict"
typeCheckingMode = 'basic',
-- Auto-import completions
autoImportCompletions = true,
-- Automatically search for stubs
autoSearchPaths = true,
-- Use library code for types
useLibraryCodeForTypes = true,
-- Diagnostic mode: "openFilesOnly" or "workspace"
diagnosticMode = 'openFilesOnly',
},
},
},
}
-- Install Python tools via Mason
require('mason-tool-installer').setup {
ensure_installed = {
'pyright', -- LSP server for type checking and completions
'ruff', -- Fast formatter, linter, and import organizer (replaces black, isort, flake8)
},
}
end,
},
-- ========================================================================
-- PYTHON FORMATTERS - Auto-format Python code
-- ========================================================================
-- Uses Ruff for fast formatting and import organization
-- Ruff provides Black-compatible formatting + import sorting in one tool
-- ========================================================================
{
'stevearc/conform.nvim',
ft = 'python',
opts = function(_, opts)
-- Extend the existing formatters_by_ft table
opts.formatters_by_ft = opts.formatters_by_ft or {}
opts.formatters_by_ft.python = {
-- Ruff handles both formatting and import sorting (fast & modern)
'ruff_organize_imports', -- First: organize imports
'ruff_format', -- Then: format code (Black-compatible)
}
return opts
end,
},
-- ========================================================================
-- PYTHON-SPECIFIC KEYMAPS AND CONFIGURATION
-- ========================================================================
-- Additional Python-specific settings and keymaps
-- ========================================================================
{
'nvim-treesitter/nvim-treesitter',
ft = 'python',
opts = function(_, opts)
-- Ensure Python parser is installed
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { 'python' })
return opts
end,
},
}

View file

@ -0,0 +1,168 @@
-- ========================================================================
-- SVELTE PROFILE - Language-specific plugins and LSP configuration
-- ========================================================================
--
-- This file contains all Svelte-specific plugins and configurations.
-- These plugins will ONLY load when you open a .svelte file, keeping your
-- startup time fast and avoiding conflicts with other languages.
--
-- Key features to configure here:
-- - Svelte LSP (svelte-language-server)
-- - TypeScript/JavaScript support for Svelte components
-- - Tailwind CSS integration (if using Tailwind)
-- - Prettier formatting for Svelte files
-- - Emmet support for Svelte
-- - Svelte-specific keymaps
--
-- Note: You may also want to configure support for related web files:
-- - JavaScript/TypeScript (.js, .ts)
-- - HTML/CSS (.html, .css)
--
-- Usage: Just open a .svelte file and these plugins will automatically load!
-- ========================================================================
return {
-- ========================================================================
-- SVELTE LSP - Language Server Protocol for Svelte
-- ========================================================================
-- Provides intelligent code completion, diagnostics, and more for Svelte
-- components, including support for TypeScript, CSS, and HTML within .svelte files
-- ========================================================================
{
'neovim/nvim-lspconfig',
ft = { 'svelte', 'typescript', 'javascript' }, -- Load for web files
dependencies = {
'WhoIsSethDaniel/mason-tool-installer.nvim',
},
config = function()
-- Get shared LSP capabilities from blink.cmp
local capabilities = require('blink.cmp').get_lsp_capabilities()
-- Setup Svelte LSP server
require('lspconfig').svelte.setup {
capabilities = capabilities,
settings = {
svelte = {
plugin = {
html = { completions = { enable = true, emmet = true } },
svelte = { completions = { enable = true } },
css = { completions = { enable = true } },
typescript = { diagnostics = { enable = true } },
},
},
},
}
-- Optional: Setup TypeScript LSP for .ts/.js files in Svelte projects
require('lspconfig').ts_ls.setup {
capabilities = capabilities,
-- Configure to work well with Svelte
filetypes = {
'javascript',
'javascriptreact',
'typescript',
'typescriptreact',
},
}
-- Optional: Setup Tailwind CSS LSP if you're using Tailwind
require('lspconfig').tailwindcss.setup {
capabilities = capabilities,
filetypes = {
'svelte',
'html',
'css',
'scss',
'javascript',
'javascriptreact',
'typescript',
'typescriptreact',
},
}
-- Install web development tools via Mason
require('mason-tool-installer').setup {
ensure_installed = {
'svelte-language-server', -- Svelte LSP
'typescript-language-server', -- TypeScript/JavaScript LSP
'tailwindcss-language-server', -- Tailwind CSS LSP (optional)
'prettier', -- Code formatter for web files
'eslint_d', -- Fast ESLint for linting JS/TS
},
}
end,
},
-- ========================================================================
-- WEB FORMATTERS - Prettier for Svelte/JS/TS/CSS
-- ========================================================================
-- Configures prettier to format Svelte and related web files
-- ========================================================================
{
'stevearc/conform.nvim',
ft = { 'svelte', 'typescript', 'javascript', 'css', 'html', 'json' },
opts = function(_, opts)
-- Extend the existing formatters_by_ft table
opts.formatters_by_ft = opts.formatters_by_ft or {}
opts.formatters_by_ft.svelte = { 'prettier' }
opts.formatters_by_ft.javascript = { 'prettier' }
opts.formatters_by_ft.javascriptreact = { 'prettier' }
opts.formatters_by_ft.typescript = { 'prettier' }
opts.formatters_by_ft.typescriptreact = { 'prettier' }
opts.formatters_by_ft.css = { 'prettier' }
opts.formatters_by_ft.html = { 'prettier' }
opts.formatters_by_ft.json = { 'prettier' }
opts.formatters_by_ft.markdown = { 'prettier' }
return opts
end,
},
-- ========================================================================
-- TREESITTER PARSERS - Syntax highlighting for web languages
-- ========================================================================
-- Ensures Treesitter parsers are installed for better syntax highlighting
-- ========================================================================
{
'nvim-treesitter/nvim-treesitter',
ft = { 'svelte', 'typescript', 'javascript', 'css', 'html' },
opts = function(_, opts)
-- Ensure web language parsers are installed
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, {
'svelte',
'typescript',
'tsx',
'javascript',
'jsdoc',
'css',
'html',
'json',
})
return opts
end,
},
-- ========================================================================
-- EMMET - HTML/CSS abbreviation expansion
-- ========================================================================
-- Provides Emmet abbreviation support for faster HTML/CSS writing
-- Type abbreviations like `div.container>ul>li*3` and expand with <C-y>,
-- ========================================================================
{
'mattn/emmet-vim',
ft = { 'svelte', 'html', 'css', 'javascript', 'typescript' },
init = function()
-- Set Emmet leader key (default is <C-y>)
vim.g.user_emmet_leader_key = '<C-e>'
-- Enable only for specific file types
vim.g.user_emmet_install_global = 0
-- Enable Emmet for Svelte files
vim.api.nvim_create_autocmd('FileType', {
pattern = { 'html', 'css', 'svelte', 'javascript', 'typescript' },
callback = function()
vim.cmd 'EmmetInstall'
end,
})
end,
},
}