Compare commits
1 Commits
copilot-lu
...
eb17aca1fc
| Author | SHA1 | Date | |
|---|---|---|---|
|
eb17aca1fc
|
2
LICENSE
2
LICENSE
@@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2025 Matej Janežič
|
Copyright (c) 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,37 +1,9 @@
|
|||||||
MiniDeps.later(function()
|
local now_if_args = vim.fn.argc(-1) > 0 and MiniDeps.now or MiniDeps.later
|
||||||
MiniDeps.add("zbirenbaum/copilot.lua")
|
|
||||||
-- TODO:(@janezicmatej) setup lsp nes
|
|
||||||
-- MiniDeps.add("copilotlsp-nvim/copilot-lsp")
|
|
||||||
|
|
||||||
local function no_attach_for_env()
|
now_if_args(function()
|
||||||
if string.match(vim.fs.basename(vim.api.nvim_buf_get_name(0)), "^%.env.*") then
|
MiniDeps.add("github/copilot.vim")
|
||||||
return false
|
|
||||||
end
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
local opts = {
|
vim.g.copilot_filetypes = {
|
||||||
panel = {
|
|
||||||
keymap = {
|
|
||||||
jump_prev = false,
|
|
||||||
jump_next = false,
|
|
||||||
accept = false,
|
|
||||||
refresh = false,
|
|
||||||
open = false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
suggestion = {
|
|
||||||
-- auto_trigger = true,
|
|
||||||
keymap = {
|
|
||||||
accept = false,
|
|
||||||
accept_word = false,
|
|
||||||
accept_line = false,
|
|
||||||
next = false,
|
|
||||||
prev = false,
|
|
||||||
dismiss = false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
filetypes = {
|
|
||||||
-- disable all and only allow specific filetyps
|
-- disable all and only allow specific filetyps
|
||||||
["*"] = false,
|
["*"] = false,
|
||||||
--
|
--
|
||||||
@@ -44,36 +16,7 @@ MiniDeps.later(function()
|
|||||||
nix = true,
|
nix = true,
|
||||||
python = true,
|
python = true,
|
||||||
rust = true,
|
rust = true,
|
||||||
sh = no_attach_for_env,
|
sh = true,
|
||||||
bash = no_attach_for_env,
|
|
||||||
typescript = true,
|
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)
|
||||||
|
|||||||
11
lua/plugins/git_blame.lua
Normal file
11
lua/plugins/git_blame.lua
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
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,12 +9,4 @@ 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)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ MiniDeps.later(function()
|
|||||||
MiniDeps.add("neovim/nvim-lspconfig")
|
MiniDeps.add("neovim/nvim-lspconfig")
|
||||||
|
|
||||||
vim.lsp.enable({
|
vim.lsp.enable({
|
||||||
"pyright",
|
"basedpyright",
|
||||||
"ts_ls",
|
"ts_ls",
|
||||||
"rust_analyzer",
|
"rust_analyzer",
|
||||||
"clangd",
|
"clangd",
|
||||||
@@ -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 })
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
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,10 +12,15 @@ 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 not vim.tbl_contains(disable, ft) then return end
|
if disable_set[ft] == nil then return end
|
||||||
vim.b[args.buf].miniindentscope_disable = true
|
vim.b[args.buf].miniindentscope_disable = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ 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,6 +1,7 @@
|
|||||||
return {
|
return {
|
||||||
["copilot.lua"] = "3123983d00ae6859f8bc987d14ebb524bb41b618",
|
["copilot.vim"] = "da369d90cfd6c396b1d0ec259836a1c7222fb2ea",
|
||||||
["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