astro-nvim-v3 - Note: disable tab when using copilot
This commit is contained in:
13
init.lua
13
init.lua
@@ -1,19 +1,22 @@
|
||||
-- This file simply bootstraps the installation of Lazy.nvim and then calls other files for execution
|
||||
-- This file doesn't necessarily need to be touched, BE CAUTIOUS editing this file and proceed at your own risk.
|
||||
local lazypath = vim.env.LAZY or vim.fn.stdpath "data" .. "/lazy/lazy.nvim"
|
||||
local lazypath = vim.env.LAZY or vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not (vim.env.LAZY or (vim.uv or vim.loop).fs_stat(lazypath)) then
|
||||
-- stylua: ignore
|
||||
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath })
|
||||
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable",
|
||||
lazypath })
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
-- validate that lazy is available
|
||||
if not pcall(require, "lazy") then
|
||||
-- stylua: ignore
|
||||
vim.api.nvim_echo({ { ("Unable to load lazy from: %s\n"):format(lazypath), "ErrorMsg" }, { "Press any key to exit...", "MoreMs" } }, true, {})
|
||||
vim.api.nvim_echo(
|
||||
{ { ("Unable to load lazy from: %s\n"):format(lazypath), "ErrorMsg" }, { "Press any key to exit...", "MoreMs" } }, true,
|
||||
{})
|
||||
vim.fn.getchar()
|
||||
vim.cmd.quit()
|
||||
end
|
||||
|
||||
require "lazy_setup"
|
||||
require "polish"
|
||||
require("lazy_setup")
|
||||
require("polish")
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
{
|
||||
"AstroNvim": { "branch": "main", "commit": "c5e610f614e74c9dd9bf11760c4d0ad2c98c0abe" },
|
||||
"Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
|
||||
"LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" },
|
||||
"LuaSnip": { "branch": "master", "commit": "458560534a73f7f8d7a11a146c801db00b081df0" },
|
||||
"aerial.nvim": { "branch": "master", "commit": "3284a2cb858ba009c79da87d5e010ccee3c99c4d" },
|
||||
"alpha-nvim": { "branch": "main", "commit": "de72250e054e5e691b9736ee30db72c65d560771" },
|
||||
"astrocommunity": { "branch": "main", "commit": "b4ea687d6ceae110430c9085992af41aedb12406" },
|
||||
"astrocommunity": { "branch": "main", "commit": "c44cdc008f6b2fb745a7c829100b87a1cfb21b82" },
|
||||
"astrocore": { "branch": "main", "commit": "44a3dc0bf1591022b2a6bc89dccdfac1be17bec9" },
|
||||
"astrolsp": { "branch": "main", "commit": "909fbe64f3f87d089ff3777751261544557117cc" },
|
||||
"astrotheme": { "branch": "main", "commit": "41b7d8430a55fd771e41bd763af4c3fd1c2fc0b5" },
|
||||
"astroui": { "branch": "main", "commit": "e923a84c488d879a260fc9cfb2dc27dd870fb6ac" },
|
||||
"auto-save.nvim": { "branch": "main", "commit": "29f793a3a7f98129387590269ffe3ad61ab5e509" },
|
||||
"bamboo.nvim": { "branch": "master", "commit": "97124a0b81f886abc0d666ebec512b92425d67b6" },
|
||||
"auto-save.nvim": { "branch": "main", "commit": "37c82fd548e3f5ffc2d9d020a65dac1044584f44" },
|
||||
"bamboo.nvim": { "branch": "master", "commit": "ab8393d1a314d96314605369b4b1e6bc7737f2b5" },
|
||||
"better-escape.nvim": { "branch": "master", "commit": "199dcc2643dec5d8dbdab4ec672cf405224dcb3b" },
|
||||
"catppuccin": { "branch": "main", "commit": "0b5df9c9e641b1212b21a0762ccad4434fd41322" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||
"cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
|
||||
"cmp-cmdline": { "branch": "main", "commit": "d126061b624e0af6c3a556428712dd4d4194ec6d" },
|
||||
"cmp-dap": { "branch": "master", "commit": "ea92773e84c0ad3288c3bc5e452ac91559669087" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" },
|
||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
|
||||
"code_runner.nvim": { "branch": "main", "commit": "65218f8f646fe61e506090522df357539642ae83" },
|
||||
"copilot.vim": { "branch": "release", "commit": "a9228e015528c9307890c48083c925eb98a64a79" },
|
||||
"copilot.vim": { "branch": "release", "commit": "12995dffe10282b29b8335650bf3e7457f4870e7" },
|
||||
"cyberdream.nvim": { "branch": "main", "commit": "cd3c2e7955034a5bec0e1beb9d7cb80c639ef5d5" },
|
||||
"dressing.nvim": { "branch": "master", "commit": "3a45525bb182730fe462325c99395529308f431e" },
|
||||
"duplicate.nvim": { "branch": "main", "commit": "ab057af7872c44e6fbd48df9b03983c8e67c50a7" },
|
||||
@@ -28,7 +28,7 @@
|
||||
"friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "7010000889bfb6c26065e0b0f7f1e6aa9163edd9" },
|
||||
"guess-indent.nvim": { "branch": "main", "commit": "6cd61f7a600bb756e558627cd2e740302c58e32d" },
|
||||
"heirline.nvim": { "branch": "master", "commit": "cc359b628266cb9a84b2d71c883f2b99e16473a0" },
|
||||
"heirline.nvim": { "branch": "master", "commit": "fae936abb5e0345b85c3a03ecf38525b0828b992" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "3fe94b8034dd5241cb882bb73847303b58857ecf" },
|
||||
"kanagawa.nvim": { "branch": "master", "commit": "e5f7b8a804360f0a48e40d0083a97193ee4fcc87" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
||||
@@ -42,43 +42,43 @@
|
||||
"mason-nvim-dap.nvim": { "branch": "main", "commit": "4c2cdc69d69fe00c15ae8648f7e954d99e5de3ea" },
|
||||
"mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" },
|
||||
"mini.bufremove": { "branch": "main", "commit": "285bdac9596ee7375db50c0f76ed04336dcd2685" },
|
||||
"mini.icons": { "branch": "main", "commit": "397ed3807e96b59709ef3292f0a3e253d5c1dc0a" },
|
||||
"mini.indentscope": { "branch": "main", "commit": "8af2569a7d7fd37300dfa760e44e71efbbf322fd" },
|
||||
"mini.move": { "branch": "main", "commit": "4fe4a855fee53c66b0f3255a4b54ddc2ae6b308c" },
|
||||
"mini.icons": { "branch": "main", "commit": "94848dad1589a199f876539bd79befb0c5e3abf0" },
|
||||
"mini.indentscope": { "branch": "main", "commit": "5fdc3edf7bb1b6365980c2c47dac2f19ec93c97b" },
|
||||
"mini.move": { "branch": "main", "commit": "f471ecb98395781827ef1dffee61afe1af0ace29" },
|
||||
"monokai-pro.nvim": { "branch": "master", "commit": "4f4133601296881bb2197800bd68d2bba9eaadb9" },
|
||||
"multiple-cursors.nvim": { "branch": "main", "commit": "1ac15d047a4b265cc2389957bcc56ee561b29e02" },
|
||||
"neo-tree.nvim": { "branch": "main", "commit": "9b5d67119c46e3262ffe1508fe6d8540b79ad75d" },
|
||||
"neo-tree.nvim": { "branch": "main", "commit": "cea666ef965884414b1b71f6b39a537f9238bdb2" },
|
||||
"neoconf.nvim": { "branch": "main", "commit": "f630568a4d04154803886f21ca60923f12709f0f" },
|
||||
"noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" },
|
||||
"none-ls-extras.nvim": { "branch": "main", "commit": "1214d729e3408470a7b7a428415a395e5389c13c" },
|
||||
"none-ls-extras.nvim": { "branch": "main", "commit": "924fe88a9983c7d90dbb31fc4e3129a583ea0a90" },
|
||||
"none-ls.nvim": { "branch": "main", "commit": "a117163db44c256d53c3be8717f3e1a2a28e6299" },
|
||||
"nui.nvim": { "branch": "main", "commit": "a0fd35fcbb4cb479366f1dc5f20145fd718a3733" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "78a4507bb9ffc9b00f11ae0ac48243d00cb9194d" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "1e1900b0769324a9675ef85b38f99cca29e203b3" },
|
||||
"nvim-dap": { "branch": "master", "commit": "6a5bba0ddea5d419a783e170c20988046376090d" },
|
||||
"nvim-dap-ui": { "branch": "master", "commit": "bc81f8d3440aede116f821114547a476b082b319" },
|
||||
"nvim-dap-virtual-text": { "branch": "master", "commit": "df66808cd78b5a97576bbaeee95ed5ca385a9750" },
|
||||
"nvim-highlight-colors": { "branch": "main", "commit": "63a0319d0933157e4fac72c992678785f7e7fa0c" },
|
||||
"nvim-lsp-endhints": { "branch": "main", "commit": "f3d81fad885215a282128fd376c125b2a455fa72" },
|
||||
"nvim-dap-virtual-text": { "branch": "master", "commit": "fbdb48c2ed45f4a8293d0d483f7730d24467ccb6" },
|
||||
"nvim-highlight-colors": { "branch": "main", "commit": "b42a5ccec7457b44e89f7ed3b3afb1b375bb2093" },
|
||||
"nvim-lsp-endhints": { "branch": "main", "commit": "7917c7af1ec345ca9b33e8dbcd3723fc15d023c0" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "185b2af444b27d6541c02d662b5b68190e5cf0c4" },
|
||||
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
|
||||
"nvim-notify": { "branch": "master", "commit": "a3020c2cf4dfc4c4f390c4a21e84e35e46cf5d17" },
|
||||
"nvim-spider": { "branch": "main", "commit": "4bd3221d165da334e57c8e9f38978e0c6f3a1742" },
|
||||
"nvim-spider": { "branch": "main", "commit": "d4bdc45eac425e77108f068bd0706ff3ac20be7f" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "f8aaf5ce4e27cd20de917946b2ae5c968a2c2858" },
|
||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "9937e5e356e5b227ec56d83d0a9d0a0f6bc9cad4" },
|
||||
"nvim-ts-autotag": { "branch": "main", "commit": "1cca23c9da708047922d3895a71032bc0449c52d" },
|
||||
"nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" },
|
||||
"nvim-ufo": { "branch": "main", "commit": "a5390706f510d39951dd581f6d2a972741b3fa26" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
|
||||
"promise-async": { "branch": "main", "commit": "38a4575da9497326badd3995e768b4ccf0bb153e" },
|
||||
"rainbow-delimiters.nvim": { "branch": "master", "commit": "de39919a57e1a40a4c7dc5bae0de276f9c616ef3" },
|
||||
"rainbow-delimiters.nvim": { "branch": "master", "commit": "55ad4fb76ab68460f700599b7449385f0c4e858e" },
|
||||
"resession.nvim": { "branch": "master", "commit": "cc819b0489938d03e4f3532a583354f0287c015b" },
|
||||
"smart-splits.nvim": { "branch": "master", "commit": "3311ae5dab72399b1f229183281528a2b28d470f" },
|
||||
"schemastore.nvim": { "branch": "main", "commit": "36fb914c0defa2274207e670182253508e5569d5" },
|
||||
"smart-splits.nvim": { "branch": "master", "commit": "ddb23c1a1cf1507bda487cda7f6e4690965ef9f5" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "a17d611a0e111836a1db5295f04945df407c5135" },
|
||||
"todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" },
|
||||
"transparent.nvim": { "branch": "main", "commit": "8a2749a2fa74f97fe6557f61b89ac7fd873f3c21" },
|
||||
"treesj": { "branch": "main", "commit": "f4049f8ba2177e7c5c03fb9e34d4e039c685d744" },
|
||||
"treesj": { "branch": "main", "commit": "3b4a2bc42738a63de17e7485d4cc5e49970ddbcc" },
|
||||
"trouble.nvim": { "branch": "main", "commit": "85bedb7eb7fa331a2ccbecb9202d8abba64d37b3" },
|
||||
"ultimate-autopair.nvim": { "branch": "v0.6", "commit": "b24b97c538b71b6de0ce9d84e47df27b6ecafd76" },
|
||||
"vim-illuminate": { "branch": "master", "commit": "b5713e6ca3f627b46968386d6d3f24d374d3cb17" },
|
||||
|
||||
@@ -1,33 +1,50 @@
|
||||
return {
|
||||
"okuuva/auto-save.nvim",
|
||||
cmd = "ASToggle", -- optional for lazy loading on command
|
||||
event = { "InsertLeave", "TextChanged" }, -- optional for lazy loading on trigger events
|
||||
lazy = true,
|
||||
event = { "User AstroFile", "InsertEnter" },
|
||||
dependencies = {
|
||||
"AstroNvim/astrocore",
|
||||
opts = {
|
||||
-- your config goes here
|
||||
-- or just leave it empty :)
|
||||
enabled = true, -- start auto-save when the plugin is loaded (i.e. when your package manager loads it)
|
||||
trigger_events = { -- See :h events
|
||||
immediate_save = { "BufLeave", "FocusLost" }, -- vim events that trigger an immediate save
|
||||
defer_save = {"TextChanged" }, -- vim events that trigger a deferred save (saves after `debounce_delay`)
|
||||
cancel_deferred_save = { "InsertEnter" }, -- vim events that cancel a pending deferred save
|
||||
},
|
||||
-- function that takes the buffer handle and determines whether to save the current buffer or not
|
||||
-- return true: if buffer is ok to be saved
|
||||
-- return false: if it's not ok to be saved
|
||||
-- if set to `nil` then no specific condition is applied
|
||||
--
|
||||
condition = function(buf)
|
||||
-- Check if vim-visual-multi is active
|
||||
local visual_multi_active = vim.g.VM_is_active or false
|
||||
if visual_multi_active then return false end
|
||||
-- Additional conditions can be added here if needed
|
||||
return true
|
||||
end,
|
||||
autocmds = {
|
||||
autoformat_toggle = {
|
||||
-- Disable autoformat before saving
|
||||
{
|
||||
event = "User",
|
||||
desc = "Disable autoformat before saving",
|
||||
pattern = "AutoSaveWritePre",
|
||||
callback = function()
|
||||
-- Save global autoformat status
|
||||
vim.g.OLD_AUTOFORMAT = vim.g.autoformat
|
||||
vim.g.autoformat = false
|
||||
|
||||
write_all_buffers = false, -- write all buffers when the current one meets `condition`
|
||||
noautocmd = false, -- do not execute autocmds when saving
|
||||
lockmarks = false, -- lock marks when saving, see `:h lockmarks` for more details
|
||||
debounce_delay = 10000, -- delay after which a pending save is executed
|
||||
local old_autoformat_buffers = {}
|
||||
-- Disable all manually enabled buffers
|
||||
for _, bufnr in ipairs(vim.api.nvim_list_bufs()) do
|
||||
if vim.b[bufnr].autoformat then
|
||||
table.insert(old_autoformat_buffers, bufnr)
|
||||
vim.b[bufnr].autoformat = false
|
||||
end
|
||||
end
|
||||
|
||||
vim.g.OLD_AUTOFORMAT_BUFFERS = old_autoformat_buffers
|
||||
end,
|
||||
},
|
||||
-- Re-enable autoformat after saving
|
||||
{
|
||||
event = "User",
|
||||
desc = "Re-enable autoformat after saving",
|
||||
pattern = "AutoSaveWritePost",
|
||||
callback = function()
|
||||
-- Restore global autoformat status
|
||||
vim.g.autoformat = vim.g.OLD_AUTOFORMAT
|
||||
-- Re-enable all manually enabled buffers
|
||||
for _, bufnr in ipairs(vim.g.OLD_AUTOFORMAT_BUFFERS or {}) do
|
||||
vim.b[bufnr].autoformat = true
|
||||
end
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
opts = {},
|
||||
}
|
||||
|
||||
@@ -93,9 +93,12 @@ return {
|
||||
-- Esc to close completion menu
|
||||
["<Esc>"] = cmp.mapping { i = cmp.mapping.abort(), c = cmp.mapping.close() },
|
||||
|
||||
|
||||
-- Tab to select completion
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() and has_words_before() then
|
||||
|
||||
vim.g.copilot_no_tab_map = true -- NOTE: disable copilot's tab mapping PART1
|
||||
fallback()
|
||||
else
|
||||
fallback()
|
||||
@@ -118,8 +121,9 @@ return {
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
|
||||
-- NOTE: disable tabl when using copilot PART2
|
||||
vim.api.nvim_set_keymap("i", "<C-f>", 'copilot#Accept("\\<CR>")', { expr = true, silent = true }),
|
||||
-- vim.g.copilot_no_tab_map = true,
|
||||
vim.keymap.del("i", "<Tab>"),
|
||||
-- ["<C-f>"] = cmp.mapping(function(fallback)
|
||||
-- -- Check if Copilot is suggesting something
|
||||
-- if vim.fn["copilot#Accept"]() ~= "" then
|
||||
@@ -130,6 +134,7 @@ return {
|
||||
},
|
||||
experimental = {
|
||||
ghost_text = false, -- this feature conflict with copilot.vim's preview.
|
||||
|
||||
},
|
||||
})
|
||||
end,
|
||||
|
||||
@@ -23,8 +23,7 @@ return {
|
||||
{ "CRAG666/code_runner.nvim", enabled = false },
|
||||
{ "RRethy/vim-illuminate", enabled = false },
|
||||
{ "OXY2DEV/markview.nvim", enabled = false },
|
||||
|
||||
-- { "kevinhwang91/nvim-ufo", enabled = false },
|
||||
{ "kevinhwang91/nvim-ufo", enabled = false },
|
||||
|
||||
-- interface
|
||||
-- { "HiPhish/rainbow-delimiters.nvim", enabled = true },
|
||||
|
||||
Reference in New Issue
Block a user