Skip to content

Commit 89a0c1b

Browse files
committed
Fixed mason and copilot chat, implement mutliopen_vertical split in telescope
1 parent 595af86 commit 89a0c1b

5 files changed

Lines changed: 49 additions & 25 deletions

File tree

after/plugin/copilotchat.lua

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ local chat = require('CopilotChat')
22
local keymap = vim.keymap
33

44
chat.setup({
5-
model = 'gpt-4o',
5+
-- model = 'gpt-4o',
66
auto_insert_mode = true,
77
prompts = {
88
Tests = {
@@ -15,23 +15,23 @@ chat.setup({
1515
'/COPILOT_GENERATE Write commit message for the change with commitizen convention. Keep the title under 50 characters and wrap message at 72 characters. Format as a gitcommit code block. Write commit message using commitizen convention. Commit message must match pattern: "^([A-Z]+-[0-9]{1,4}): ([A-Za-z]+) .{3,}(?:\n\n?.*)*$", where part until ":" sign is called prefix and after the sign postfix. Extract prefix from the branch name if it is possible. Branch name can be in form: "^.*/<prefix>$". If it is not possible to extract the prefix, put "NOTICKET-000" as a prefix.',
1616
selection = require('CopilotChat.select').buffer
1717
}
18-
}
18+
},
1919
})
2020

2121
--- Keymaps
22-
keymap.set('n', '<leader>cco', chat.open, { desc = "[CopilotChat] Open Chat" })
23-
24-
keymap.set('n', "<leader>ccq",
25-
function()
26-
local input = vim.fn.input("Quick Chat: ")
27-
if input ~= "" then
28-
chat.ask(input, { selection = require("CopilotChat.select").buffer })
29-
end
30-
end,
31-
{ desc = "[CopilotChat] Quick chat" })
22+
keymap.set({ 'n', 'v' }, '<leader>cco', ':CopilotChatOpen<cr>', { desc = "[CopilotChat] Open Chat" })
3223

3324
keymap.set({ 'n', 'v' }, "<leader>ccp", function()
3425
local actions = require("CopilotChat.actions")
3526
require("CopilotChat.integrations.telescope").pick(actions.prompt_actions())
3627
end,
3728
{ desc = "[CopilotChat] Pick prompt" })
29+
30+
vim.api.nvim_create_autocmd('BufEnter', {
31+
pattern = 'copilot-*',
32+
callback = function()
33+
vim.opt_local.relativenumber = false
34+
vim.opt_local.number = false
35+
vim.opt_local.conceallevel = 0
36+
end,
37+
})

after/plugin/lsp.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ keymap.set('n', 'gi', '<cmd>Telescope lsp_implementations<cr>', { desc = '[T] Se
1616
keymap.set({ 'n', 'x' }, '<leader>la', vim.lsp.buf.code_action, { buffer = bufnr, desc = '[L] Code Action' })
1717
keymap.set('n', '<leader>lR', vim.lsp.buf.rename, { buffer = bufnr, desc = '[L] Rename' })
1818

19-
require('mason').setup({})
19+
require('mason').setup()
2020
require('mason-lspconfig').setup({
2121
ensure_installed = { 'basedpyright', 'bashls', 'dockerls', 'gopls', 'groovyls', 'helm_ls', 'jsonls', 'kotlin_language_server', 'lemminx', 'lua_ls', 'marksman', 'terraformls', 'tflint', 'yamlls', }
2222
})

after/plugin/telescope.lua

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
local builtin = require('telescope.builtin')
22
local telescope = require('telescope')
33
local actions = require('telescope.actions')
4+
local action_state = require("telescope.actions.state")
45
local keymap = vim.keymap
56

67

@@ -27,8 +28,28 @@ end
2728

2829
local open_with_trouble = require("trouble.sources.telescope").open
2930

31+
-- custom action to open multiple files in vertical splits
32+
local function multiopen_vertical(prompt_bufnr)
33+
local picker = action_state.get_current_picker(prompt_bufnr)
34+
local selections = picker:get_multi_selection()
35+
36+
actions.close(prompt_bufnr)
37+
38+
if #selections > 0 then
39+
-- open the first file normally
40+
vim.cmd("edit " .. selections[1].value)
41+
-- the rest in vertical splits
42+
for i = 2, #selections do
43+
vim.cmd("vsplit " .. selections[i].value)
44+
end
45+
else
46+
-- fallback: open current entry in vertical split
47+
actions.select_vertical(prompt_bufnr)
48+
end
49+
end
50+
3051
-- Use this to add more results without clearing the trouble list
31-
local add_to_trouble = require("trouble.sources.telescope").add
52+
-- local add_to_trouble = require("trouble.sources.telescope").add
3253

3354
telescope.setup {
3455
defaults = {
@@ -37,11 +58,13 @@ telescope.setup {
3758
['<CR>'] = select_one_or_multi,
3859
["<c-t>"] = open_with_trouble,
3960
-- ["<c-z>"] = add_to_trouble
61+
['<c-v>'] = multiopen_vertical,
4062
},
4163
n = {
4264
['<CR>'] = select_one_or_multi,
4365
["<c-t>"] = open_with_trouble,
4466
-- ["<c-z>"] = add_to_trouble
67+
['<c-v>'] = multiopen_vertical,
4568
},
4669
},
4770
},

lazy-lock.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
{
22
"Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
3-
"CopilotChat.nvim": { "branch": "main", "commit": "f5fd1a7ead5ccdd240fc3ef6e740fb49f74a1294" },
3+
"CopilotChat.nvim": { "branch": "main", "commit": "f7bb32dbbe2ff5e26f5033e2142b5920cf427236" },
44
"Jenkinsfile-vim-syntax": { "branch": "master", "commit": "0d05729168ea44d60862f17cffa80024ab30bcc9" },
55
"LuaSnip": { "branch": "master", "commit": "de10d8414235b0a8cabfeba60d07c24304e71f5c" },
6-
"auto-session": { "branch": "main", "commit": "2374591ad5187e6697d9b4a683027ad33771381f" },
7-
"catppuccin": { "branch": "main", "commit": "76a8d0515024cc55d8bd26fc13f1af88faef3ebf" },
8-
"cmp-nvim-lsp": { "branch": "main", "commit": "a8912b88ce488f411177fc8aed358b04dc246d7b" },
6+
"auto-session": { "branch": "main", "commit": "8cda7244a02f1304664889a78194604587ffc772" },
7+
"catppuccin": { "branch": "main", "commit": "30fa4d122d9b22ad8b2e0ab1b533c8c26c4dde86" },
8+
"cmp-nvim-lsp": { "branch": "main", "commit": "bd5a7d6db125d4654b50eeae9f5217f24bb22fd3" },
99
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
10-
"conform.nvim": { "branch": "master", "commit": "973f3cb73887d510321653044791d7937c7ec0fa" },
10+
"conform.nvim": { "branch": "master", "commit": "9ddab4e14c44196d393a72b958b4da6dab99ecef" },
1111
"copilot-cmp": { "branch": "master", "commit": "15fc12af3d0109fa76b60b5cffa1373697e261d1" },
12-
"copilot.lua": { "branch": "master", "commit": "0f2fd3829dd27d682e46c244cf48d9715726f612" },
12+
"copilot.lua": { "branch": "master", "commit": "0753a440b0eed13ff32366ef5e21c215012fd1d8" },
1313
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
1414
"dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" },
1515
"faster.nvim": { "branch": "main", "commit": "9fe4717d8c8c0a6aa306bd3b4f5fac5707eca334" },
1616
"indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" },
1717
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
1818
"lazydev.nvim": { "branch": "main", "commit": "2367a6c0a01eb9edb0464731cc0fb61ed9ab9d2c" },
19-
"lualine.nvim": { "branch": "master", "commit": "a94fc68960665e54408fe37dcf573193c4ce82c9" },
19+
"lualine.nvim": { "branch": "master", "commit": "b8c23159c0161f4b89196f74ee3a6d02cdc3a955" },
2020
"markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" },
21-
"mason-lspconfig.nvim": { "branch": "main", "commit": "7f0bf635082bb9b7d2b37766054526a6ccafdb85" },
21+
"mason-lspconfig.nvim": { "branch": "main", "commit": "1ec4da522fa49dcecee8d190efda273464dd2192" },
2222
"mason.nvim": { "branch": "main", "commit": "7dc4facca9702f95353d5a1f87daf23d78e31c2a" },
2323
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
2424
"nvim-autopairs": { "branch": "master", "commit": "23320e75953ac82e559c610bec5a90d9c6dfa743" },
2525
"nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" },
2626
"nvim-jenkinsfile-linter": { "branch": "main", "commit": "4bd761597348df2700dc456d870a1a5501448df2" },
27-
"nvim-lspconfig": { "branch": "master", "commit": "d6dc63670d3dc5204b1e874af4cbf340cb5d9d18" },
27+
"nvim-lspconfig": { "branch": "master", "commit": "ce45ccd6a97be8752ed83d1e14ac2aff1d5a4238" },
2828
"nvim-navbuddy": { "branch": "master", "commit": "a34786c77a528519f6b8a142db7609f6e387842d" },
2929
"nvim-navic": { "branch": "master", "commit": "f887d794a0f4594882814d7780980a949200a238" },
30-
"nvim-treesitter": { "branch": "main", "commit": "9866036ec3c5db40700a9178494e0cfdcfe6ecfd" },
30+
"nvim-treesitter": { "branch": "main", "commit": "6fd7117c1dc4e279f4153af70ae60bd4134b0f01" },
3131
"nvim-web-devicons": { "branch": "master", "commit": "c2599a81ecabaae07c49ff9b45dcd032a8d90f1a" },
32-
"oil.nvim": { "branch": "master", "commit": "bbad9a76b2617ce1221d49619e4e4b659b3c61fc" },
32+
"oil.nvim": { "branch": "master", "commit": "07f80ad645895af849a597d1cac897059d89b686" },
3333
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
3434
"suda.vim": { "branch": "master", "commit": "9adda7d195222d4e2854efb2a88005a120296c47" },
3535
"telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" },

lua/lsp/yamlls.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
vim.lsp.config('yamlls', {
2+
filetypes = { 'yaml', 'yaml.ansible', 'yaml.docker-compose' },
23
settings = {
34
yaml = {
45
schemas = {

0 commit comments

Comments
 (0)