re-organised config

This commit is contained in:
Fergus Molloy
2025-06-19 14:31:13 +01:00
parent 309b47ceb5
commit ec9a456c74
18 changed files with 91 additions and 183 deletions

View File

@ -13,6 +13,13 @@ P = function(v)
return v
end
function TableConcat(t1, t2)
for i=1,#t2 do
t1[#t1+1] = t2[i]
end
return t1
end
-- [[ Install `lazy.nvim` plugin manager ]]
-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'

View File

@ -1,58 +0,0 @@
local file = vim.fn.glob '~/projects/cdy-nvim'
if file ~= '' then
return {
{
'projects/cdy-nvim',
dir = '~/projects/cdy-nvim',
cmd = { 'CodyChat', 'CodyAsk', 'CodySetModel', 'CodyToggleFileContext', 'CodyToggleRepoContext', 'CodyNew' },
dependencies = {
'MunifTanjim/nui.nvim',
'nvim-lua/plenary.nvim',
},
keys = {
{ '<leader>cc', '<cmd>CodyChat<cr>', desc = 'Open cody chat' },
{ '<leader>cn', '<cmd>CodyNew<cr>', desc = 'Start new cody chat' },
},
dev = true,
opts = {
include_file = true,
include_repo = true,
},
},
}
else
return {
{
'olimorris/codecompanion.nvim',
lazy = false,
opts = {
strategies = {
chat = {
adapter = 'anthropic',
},
inline = {
adapter = 'anthropic',
},
},
},
dependencies = {
'nvim-lua/plenary.nvim',
'nvim-treesitter/nvim-treesitter',
},
},
-- {
-- 'pasky/claude.vim',
-- lazy = false,
-- config = function()
-- local api_key = os.getenv 'ANTHROPIC_API_KEY'
-- vim.g.claude_api_key = api_key
-- vim.cmd [[
-- let g:claude_map_implement = "<Leader>ci"
-- let g:claude_map_open_chat = "<Leader>cc"
-- let g:claude_map_send_chat_message = "<C-]>"
-- let g:claude_map_cancel_response = "<Leader>cx"
-- ]]
-- end,
-- },
}
end

View File

@ -4,23 +4,6 @@ return {
dependencies = {
{ 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate' },
{ 'nvim-lua/plenary.nvim' },
-- Test with blink.cmp
{
'saghen/blink.cmp',
lazy = false,
version = '*',
opts = {
keymap = {
preset = 'enter',
['<S-Tab>'] = { 'select_prev', 'fallback' },
['<Tab>'] = { 'select_next', 'fallback' },
},
cmdline = { sources = { 'cmdline' } },
sources = {
default = { 'lsp', 'path', 'buffer', 'codecompanion' },
},
},
},
},
opts = {
adapters = {
@ -40,7 +23,6 @@ return {
},
--Refer to: https://github.com/olimorris/codecompanion.nvim/blob/main/lua/codecompanion/config.lua
strategies = {
--NOTE: Change the adapter as required
chat = {
adapter = 'ollama',
completion_provider = 'blink', -- blink|cmp|coc|default
@ -48,9 +30,6 @@ return {
inline = { adapter = 'ollama' },
cmd = { adapter = 'ollama' },
},
opts = {
log_level = 'DEBUG',
},
},
},
}

20
lua/plugins/ai/cody.lua Normal file
View File

@ -0,0 +1,20 @@
return {
{
'projects/cdy-nvim',
dir = '~/projects/cdy-nvim',
cmd = { 'CodyChat', 'CodyAsk', 'CodySetModel', 'CodyToggleFileContext', 'CodyToggleRepoContext', 'CodyNew' },
dependencies = {
'MunifTanjim/nui.nvim',
'nvim-lua/plenary.nvim',
},
keys = {
{ '<leader>cc', '<cmd>CodyChat<cr>', desc = 'Open cody chat' },
{ '<leader>cn', '<cmd>CodyNew<cr>', desc = 'Start new cody chat' },
},
dev = true,
opts = {
include_file = true,
include_repo = true,
},
},
}

6
lua/plugins/ai/init.lua Normal file
View File

@ -0,0 +1,6 @@
local file = vim.fn.glob '~/projects/cdy-nvim'
if file ~= '' then
return require 'plugins.ai.cody'
else
return require 'plugins.ai.codecompanion'
end

View File

@ -26,10 +26,14 @@ return {
require('nvim-dap-virtual-text').setup {}
local dir = vim.fn.getcwd(0)
local contents = vim.fn.readblob(dir .. '/launch.json')
local prj_confs = vim.json.decode(contents)
local all_confs = prj_confs.configurations or {}
local file = vim.fn.glob(dir .. '/launch.json')
local prj_confs = {}
if file ~= '' then
local contents = vim.fn.readblob(dir .. '/launch.json')
prj_confs = vim.json.decode(contents)
end
local all_confs = prj_confs.configurations or {}
local global_confs = require 'plugins.dap.configurations'
for _, conf in ipairs(global_confs) do
table.insert(all_confs, conf)

View File

@ -1,4 +1,11 @@
return {
{ -- Git integrations
'tpope/vim-fugitive',
cmd = { 'G', 'Git' },
keys = {
{ '<leader>gg', '<cmd>Git<cr>', desc = 'Open git fugitive' },
},
},
{ -- Adds git related signs to the gutter, as well as utilities for managing changes
'lewis6991/gitsigns.nvim',
lazy = false,

View File

@ -1,36 +1,4 @@
return {
-- NOTE: [ THEMES ]
-- {
-- 'yorumicolors/yorumi.nvim',
-- },
-- {
-- 'savq/melange-nvim',
-- },
-- {
-- 'sainnhe/gruvbox-material',
-- lazy = false,
-- config = function()
-- vim.g.gruvbox_material_background = 'medium'
-- vim.g.gruvbox_material_enable_italic = true
-- vim.cmd 'colorscheme gruvbox-material'
-- end,
-- },
{
'rebelot/kanagawa.nvim',
lazy = false,
config = function()
vim.cmd 'colorscheme kanagawa'
end,
},
{ -- Git integrations
'tpope/vim-fugitive',
cmd = { 'G', 'Git' },
keys = {
{ '<leader>gg', '<cmd>Git<cr>', desc = 'Open git fugitive' },
},
},
{ -- traverse undotree
'mbbill/undotree',
keys = {
@ -63,19 +31,6 @@ return {
opts = {},
},
{
-- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins
-- used for completion, annotations and signatures of Neovim apis
'folke/lazydev.nvim',
ft = 'lua',
opts = {
library = {
-- Load luvit types when the `vim.uv` word is found
{ path = '${3rd}/luv/library', words = { 'vim%.uv' } },
},
},
},
{
'nmac427/guess-indent.nvim',
Event = 'BufEnter',

View File

@ -1,4 +1,4 @@
return {
return TableConcat(require 'plugins.lsp.conform', {
{
'neovim/nvim-lspconfig',
dependencies = {
@ -18,9 +18,21 @@ return {
},
ft = { 'lua', 'elixir', 'go', 'erlang', 'typescript', 'typescriptreact', 'rust' },
config = function()
require('lsp').setup()
require('plugins.lsp.setup').setup()
end,
},
{
-- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins
-- used for completion, annotations and signatures of Neovim apis
'folke/lazydev.nvim',
ft = 'lua',
opts = {
library = {
-- Load luvit types when the `vim.uv` word is found
{ path = '${3rd}/luv/library', words = { 'vim%.uv' } },
},
},
},
{
'windwp/nvim-ts-autotag',
ft = { 'javascriptreact', 'typescriptreact', 'html' },
@ -33,4 +45,4 @@ return {
},
},
},
}
})

View File

@ -21,13 +21,13 @@ function M.setup()
},
},
},
golangci_lint_ls = require 'lsp.golangci_lint_ls',
golangci_lint_ls = require 'plugins.lsp.golangci_lint_ls',
erlangls = { cmd = { '/home/fergusmolloy/.local/bin/erlang_ls' }, filetypes = { 'erlang' } },
elixirls = { cmd = { 'elixir-ls' }, filetypes = { 'elixir' } },
lua_ls = require 'lsp.lua_ls',
lua_ls = require 'plugins.lsp.lua_ls',
}
local on_attach = require 'lsp.on_attach'
local on_attach = require 'plugins.lsp.on_attach'
local lspconfig = require 'lspconfig'
for server, config in pairs(servers) do
@ -39,7 +39,7 @@ function M.setup()
end
config.capabilities = require('blink.cmp').get_lsp_capabilities(config.capabilities)
config.on_attach = require 'lsp.on_attach'
config.on_attach = require 'plugins.lsp.on_attach'
vim.lsp.enable(server)
vim.lsp.config(server, config)

View File

@ -1,49 +0,0 @@
return {}
-- {
-- 'folke/noice.nvim',
-- dependencies = {
-- 'MunifTanjim/nui.nvim',
-- },
-- Event = 'VeryLazy',
-- opts = {
-- lsp = {
-- -- override markdown rendering so that **cmp** and other plugins use **Treesitter**
-- override = {
-- ['vim.lsp.util.convert_input_to_markdown_lines'] = true,
-- ['vim.lsp.util.stylize_markdown'] = true,
-- ['cmp.entry.get_documentation'] = true, -- requires hrsh7th/nvim-cmp
-- },
-- },
-- -- you can enable a preset for easier configuration
-- presets = {
-- bottom_search = true, -- use a classic bottom cmdline for search
-- command_palette = true, -- position the cmdline and popupmenu together
-- long_message_to_split = true, -- long messages will be sent to a split
-- inc_rename = false, -- enables an input dialog for inc-rename.nvim
-- lsp_doc_border = false, -- add a border to hover docs and signature help
-- },
-- messages = {
-- enabled = true,
-- view_search = false,
-- },
-- popupmenu = {
-- enabled = true,
-- },
-- -- filter out annoying erlangls messages
-- routes = {
-- {
-- filter = {
-- event = 'lsp',
-- kind = 'progress',
-- find = 'Indexing',
-- cond = function(message)
-- local client = vim.tbl_get(message.opts, 'progress', 'client')
-- return client == 'erlangls'
-- end,
-- },
-- opts = { skip = true },
-- },
-- },
-- },
-- },
-- }

25
lua/plugins/theme.lua Normal file
View File

@ -0,0 +1,25 @@
return {
-- NOTE: [ THEMES ]
-- {
-- 'yorumicolors/yorumi.nvim',
-- },
-- {
-- 'savq/melange-nvim',
-- },
-- {
-- 'sainnhe/gruvbox-material',
-- lazy = false,
-- config = function()
-- vim.g.gruvbox_material_background = 'medium'
-- vim.g.gruvbox_material_enable_italic = true
-- vim.cmd 'colorscheme gruvbox-material'
-- end,
-- },
{
'rebelot/kanagawa.nvim',
lazy = false,
config = function()
vim.cmd 'colorscheme kanagawa'
end,
},
}