fix: multiple fixes
This commit is contained in:
parent
ebc91cd36c
commit
6f1e570a92
32
init.lua
32
init.lua
|
|
@ -229,9 +229,15 @@ vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower win
|
||||||
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
|
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
|
||||||
|
|
||||||
-- Quit keymaps - easier ways to close Neovim (using capital Q to avoid conflict with diagnostic quickfix)
|
-- Quit keymaps - easier ways to close Neovim (using capital Q to avoid conflict with diagnostic quickfix)
|
||||||
vim.keymap.set('n', '<leader>Qa', '<cmd>qa<CR>', { desc = '[Q]uit [A]ll windows' })
|
-- Session management is automatic via auto-session plugin (saves on exit, restores on startup)
|
||||||
|
vim.keymap.set('n', '<leader>Qa', '<cmd>qa<CR>', { desc = '[Q]uit [A]ll' })
|
||||||
|
|
||||||
vim.keymap.set('n', '<leader>Qq', '<cmd>qa!<CR>', { desc = '[Q]uit all without saving (force)' })
|
vim.keymap.set('n', '<leader>Qq', '<cmd>qa!<CR>', { desc = '[Q]uit all without saving (force)' })
|
||||||
vim.keymap.set('n', '<leader>Qw', '<cmd>wqa<CR>', { desc = '[Q]uit all and [W]rite (save)' })
|
|
||||||
|
vim.keymap.set('n', '<leader>Qw', function()
|
||||||
|
vim.cmd 'wa' -- Write all buffers
|
||||||
|
vim.cmd 'qa'
|
||||||
|
end, { desc = '[Q]uit all and [W]rite files' })
|
||||||
|
|
||||||
-- NOTE: Some terminals have colliding keymaps or are not able to send distinct keycodes
|
-- NOTE: Some terminals have colliding keymaps or are not able to send distinct keycodes
|
||||||
-- vim.keymap.set("n", "<C-S-h>", "<C-w>H", { desc = "Move window to the left" })
|
-- vim.keymap.set("n", "<C-S-h>", "<C-w>H", { desc = "Move window to the left" })
|
||||||
|
|
@ -400,7 +406,9 @@ require('lazy').setup({
|
||||||
|
|
||||||
-- Document existing key chains
|
-- Document existing key chains
|
||||||
spec = {
|
spec = {
|
||||||
{ '<leader>s', group = '[S]earch' },
|
{ '<leader>Q', group = '[Q]uit' }, -- Added Q first so it appears at top
|
||||||
|
{ '<leader>s', group = '[s]earch' }, -- Search commands
|
||||||
|
{ '<leader>S', group = '[S]ession' }, -- Session management (capital S)
|
||||||
{ '<leader>t', group = '[T]oggle' },
|
{ '<leader>t', group = '[T]oggle' },
|
||||||
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
|
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
|
||||||
},
|
},
|
||||||
|
|
@ -462,12 +470,18 @@ require('lazy').setup({
|
||||||
require('telescope').setup {
|
require('telescope').setup {
|
||||||
-- You can put your default mappings / updates / etc. in here
|
-- You can put your default mappings / updates / etc. in here
|
||||||
-- All the info you're looking for is in `:help telescope.setup()`
|
-- All the info you're looking for is in `:help telescope.setup()`
|
||||||
--
|
defaults = {
|
||||||
-- defaults = {
|
mappings = {
|
||||||
-- mappings = {
|
i = {
|
||||||
-- i = { ['<c-enter>'] = 'to_fuzzy_refine' },
|
-- Use Ctrl+j/k to navigate results in insert mode
|
||||||
-- },
|
['<C-j>'] = require('telescope.actions').move_selection_next,
|
||||||
-- },
|
['<C-k>'] = require('telescope.actions').move_selection_previous,
|
||||||
|
-- Optional: Use Ctrl+d/u for scrolling preview
|
||||||
|
['<C-d>'] = require('telescope.actions').preview_scrolling_down,
|
||||||
|
['<C-u>'] = require('telescope.actions').preview_scrolling_up,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
-- pickers = {}
|
-- pickers = {}
|
||||||
extensions = {
|
extensions = {
|
||||||
['ui-select'] = {
|
['ui-select'] = {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" },
|
"LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" },
|
||||||
"auto-session": { "branch": "main", "commit": "4cd20bb5c0138d1ce00ab35f8d7ac0f4fb4a403a" },
|
"auto-session": { "branch": "main", "commit": "292492ab7af4bd8b9e37e28508bc8ce995722fd5" },
|
||||||
"blink.cmp": { "branch": "main", "commit": "327fff91fe6af358e990be7be1ec8b78037d2138" },
|
"blink.cmp": { "branch": "main", "commit": "327fff91fe6af358e990be7be1ec8b78037d2138" },
|
||||||
"conform.nvim": { "branch": "master", "commit": "9fd3d5e0b689ec1bf400c53cbbec72c6fdf24081" },
|
"conform.nvim": { "branch": "master", "commit": "9fd3d5e0b689ec1bf400c53cbbec72c6fdf24081" },
|
||||||
"copilot.vim": { "branch": "release", "commit": "da369d90cfd6c396b1d0ec259836a1c7222fb2ea" },
|
"copilot.vim": { "branch": "release", "commit": "da369d90cfd6c396b1d0ec259836a1c7222fb2ea" },
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
"gitsigns.nvim": { "branch": "main", "commit": "20ad4419564d6e22b189f6738116b38871082332" },
|
"gitsigns.nvim": { "branch": "main", "commit": "20ad4419564d6e22b189f6738116b38871082332" },
|
||||||
"guess-indent.nvim": { "branch": "main", "commit": "84a4987ff36798c2fc1169cbaff67960aed9776f" },
|
"guess-indent.nvim": { "branch": "main", "commit": "84a4987ff36798c2fc1169cbaff67960aed9776f" },
|
||||||
"lazy.nvim": { "branch": "main", "commit": "f0f5bbb9e5bfae5e6468f9359ffea3d151418176" },
|
"lazy.nvim": { "branch": "main", "commit": "f0f5bbb9e5bfae5e6468f9359ffea3d151418176" },
|
||||||
"lazydev.nvim": { "branch": "main", "commit": "c2dfe354571a8255c5d3e96a9a4c297c89ce2347" },
|
"lazydev.nvim": { "branch": "main", "commit": "faf46237f0df43a29e12abd143ff1a0bbac27b7e" },
|
||||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "3590d66effccc7376d8c3dbe45e8291f9fed2843" },
|
"mason-lspconfig.nvim": { "branch": "main", "commit": "3590d66effccc7376d8c3dbe45e8291f9fed2843" },
|
||||||
"mason-tool-installer.nvim": { "branch": "main", "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" },
|
"mason-tool-installer.nvim": { "branch": "main", "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" },
|
||||||
"mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" },
|
"mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" },
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
|
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
|
||||||
"nvim-dap": { "branch": "master", "commit": "6782b097af2417a4c3e33849b0a26ae2188bd7ea" },
|
"nvim-dap": { "branch": "master", "commit": "6782b097af2417a4c3e33849b0a26ae2188bd7ea" },
|
||||||
"nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" },
|
"nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" },
|
||||||
"nvim-lspconfig": { "branch": "master", "commit": "87d30189b24caa496b54affd65594a309ac6d929" },
|
"nvim-lspconfig": { "branch": "master", "commit": "c8c9420b7676caf14e1e1d96caed204a81ba860f" },
|
||||||
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
|
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
|
||||||
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
|
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
|
||||||
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
||||||
|
|
|
||||||
|
|
@ -69,9 +69,22 @@ return {
|
||||||
local capabilities = require('blink.cmp').get_lsp_capabilities()
|
local capabilities = require('blink.cmp').get_lsp_capabilities()
|
||||||
|
|
||||||
require('flutter-tools').setup {
|
require('flutter-tools').setup {
|
||||||
|
-- UI configuration
|
||||||
|
ui = {
|
||||||
|
border = 'rounded', -- border type for floating windows
|
||||||
|
notification_style = 'native', -- 'native' or 'plugin' (native uses vim.notify)
|
||||||
|
},
|
||||||
|
|
||||||
-- Flutter SDK path (usually auto-detected, but you can specify if needed)
|
-- Flutter SDK path (usually auto-detected, but you can specify if needed)
|
||||||
-- flutter_path = '/path/to/flutter/bin/flutter',
|
-- flutter_path = '/path/to/flutter/bin/flutter',
|
||||||
|
-- flutter_lookup_cmd = nil, -- example: "dirname $(which flutter)" or "asdf where flutter"
|
||||||
|
|
||||||
|
-- FVM support - takes priority over path, uses <workspace>/.fvm/flutter_sdk if enabled
|
||||||
|
fvm = false,
|
||||||
|
|
||||||
|
-- Root patterns to find the root of your flutter project
|
||||||
|
root_patterns = { '.git', 'pubspec.yaml' },
|
||||||
|
|
||||||
-- Uncomment to set a default device (get ID from `flutter devices`)
|
-- Uncomment to set a default device (get ID from `flutter devices`)
|
||||||
-- device = {
|
-- device = {
|
||||||
-- id = 'chrome', -- or 'macos', 'emulator-5554', etc.
|
-- id = 'chrome', -- or 'macos', 'emulator-5554', etc.
|
||||||
|
|
@ -79,6 +92,16 @@ return {
|
||||||
|
|
||||||
lsp = {
|
lsp = {
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
|
-- Color preview for dart variables (Colors.red, Color(0xFF...), etc.)
|
||||||
|
-- This shows the actual Material Design colors inline!
|
||||||
|
color = {
|
||||||
|
enabled = true, -- whether or not to highlight color variables at all, only supported on flutter >= 2.10
|
||||||
|
background = true, -- 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 passed to the Dart LSP
|
-- Settings passed to the Dart LSP
|
||||||
settings = {
|
settings = {
|
||||||
-- Show TODOs in the problems pane
|
-- Show TODOs in the problems pane
|
||||||
|
|
@ -87,8 +110,9 @@ return {
|
||||||
completeFunctionCalls = true,
|
completeFunctionCalls = true,
|
||||||
-- Enable/disable specific lints
|
-- Enable/disable specific lints
|
||||||
-- analysisExcludedFolders = {},
|
-- analysisExcludedFolders = {},
|
||||||
renameFilesWithClasses = 'prompt',
|
renameFilesWithClasses = 'prompt', -- "always" or "prompt"
|
||||||
enableSnippets = true,
|
enableSnippets = true,
|
||||||
|
updateImportsOnRename = true, -- Whether to update imports and other directives when files are renamed
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -118,9 +142,26 @@ return {
|
||||||
focus_on_open = false, -- Don't auto-focus the log window
|
focus_on_open = false, -- Don't auto-focus the log window
|
||||||
},
|
},
|
||||||
|
|
||||||
|
dev_tools = {
|
||||||
|
autostart = false, -- autostart devtools server if not detected
|
||||||
|
auto_open_browser = false, -- Automatically opens devtools in the browser
|
||||||
|
},
|
||||||
|
|
||||||
|
outline = {
|
||||||
|
open_cmd = '30vnew', -- command to use to open the outline buffer
|
||||||
|
auto_open = false, -- if true this will open the outline automatically when it is first populated
|
||||||
|
},
|
||||||
|
|
||||||
debugger = {
|
debugger = {
|
||||||
enabled = true, -- Enable Flutter debugger integration
|
enabled = true, -- Enable Flutter debugger integration
|
||||||
run_via_dap = true, -- Use DAP for debugging
|
run_via_dap = true, -- Use DAP for debugging
|
||||||
|
-- if empty dap will not stop on any exceptions, otherwise it will stop on those specified
|
||||||
|
-- see |:help dap.set_exception_breakpoints()| for more info
|
||||||
|
exception_breakpoints = {},
|
||||||
|
-- Whether to call toString() on objects in debug views like hovers and the variables list.
|
||||||
|
-- Invoking toString() has a performance cost and may introduce side-effects,
|
||||||
|
-- although users may expected this functionality. null is treated like false.
|
||||||
|
evaluate_to_string_in_debug_views = true,
|
||||||
-- Flutter tools will automatically register DAP configurations
|
-- Flutter tools will automatically register DAP configurations
|
||||||
-- No need to manually configure launch.json
|
-- No need to manually configure launch.json
|
||||||
},
|
},
|
||||||
|
|
@ -176,28 +217,31 @@ return {
|
||||||
dap.listeners.before.event_terminated['dapui_config'] = dapui.close
|
dap.listeners.before.event_terminated['dapui_config'] = dapui.close
|
||||||
dap.listeners.before.event_exited['dapui_config'] = dapui.close
|
dap.listeners.before.event_exited['dapui_config'] = dapui.close
|
||||||
|
|
||||||
-- Fix for Flutter Tools log buffer becoming non-modifiable
|
-- Fix for Flutter Tools log buffer - make it non-saveable
|
||||||
-- This catches all buffer types that might be used for Flutter logs
|
-- This prevents Vim from asking to save changes to the log file on exit
|
||||||
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWinEnter' }, {
|
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWinEnter' }, {
|
||||||
pattern = '*',
|
pattern = '*',
|
||||||
callback = function(args)
|
callback = function(args)
|
||||||
local bufname = vim.api.nvim_buf_get_name(args.buf)
|
local bufname = vim.api.nvim_buf_get_name(args.buf)
|
||||||
-- Check if this is a Flutter log buffer
|
-- Check if this is a Flutter log buffer
|
||||||
if bufname:match('__FLUTTER_DEV_LOG__') or vim.bo[args.buf].filetype == 'log' then
|
if bufname:match('__FLUTTER_DEV_LOG__') or vim.bo[args.buf].filetype == 'log' then
|
||||||
vim.bo[args.buf].modifiable = true
|
vim.bo[args.buf].modifiable = true -- Allow Flutter to write to it
|
||||||
vim.bo[args.buf].readonly = false
|
vim.bo[args.buf].modified = false -- Mark as unmodified
|
||||||
vim.bo[args.buf].buftype = '' -- Make it a normal buffer
|
vim.bo[args.buf].buftype = 'nofile' -- Don't associate with a file (prevents save prompt)
|
||||||
|
vim.bo[args.buf].swapfile = false -- Don't create swap file
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Also fix it whenever Flutter tries to write to the log
|
-- Keep log buffer marked as unmodified whenever it changes
|
||||||
|
-- This prevents the "save changes?" prompt on exit
|
||||||
vim.api.nvim_create_autocmd('BufModifiedSet', {
|
vim.api.nvim_create_autocmd('BufModifiedSet', {
|
||||||
pattern = '*',
|
pattern = '*',
|
||||||
callback = function(args)
|
callback = function(args)
|
||||||
local bufname = vim.api.nvim_buf_get_name(args.buf)
|
local bufname = vim.api.nvim_buf_get_name(args.buf)
|
||||||
if bufname:match('__FLUTTER_DEV_LOG__') then
|
if bufname:match('__FLUTTER_DEV_LOG__') then
|
||||||
vim.bo[args.buf].modifiable = true
|
vim.bo[args.buf].modifiable = true
|
||||||
|
vim.bo[args.buf].modified = false -- Keep it marked as unmodified
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -7,21 +7,35 @@
|
||||||
-- the same directory.
|
-- the same directory.
|
||||||
--
|
--
|
||||||
-- Features:
|
-- Features:
|
||||||
-- - Auto-saves session on exit
|
-- - ✅ Auto-saves session on exit (automatically!)
|
||||||
-- - Auto-restores session when opening Neovim in a directory
|
-- - ✅ Auto-restores session when you `cd` into a directory and run `nvim`
|
||||||
-- - Saves per-directory (each project has its own session)
|
-- - Saves per-directory (each project has its own session)
|
||||||
-- - Saves open buffers, window splits, cursor positions, and more
|
-- - Saves open buffers, window splits, cursor positions, and more
|
||||||
--
|
--
|
||||||
-- Keymaps:
|
-- IMPORTANT: Auto-restore works when you:
|
||||||
-- <leader>ss - Save session manually
|
-- 1. cd /path/to/your/project
|
||||||
-- <leader>sr - Restore session manually
|
-- 2. nvim (without specifying files)
|
||||||
-- <leader>sd - Delete session for current directory
|
--
|
||||||
-- <leader>sf - Find/search all sessions (Telescope)
|
-- If you open a specific file (e.g., `nvim main.dart`), auto-restore is skipped.
|
||||||
|
-- Use manual restore (<leader>Sr) if needed.
|
||||||
--
|
--
|
||||||
-- Quit keymaps (in init.lua):
|
-- Keymaps:
|
||||||
-- <leader>Qa - Quit all windows
|
-- <leader>Ss - Save session manually
|
||||||
-- <leader>Qq - Force quit all without saving
|
-- <leader>Sr - Restore session manually (if auto-restore didn't trigger)
|
||||||
-- <leader>Qw - Save all and quit
|
-- <leader>Sd - Delete session for current directory
|
||||||
|
-- <leader>Sf - Find/search all sessions (Telescope)
|
||||||
|
--
|
||||||
|
-- Quit keymaps (in init.lua, integrated with auto-session):
|
||||||
|
-- <leader>Qa - Quit all and save session (most common)
|
||||||
|
-- <leader>Qq - Force quit all without saving (no session save)
|
||||||
|
-- <leader>Qw - Save all files, save session, then quit
|
||||||
|
--
|
||||||
|
-- WORKFLOW:
|
||||||
|
-- 1. cd into your project directory
|
||||||
|
-- 2. nvim (session auto-restores if it exists!)
|
||||||
|
-- 3. Work on your project
|
||||||
|
-- 4. Quit with <leader>Qa or just :qa (auto-saves!)
|
||||||
|
-- 5. Next time: repeat from step 1 - your workspace is restored!
|
||||||
--
|
--
|
||||||
-- Sessions are saved in: ~/.local/share/nvim/sessions/
|
-- Sessions are saved in: ~/.local/share/nvim/sessions/
|
||||||
-- ========================================================================
|
-- ========================================================================
|
||||||
|
|
@ -31,14 +45,15 @@ return {
|
||||||
lazy = false, -- Load on startup to restore session
|
lazy = false, -- Load on startup to restore session
|
||||||
opts = {
|
opts = {
|
||||||
-- Session save/restore options
|
-- Session save/restore options
|
||||||
auto_session_enabled = true, -- Automatically save sessions
|
auto_session_enabled = true, -- Automatically save sessions on exit
|
||||||
auto_restore_enabled = true, -- Automatically restore sessions
|
auto_restore_enabled = true, -- Automatically restore sessions on startup
|
||||||
auto_save_enabled = true, -- Auto-save on exit
|
auto_save_enabled = true, -- Auto-save session on exit
|
||||||
auto_session_suppress_dirs = { '~/', '~/Downloads', '/' }, -- Don't save sessions in these dirs
|
auto_session_suppress_dirs = { '~/', '~/Downloads', '/' }, -- Don't save sessions in these dirs
|
||||||
auto_session_use_git_branch = false, -- One session per directory (not per git branch)
|
auto_session_use_git_branch = false, -- One session per directory (not per git branch)
|
||||||
|
|
||||||
-- What to save in the session
|
-- What to save in the session
|
||||||
auto_session_enable_last_session = false, -- Don't restore last session if not in a project
|
auto_session_enable_last_session = false, -- Don't restore last session if not in a project
|
||||||
|
auto_session_create_enabled = true, -- Auto-create session on first save
|
||||||
|
|
||||||
-- Hooks to run before/after session save/restore
|
-- Hooks to run before/after session save/restore
|
||||||
pre_save_cmds = {
|
pre_save_cmds = {
|
||||||
|
|
@ -56,25 +71,25 @@ return {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
keys = {
|
keys = {
|
||||||
-- Manual session control
|
-- Manual session control (Capital S to avoid conflict with search)
|
||||||
{
|
{
|
||||||
'<leader>ss',
|
'<leader>Ss',
|
||||||
'<cmd>SessionSave<cr>',
|
'<cmd>AutoSession save<cr>',
|
||||||
desc = '[S]ession: [S]ave',
|
desc = '[S]ession: [S]ave',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'<leader>sr',
|
'<leader>Sr',
|
||||||
'<cmd>SessionRestore<cr>',
|
'<cmd>AutoSession restore<cr>',
|
||||||
desc = '[S]ession: [R]estore',
|
desc = '[S]ession: [R]estore',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'<leader>sd',
|
'<leader>Sd',
|
||||||
'<cmd>SessionDelete<cr>',
|
'<cmd>AutoSession delete<cr>',
|
||||||
desc = '[S]ession: [D]elete',
|
desc = '[S]ession: [D]elete',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'<leader>sf',
|
'<leader>Sf',
|
||||||
'<cmd>SessionSearch<cr>',
|
'<cmd>AutoSession search<cr>',
|
||||||
desc = '[S]ession: [F]ind/search',
|
desc = '[S]ession: [F]ind/search',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue