Compare commits
12 Commits
e3394bb65c
...
copilot-lu
| Author | SHA1 | Date | |
|---|---|---|---|
|
6bc0b1a0da
|
|||
|
f34ddbac36
|
|||
|
b3495ef161
|
|||
|
e7aaee0dd6
|
|||
|
513f2e3e20
|
|||
|
ad93476190
|
|||
|
620dd92101
|
|||
|
0904b788b1
|
|||
|
cdf15743c3
|
|||
|
29eb480ac0
|
|||
|
3148fa47c2
|
|||
|
67b668bf60
|
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
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ vim.o.mouse = ""
|
|||||||
vim.o.mousescroll = "ver:0,hor:0"
|
vim.o.mousescroll = "ver:0,hor:0"
|
||||||
vim.o.writebackup = false
|
vim.o.writebackup = false
|
||||||
vim.o.undofile = true
|
vim.o.undofile = true
|
||||||
|
vim.o.updatetime = 250
|
||||||
|
vim.o.timeout = true
|
||||||
|
vim.o.timeoutlen = 300
|
||||||
|
|
||||||
-- ui
|
-- ui
|
||||||
vim.o.breakindent = true
|
vim.o.breakindent = true
|
||||||
@@ -32,6 +35,15 @@ vim.o.expandtab = true
|
|||||||
vim.o.ignorecase = true
|
vim.o.ignorecase = true
|
||||||
vim.o.smartcase = true
|
vim.o.smartcase = true
|
||||||
|
|
||||||
|
-- diagnostic show virtual text
|
||||||
|
vim.diagnostic.config({ virtual_text = true })
|
||||||
|
local function swap_diagnostic()
|
||||||
|
local virtext = vim.diagnostic.config().virtual_text
|
||||||
|
local virlines = vim.diagnostic.config().virtual_lines
|
||||||
|
vim.diagnostic.config({ virtual_text = not virtext, virtual_lines = not virlines })
|
||||||
|
end
|
||||||
|
vim.keymap.set("n", "<leader>dt", swap_diagnostic)
|
||||||
|
|
||||||
-- osc52 escape codes copy
|
-- osc52 escape codes copy
|
||||||
local function ocs52_paste_fail()
|
local function ocs52_paste_fail()
|
||||||
vim.notify("can't paste via osc52", vim.log.levels.WARN)
|
vim.notify("can't paste via osc52", vim.log.levels.WARN)
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ MiniDeps.now(function()
|
|||||||
vim.g.gruvbox_material_background = "light"
|
vim.g.gruvbox_material_background = "light"
|
||||||
vim.g.gruvbox_material_better_performance = 1
|
vim.g.gruvbox_material_better_performance = 1
|
||||||
vim.g.gruvbox_material_diagnostic_line_highlight = 1
|
vim.g.gruvbox_material_diagnostic_line_highlight = 1
|
||||||
|
vim.g.gruvbox_material_diagnostic_text_highlight = 1
|
||||||
vim.g.gruvbox_material_diagnostic_virtual_text = "colored"
|
vim.g.gruvbox_material_diagnostic_virtual_text = "colored"
|
||||||
vim.g.gruvbox_material_enable_bold = 1
|
vim.g.gruvbox_material_enable_bold = 1
|
||||||
vim.g.gruvbox_material_enable_italic = 1
|
vim.g.gruvbox_material_enable_italic = 1
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -58,6 +58,36 @@ MiniDeps.later(function()
|
|||||||
"format"
|
"format"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
local tD_dH = vim.lsp.protocol.Methods.textDocument_documentHighlight
|
||||||
|
if client and client:supports_method(tD_dH) then
|
||||||
|
local ag = vim.api.nvim_create_augroup
|
||||||
|
local ac = vim.api.nvim_create_autocmd
|
||||||
|
local g = ag("custom-lsp-tD_dH-highlight", { clear = false })
|
||||||
|
|
||||||
|
ac({ "CursorHold", "CursorHoldI" }, {
|
||||||
|
buffer = bufnr,
|
||||||
|
group = g,
|
||||||
|
callback = vim.lsp.buf.document_highlight,
|
||||||
|
})
|
||||||
|
|
||||||
|
ac({ "CursorMoved", "CursorMovedI" }, {
|
||||||
|
buffer = bufnr,
|
||||||
|
group = g,
|
||||||
|
callback = vim.lsp.buf.clear_references,
|
||||||
|
})
|
||||||
|
|
||||||
|
ac("LspDetach", {
|
||||||
|
group = ag("custom-lsp-detach", { clear = true }),
|
||||||
|
callback = function(e)
|
||||||
|
vim.lsp.buf.clear_references()
|
||||||
|
vim.api.nvim_clear_autocmds({
|
||||||
|
group = "custom-lsp-tD_dH-highlight",
|
||||||
|
buffer = e.buf,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
-- inlay hints
|
-- inlay hints
|
||||||
if client and client.server_capabilities.inlayHintProvider then
|
if client and client.server_capabilities.inlayHintProvider then
|
||||||
vim.lsp.inlay_hint.enable(true, { bufnr = bufnr })
|
vim.lsp.inlay_hint.enable(true, { bufnr = bufnr })
|
||||||
|
|||||||
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)
|
||||||
@@ -1,10 +1,24 @@
|
|||||||
MiniDeps.later(
|
MiniDeps.later(function()
|
||||||
function()
|
require("mini.indentscope").setup({
|
||||||
require("mini.indentscope").setup({
|
draw = {
|
||||||
draw = {
|
delay = 0,
|
||||||
delay = 0,
|
animation = require("mini.indentscope").gen_animation.none(),
|
||||||
animation = require("mini.indentscope").gen_animation.none(),
|
},
|
||||||
},
|
})
|
||||||
})
|
|
||||||
|
local disable = {
|
||||||
|
"fzf",
|
||||||
|
"fzflua_backdrop",
|
||||||
|
"qf",
|
||||||
|
}
|
||||||
|
|
||||||
|
local function term_disable(args) vim.b[args.buf].miniindentscope_disable = true end
|
||||||
|
local function ft_disable(args)
|
||||||
|
local ft = vim.bo[args.buf].filetype
|
||||||
|
if not vim.tbl_contains(disable, ft) then return end
|
||||||
|
vim.b[args.buf].miniindentscope_disable = true
|
||||||
end
|
end
|
||||||
)
|
|
||||||
|
vim.api.nvim_create_autocmd("TermOpen", { callback = term_disable })
|
||||||
|
vim.api.nvim_create_autocmd("Filetype", { callback = ft_disable })
|
||||||
|
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