Basic setup

This commit is contained in:
Karolis Arbaciauskas 2024-11-03 00:27:08 +02:00
parent 2ba39c6973
commit 0185a988a2
No known key found for this signature in database
15 changed files with 412 additions and 38 deletions

View file

@ -0,0 +1,31 @@
return {
{
'goolord/alpha-nvim',
event = 'VimEnter',
enabled = true,
init = false,
dependencies = {
'echasnovski/mini.icons',
'nvim-lua/plenary.nvim',
},
config = function()
local alpha = require 'alpha'
local dashboard = require 'alpha.themes.dashboard'
dashboard.section.buttons.val = {
dashboard.button('e', ' New file', '<cmd>ene <CR>'),
dashboard.button('f', '󰈞 Find file', '<cmd>Telescope find_files<cr>'),
dashboard.button('h', '󰊄 Recently opened files', '<cmd>Telescope oldfiles<cr>'),
-- dashboard.button('SPC f r', ' Frecency/MRU'),
dashboard.button('g', '󰈬 Find word', '<cmd>Telescope live_grep<cr>'),
-- dashboard.button('<leader> fm', ' Jump to bookmarks'),
dashboard.button('s', ' Open last session', '<cmd> lua require("persistence").load() <cr>'),
dashboard.button('sl', ' Select Session', '<cmd> lua require("persistence").select() <cr>'),
dashboard.button('u', ' Update plugins', '<cmd>Lazy sync<CR>'),
dashboard.button('c', ' Configuration', "<cmd>lua require('telescope.builtin').find_files { cwd = vim.fn.stdpath 'config' } <cr>"),
dashboard.button('q', '󰅚 Quit', '<cmd>qa<CR>'),
}
alpha.setup(dashboard.config)
end,
},
}

View file

@ -0,0 +1,52 @@
local on_attach = function(on_attach, name)
return vim.api.nvim_create_autocmd('LspAttach', {
callback = function(args)
local buffer = args.buf ---@type number
local client = vim.lsp.get_client_by_id(args.data.client_id)
if client and (not name or client.name == name) then
return on_attach(client, buffer)
end
end,
})
end
return {
{
'zbirenbaum/copilot.lua',
cmd = 'Copilot',
-- new
-- event = 'InsertEnter',
build = ':Copilot auth',
opts = {
suggestion = { enabled = false },
panel = { enabled = false },
filetypes = {
markdown = true,
help = true,
},
},
},
{
'zbirenbaum/copilot-cmp',
dependencies = 'copilot.lua',
opts = {},
config = function(_, opts)
local copilot_cmp = require 'copilot_cmp'
copilot_cmp.setup(opts)
on_attach(function(client)
copilot_cmp._on_insert_enter {}
end, 'copilot')
end,
},
{
'olimorris/codecompanion.nvim',
dependencies = {
'nvim-lua/plenary.nvim',
'nvim-treesitter/nvim-treesitter',
'hrsh7th/nvim-cmp', -- Optional: For using slash commands and variables in the chat buffer
'nvim-telescope/telescope.nvim', -- Optional: For using slash commands
{ 'stevearc/dressing.nvim', opts = {} }, -- Optional: Improves `vim.ui.select`
},
config = true,
},
}

View file

@ -0,0 +1,51 @@
return {
{
'CopilotC-Nvim/CopilotChat.nvim',
branch = 'canary',
dependencies = {
{ 'zbirenbaum/copilot.lua' }, -- or github/copilot.vim
{ 'nvim-lua/plenary.nvim' }, -- for curl, log wrapper
},
build = 'make tiktoken', -- Only on MacOS or Linux
opts = {
debug = true, -- Enable debugging
context = 'buffer',
},
keys = {
{
'<leader>aa',
function()
local chat = require 'CopilotChat'
chat.toggle()
end,
desc = 'Copilot toggle chat',
},
{
'<leader>aq',
function()
local input = vim.fn.input 'Quick Chat: '
if input ~= '' then
require('CopilotChat').ask(input, { selection = require('CopilotChat.select').buffer })
end
end,
desc = 'Copilot quick chat',
},
{
'<leader>ax',
function()
local chat = require 'CopilotChat'
chat.reset()
end,
desc = 'Copilot chat reset',
},
{
'<leader>ap',
function()
local actions = require 'CopilotChat.actions'
require('CopilotChat.integrations.telescope').pick(actions.prompt_actions())
end,
desc = 'Copilot chat prompt actions',
},
},
},
}

64
lua/custom/plugins/go.lua Normal file
View file

@ -0,0 +1,64 @@
local on_attach = function(client, bufnr)
if not client.server_capabilities.semanticTokensProvider then
local semantic = client.config.capabilities.textDocument.semanticTokens
client.server_capabilities.semanticTokensProvider = {
full = true,
legend = {
tokenTypes = semantic.tokenTypes,
tokenModifiers = semantic.tokenModifiers,
},
range = true,
}
end
end
require('lspconfig').gopls.setup {
on_attach = on_attach,
}
return {
{
'leoluz/nvim-dap-go',
opts = {},
},
{
'fredrikaverpil/neotest-golang',
},
{
'echasnovski/mini.icons',
opts = {
file = {
['.go-version'] = { glyph = '', hl = 'MiniIconsBlue' },
},
filetype = {
gotmpl = { glyph = '󰟓', hl = 'MiniIconsGrey' },
},
},
},
{
'mfussenegger/nvim-dap',
optional = true,
dependencies = {
{
'leoluz/nvim-dap-go',
opts = {},
},
},
},
{
'nvim-neotest/neotest',
optional = true,
dependencies = {
'fredrikaverpil/neotest-golang',
},
opts = {
adapters = {
['neotest-golang'] = {
-- Here we can set options for neotest-golang, e.g.
-- go_test_args = { "-v", "-race", "-count=1", "-timeout=60s" },
dap_go_enabled = true, -- requires leoluz/nvim-dap-go
},
},
},
},
}

View file

@ -0,0 +1,22 @@
return {
'MagicDuck/grug-far.nvim',
opts = { headerMaxWidth = 80 },
cmd = 'GrugFar',
keys = {
{
'<leader>sR',
function()
local grug = require 'grug-far'
local ext = vim.bo.buftype == '' and vim.fn.expand '%:e'
grug.open {
transient = true,
prefills = {
filesFilter = ext and ext ~= '' and '*.' .. ext or nil,
},
}
end,
mode = { 'n', 'v' },
desc = 'Search and Replace',
},
},
}

View file

@ -2,4 +2,11 @@
-- I promise not to create any merge conflicts in this directory :)
--
-- See the kickstart.nvim README for more information
vim.api.nvim_create_autocmd({ 'FocusGained', 'BufEnter' }, { command = 'checktime' })
vim.keymap.set('n', '<A-h>', '<C-w>5<', { desc = 'Decrease window width' })
vim.keymap.set('n', '<A-l>', '<C-w>5>', { desc = 'Increase window width' })
vim.keymap.set('n', '<A-j>', '<C-w>1+', { desc = 'Increase window height' })
vim.keymap.set('n', '<A-k>', '<C-w>1-', { desc = 'Decrease window height' })
return {}

View file

@ -0,0 +1,21 @@
return {
'kdheepak/lazygit.nvim',
lazy = true,
cmd = {
'LazyGit',
'LazyGitConfig',
'LazyGitCurrentFile',
'LazyGitFilter',
'LazyGitFilterCurrentFile',
},
dependencies = {
'nvim-lua/plenary.nvim',
},
keys = {
{ '<leader>gg', '<cmd>LazyGit<cr>', desc = 'Lazygit (Root Dir)' },
{ '<leader>gf', '<cmd>LazyGitFilterCurrentFile<cr>', desc = 'Lazygit Current File History' },
{ '<leader>gl', '<cmd>LazyGitFilter<cr>', desc = 'Lazygit log' },
{ '<leader>gb', '<cmd>Gitsigns blame<cr>', desc = 'Git blame' },
{ '<leader>gs', '<cmd>Telescope git_status<CR>', desc = 'Git Status' },
},
}

View file

@ -0,0 +1,5 @@
return {
'chentoast/marks.nvim',
event = 'VeryLazy',
opts = {},
}

View file

@ -0,0 +1,22 @@
return {
'stevearc/oil.nvim',
---@module 'oil'
---@type oil.SetupOpts
opts = {},
dependencies = {
{ 'echasnovski/mini.icons', opts = {} },
{ 'nvim-tree/nvim-web-devicons', opts = {} },
},
config = function()
require('oil').setup {
keymaps = {
['<Esc>'] = 'actions.close',
['<C-h>'] = false,
},
}
end,
keys = {
-- { '=', '<cmd>Oil<cr>', mode = 'n', desc = 'Open Filesystem' },
{ '-', '<cmd>Oil --float<cr>', mode = 'n', desc = 'Open Floating Filesystem' },
},
}

View file

@ -0,0 +1,7 @@
return {
{
'folke/persistence.nvim',
event = 'BufReadPre',
opts = {},
},
}

View file

@ -0,0 +1,17 @@
return {
'christoomey/vim-tmux-navigator',
cmd = {
'TmuxNavigateLeft',
'TmuxNavigateDown',
'TmuxNavigateUp',
'TmuxNavigateRight',
'TmuxNavigatePrevious',
},
keys = {
{ '<c-h>', '<cmd><C-U>TmuxNavigateLeft<cr>' },
{ '<c-j>', '<cmd><C-U>TmuxNavigateDown<cr>' },
{ '<c-k>', '<cmd><C-U>TmuxNavigateUp<cr>' },
{ '<c-l>', '<cmd><C-U>TmuxNavigateRight<cr>' },
{ '<c-\\>', '<cmd><C-U>TmuxNavigatePrevious<cr>' },
},
}

View file

@ -0,0 +1,14 @@
return {
'vim-test/vim-test',
dependencies = {
'preservim/vimux',
},
setup = {
vim.cmd 'let test#strategy = "vimux"',
},
keys = {
{ '<leader>tt', '<cmd>TestFile<CR>', { desc = 'Test file' } },
{ '<leader>tn', '<cmd>TestNearest<CR>', { desc = 'Test nearest' } },
{ '<leader>tl', '<cmd>TestLast<CR>', { desc = 'Test last' } },
},
}