Compare commits
8 Commits
cdf15743c3
...
copilot-lu
| Author | SHA1 | Date | |
|---|---|---|---|
|
6bc0b1a0da
|
|||
|
f34ddbac36
|
|||
|
b3495ef161
|
|||
|
e7aaee0dd6
|
|||
|
513f2e3e20
|
|||
|
ad93476190
|
|||
|
620dd92101
|
|||
|
0904b788b1
|
2
LICENSE
2
LICENSE
@@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) Matej Janežič
|
Copyright (c) 2025 Matej Janežič
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
@@ -1,22 +1,79 @@
|
|||||||
local now_if_args = vim.fn.argc(-1) > 0 and MiniDeps.now or MiniDeps.later
|
MiniDeps.later(function()
|
||||||
|
MiniDeps.add("zbirenbaum/copilot.lua")
|
||||||
|
-- TODO:(@janezicmatej) setup lsp nes
|
||||||
|
-- MiniDeps.add("copilotlsp-nvim/copilot-lsp")
|
||||||
|
|
||||||
now_if_args(function()
|
local function no_attach_for_env()
|
||||||
MiniDeps.add("github/copilot.vim")
|
if string.match(vim.fs.basename(vim.api.nvim_buf_get_name(0)), "^%.env.*") then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
vim.g.copilot_filetypes = {
|
local opts = {
|
||||||
-- disable all and only allow specific filetyps
|
panel = {
|
||||||
["*"] = false,
|
keymap = {
|
||||||
--
|
jump_prev = false,
|
||||||
c = true,
|
jump_next = false,
|
||||||
cpp = true,
|
accept = false,
|
||||||
dockerfile = true,
|
refresh = false,
|
||||||
go = true,
|
open = false,
|
||||||
javascript = true,
|
},
|
||||||
lua = true,
|
},
|
||||||
nix = true,
|
suggestion = {
|
||||||
python = true,
|
-- auto_trigger = true,
|
||||||
rust = true,
|
keymap = {
|
||||||
sh = true,
|
accept = false,
|
||||||
typescript = true,
|
accept_word = false,
|
||||||
|
accept_line = false,
|
||||||
|
next = false,
|
||||||
|
prev = false,
|
||||||
|
dismiss = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
filetypes = {
|
||||||
|
-- disable all and only allow specific filetyps
|
||||||
|
["*"] = false,
|
||||||
|
--
|
||||||
|
c = true,
|
||||||
|
cpp = true,
|
||||||
|
dockerfile = true,
|
||||||
|
go = true,
|
||||||
|
javascript = true,
|
||||||
|
lua = true,
|
||||||
|
nix = true,
|
||||||
|
python = true,
|
||||||
|
rust = true,
|
||||||
|
sh = no_attach_for_env,
|
||||||
|
bash = no_attach_for_env,
|
||||||
|
typescript = true,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
require("copilot").setup(opts)
|
||||||
|
|
||||||
|
local suggestion = require("copilot.suggestion")
|
||||||
|
|
||||||
|
local function accept_if_visible()
|
||||||
|
vim.notify("is visible " .. (suggestion.is_visible() or "nil"))
|
||||||
|
if suggestion.is_visible() ~= nil then
|
||||||
|
suggestion.accept()
|
||||||
|
else
|
||||||
|
return "<Tab>"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function close_pum_if_open(func)
|
||||||
|
return function()
|
||||||
|
if vim.fn.pumvisible() == 1 then vim.fn.complete(vim.fn.col("."), {}) end
|
||||||
|
return func()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- stylua: ignore start
|
||||||
|
vim.keymap.set({ "i" }, "<Tab>", accept_if_visible, { desc = "copilot: accept suggestion", expr = true })
|
||||||
|
vim.keymap.set({ "n", "i" }, "<M-j>", suggestion.accept_line, { desc = "copilot: accept line" })
|
||||||
|
|
||||||
|
vim.keymap.set({ "n", "i" }, "<M-l>", close_pum_if_open(suggestion.next), { desc = "copilot: next suggestion" })
|
||||||
|
vim.keymap.set({ "n", "i" }, "<M-h>", close_pum_if_open(suggestion.prev), { desc = "copilot: previous suggestion" })
|
||||||
|
-- stylua: ignore start
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
MiniDeps.later(function()
|
|
||||||
MiniDeps.add("f-person/git-blame.nvim")
|
|
||||||
require("gitblame").setup({
|
|
||||||
enabled = false,
|
|
||||||
message_template = " <sha>: <author> <date> <summary>",
|
|
||||||
date_format = "%Y-%m-%d",
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>gt", ":GitBlameToggle<CR>")
|
|
||||||
vim.keymap.set("n", "<leader>gs", ":GitBlameCopySHA<CR>")
|
|
||||||
end)
|
|
||||||
@@ -9,4 +9,12 @@ MiniDeps.later(function()
|
|||||||
changedelete = { text = "~" },
|
changedelete = { text = "~" },
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- blame
|
||||||
|
vim.keymap.set({"n", "v"}, "<leader>gb", ":Gitsigns blame<CR>")
|
||||||
|
vim.keymap.set({"n", "v"}, "<leader>gt", ":Gitsigns blame_line<CR>")
|
||||||
|
|
||||||
|
-- hunks
|
||||||
|
vim.keymap.set({"n", "v"}, "<leader>ga", ":Gitsigns stage_hunk<CR>")
|
||||||
|
vim.keymap.set({"n", "v"}, "<leader>gr", ":Gitsigns reset_hunk<CR>")
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ MiniDeps.later(function()
|
|||||||
)
|
)
|
||||||
|
|
||||||
local tD_dH = vim.lsp.protocol.Methods.textDocument_documentHighlight
|
local tD_dH = vim.lsp.protocol.Methods.textDocument_documentHighlight
|
||||||
if client and client.supports_method(tD_dH) then
|
if client and client:supports_method(tD_dH) then
|
||||||
local ag = vim.api.nvim_create_augroup
|
local ag = vim.api.nvim_create_augroup
|
||||||
local ac = vim.api.nvim_create_autocmd
|
local ac = vim.api.nvim_create_autocmd
|
||||||
local g = ag("custom-lsp-tD_dH-highlight", { clear = false })
|
local g = ag("custom-lsp-tD_dH-highlight", { clear = false })
|
||||||
|
|||||||
12
lua/plugins/mini_cursorword.lua
Normal file
12
lua/plugins/mini_cursorword.lua
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
MiniDeps.later(function()
|
||||||
|
require("mini.cursorword").setup()
|
||||||
|
|
||||||
|
local function disable(args)
|
||||||
|
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||||
|
local tD_dH = vim.lsp.protocol.Methods.textDocument_documentHighlight
|
||||||
|
if client and not client:supports_method(tD_dH) then return end
|
||||||
|
vim.b[args.buf].minicursorword_disable = true
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("LspAttach", { callback = disable })
|
||||||
|
end)
|
||||||
@@ -12,15 +12,10 @@ MiniDeps.later(function()
|
|||||||
"qf",
|
"qf",
|
||||||
}
|
}
|
||||||
|
|
||||||
local disable_set = {}
|
|
||||||
for _, v in ipairs(disable) do
|
|
||||||
disable_set[v] = true
|
|
||||||
end
|
|
||||||
|
|
||||||
local function term_disable(args) vim.b[args.buf].miniindentscope_disable = true end
|
local function term_disable(args) vim.b[args.buf].miniindentscope_disable = true end
|
||||||
local function ft_disable(args)
|
local function ft_disable(args)
|
||||||
local ft = vim.bo[args.buf].filetype
|
local ft = vim.bo[args.buf].filetype
|
||||||
if disable_set[ft] == nil then return end
|
if not vim.tbl_contains(disable, ft) then return end
|
||||||
vim.b[args.buf].miniindentscope_disable = true
|
vim.b[args.buf].miniindentscope_disable = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ MiniDeps.now(function()
|
|||||||
{ name = "update dependencies", action = "DepsUpdate", section = "dependencies" },
|
{ name = "update dependencies", action = "DepsUpdate", section = "dependencies" },
|
||||||
{ name = "snap dependencies", action = "DepsSnapSave", section = "dependencies" },
|
{ name = "snap dependencies", action = "DepsSnapSave", section = "dependencies" },
|
||||||
{ name = "load dependencies", action = "DepsSnapLoad", section = "dependencies" },
|
{ name = "load dependencies", action = "DepsSnapLoad", section = "dependencies" },
|
||||||
|
{ name = "clean dependencies", action = "DepsClean", section = "dependencies" },
|
||||||
-- debug
|
-- debug
|
||||||
{ name = "reinstall treesitter parsers", action = reinstall_treesitter, section = "debug" },
|
{ name = "reinstall treesitter parsers", action = reinstall_treesitter, section = "debug" },
|
||||||
--stylua: ignore end
|
--stylua: ignore end
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
return {
|
return {
|
||||||
["copilot.vim"] = "da369d90cfd6c396b1d0ec259836a1c7222fb2ea",
|
["copilot.lua"] = "3123983d00ae6859f8bc987d14ebb524bb41b618",
|
||||||
["fzf-lua"] = "db3ccffe79480543d8e0f7b0cac0d9b220f9486e",
|
["fzf-lua"] = "db3ccffe79480543d8e0f7b0cac0d9b220f9486e",
|
||||||
["git-blame.nvim"] = "54da04264ec5313d602aebea7c5dc90141696ad7",
|
|
||||||
["gitlinker.nvim"] = "cc59f732f3d043b626c8702cb725c82e54d35c25",
|
["gitlinker.nvim"] = "cc59f732f3d043b626c8702cb725c82e54d35c25",
|
||||||
["gitsigns.nvim"] = "1ee5c1fd068c81f9dd06483e639c2aa4587dc197",
|
["gitsigns.nvim"] = "1ee5c1fd068c81f9dd06483e639c2aa4587dc197",
|
||||||
["gruvbox-material"] = "834dbf21836862300ced7444db4262b796330ab7",
|
["gruvbox-material"] = "834dbf21836862300ced7444db4262b796330ab7",
|
||||||
|
|||||||
Reference in New Issue
Block a user