First day of development changes

This commit is contained in:
Chris
2025-04-14 15:20:54 +01:00
parent 01164c6d8b
commit c3574de9bc
8 changed files with 177 additions and 112 deletions

View File

@@ -20,17 +20,17 @@ vim.api.nvim_create_autocmd('FocusLost', {
command = 'silent! wa', -- Save all files when moving away from the window command = 'silent! wa', -- Save all files when moving away from the window
}) })
vim.api.nvim_create_autocmd('InsertLeave', { -- vim.api.nvim_create_autocmd('InsertLeave', {
group = autosave_group, -- group = autosave_group,
pattern = '*', -- pattern = '*',
command = 'silent! wa', -- Save all files when leaving insert mode -- command = 'silent! wa', -- Save all files when leaving insert mode
}) -- })
vim.api.nvim_create_autocmd('TextChanged', { -- vim.api.nvim_create_autocmd('TextChanged', {
group = autosave_group, -- group = autosave_group,
pattern = '*', -- pattern = '*',
command = 'silent! wa', -- Save all files when text is changed -- command = 'silent! wa', -- Save all files when text is changed
}) -- })
vim.api.nvim_create_autocmd("User", { vim.api.nvim_create_autocmd("User", {
pattern = "OilActionsPost", pattern = "OilActionsPost",

View File

@@ -40,13 +40,11 @@ vim.keymap.set({ 'n', 'v', 'c', 'i' }, '<C-Q>', '<CMD>Telescope lsp_document_sym
vim.keymap.set({ 'n', 'v', 'c', 'i' }, '<C-S-Q>', '<CMD>Telescope lsp_workspace_symbols<CR>', { desc = 'Show symbols in workspace' }) vim.keymap.set({ 'n', 'v', 'c', 'i' }, '<C-S-Q>', '<CMD>Telescope lsp_workspace_symbols<CR>', { desc = 'Show symbols in workspace' })
vim.keymap.set({ 'n', 'v', 'c', 'i' }, '<C-E>', '<CMD>Telescope oldfiles<CR>', { desc = 'Show recently opened files' }) vim.keymap.set({ 'n', 'v', 'c', 'i' }, '<C-E>', '<CMD>Telescope oldfiles<CR>', { desc = 'Show recently opened files' })
vim.keymap.set({ 'n', 'v', 'c', 'i' }, '<C-P>', function() vim.keymap.set({ 'n', 'v', 'c', 'i' }, '<C-P>', function()
require('telescope.builtin').find_files { require('telescope.builtin').git_files()
show_untracked = true, end, { desc = 'Find all files' })
hidden = true,
}
end, { desc = 'Find version controlled files' })
vim.keymap.set({ 'n', 'v', 'c', 'i' }, '<C-S-P>', function() vim.keymap.set({ 'n', 'v', 'c', 'i' }, '<C-S-P>', function()
require('telescope.builtin').find_files { require('telescope.builtin').find_files {
show_untracked = true,
no_ignore = true, no_ignore = true,
hidden = true, hidden = true,
} }
@@ -87,15 +85,15 @@ vim.keymap.set('n', '<Leader>gaf', '<CMD>Git add %<CR>', { desc = 'Git add curre
vim.keymap.set('n', '<Leader>gaa', '<CMD>Git add --all<CR>', { desc = 'Git add all unstaged changes' }) vim.keymap.set('n', '<Leader>gaa', '<CMD>Git add --all<CR>', { desc = 'Git add all unstaged changes' })
vim.keymap.set('n', '<Leader>gap', '<CMD>Git add --patch --all<CR>', { desc = 'Git add all unstaged changes interactively' }) vim.keymap.set('n', '<Leader>gap', '<CMD>Git add --patch --all<CR>', { desc = 'Git add all unstaged changes interactively' })
vim.keymap.set('n', '<Leader>gb', '<CMD>Git blame<CR>', { desc = 'Git blame' }) vim.keymap.set('n', '<Leader>gb', '<CMD>Git blame<CR>', { desc = 'Git blame' })
vim.keymap.set('n', '<Leader>gcm', '<CMD>Git commit<CR>', { desc = 'Git commit' }) vim.keymap.set('n', '<Leader>gcm', '<CMD>Git commit -v<CR>', { desc = 'Git commit' })
vim.keymap.set('n', '<Leader>gp', '<CMD>Git push<CR>', { desc = 'Git push' }) vim.keymap.set('n', '<Leader>gp', '<CMD>Git push<CR>', { desc = 'Git push' })
vim.keymap.set('n', '<Leader>gup', '<CMD>Git pull --rebase<CR>', { desc = 'Git pull --rebase' }) vim.keymap.set('n', '<Leader>gup', '<CMD>Git pull --rebase<CR>', { desc = 'Git pull --rebase' })
vim.keymap.set('n', '<Leader>gsb', '<CMD>Git status<CR>', { desc = 'Git status' }) vim.keymap.set('n', '<Leader>gsb', '<CMD>Git status<CR>', { desc = 'Git status' })
vim.keymap.set('n', '<Leader>gd', '<CMD>Git diff<CR>', { desc = 'Git diff' }) vim.keymap.set('n', '<Leader>gd', '<CMD>Git diff<CR>', { desc = 'Git diff' })
vim.keymap.set('n', '<Leader>gdc', '<CMD>Git diff --cached<CR>', { desc = 'Git diff' })
vim.keymap.set('n', '<Leader>gl', '<CMD>Git log<CR>', { desc = 'Git log' }) vim.keymap.set('n', '<Leader>gl', '<CMD>Git log<CR>', { desc = 'Git log' })
vim.keymap.set('n', '<Leader>gun', '<CMD>Git reset -- %<CR>', { desc = 'Git unstage file' }) vim.keymap.set('n', '<Leader>gun', '<CMD>Git reset -- %<CR>', { desc = 'Git unstage file' })
vim.keymap.set('n', '<Leader>gco', '<CMD>Git checkout', { desc = 'Git checkout' }) vim.keymap.set('n', '<Leader>gco', '<CMD>Git checkout', { desc = 'Git checkout' })
vim.keymap.set('n', '<Leader>gc', '<CMD>Git commit<CR>', { desc = 'Git commit' })
vim.keymap.set('n', '<Leader>G', '<CMD>Git', { desc = 'Git' }) vim.keymap.set('n', '<Leader>G', '<CMD>Git', { desc = 'Git' })
vim.keymap.set('n', '<Leader>gsta', '<CMD>Git stash push<CR>', { desc = 'Git stash' }) vim.keymap.set('n', '<Leader>gsta', '<CMD>Git stash push<CR>', { desc = 'Git stash' })
vim.keymap.set('n', '<Leader>gstA', '<CMD>Git stash apply<CR>', { desc = 'Git stash apply' }) vim.keymap.set('n', '<Leader>gstA', '<CMD>Git stash apply<CR>', { desc = 'Git stash apply' })

View File

@@ -1,8 +1,25 @@
require('helpers').edit_cf('pa', '/lua/plugins/avante.lua') require('helpers').edit_cf('pa', '/lua/plugins/codecompanion.lua')
return { return {
'olimorris/codecompanion.nvim', 'olimorris/codecompanion.nvim',
opts = {}, opts = {
adapters = {
copilot = function()
return require('codecompanion.adapters').extend('copilot', {
schema = {
model = {
default = 'claude-3.7-sonnet',
},
},
})
end,
},
display = {
chat = {
show_settings = true,
},
},
},
dependencies = { dependencies = {
'nvim-lua/plenary.nvim', 'nvim-lua/plenary.nvim',
'nvim-treesitter/nvim-treesitter', 'nvim-treesitter/nvim-treesitter',

View File

@@ -1,3 +1,3 @@
return { return {
'zbirenbaum/copilot.lua', 'github/copilot.vim',
} }

View File

@@ -7,6 +7,9 @@ return {
lint.linters_by_ft = { lint.linters_by_ft = {
markdown = { 'markdownlint' }, markdown = { 'markdownlint' },
} }
lint.linters_by_ft['javascript'] = nil
lint.linters_by_ft['vue'] = nil
lint.linters_by_ft['html'] = nil
-- To allow other plugins to add linters to require('lint').linters_by_ft, -- To allow other plugins to add linters to require('lint').linters_by_ft,
-- instead set linters_by_ft like this: -- instead set linters_by_ft like this:

View File

@@ -1,4 +1,6 @@
-- Main LSP Configuration -- Main LSP Configuration
require('helpers').edit_cf('pl', '/lua/plugins/lsp.lua')
return { return {
'neovim/nvim-lspconfig', 'neovim/nvim-lspconfig',
dependencies = { dependencies = {
@@ -194,6 +196,9 @@ return {
-- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features. -- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features.
-- - settings (table): Override the default settings passed when initializing the server. -- - settings (table): Override the default settings passed when initializing the server.
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
local mason_registry = require 'mason-registry'
local vue_language_server_path = mason_registry.get_package('vue-language-server'):get_install_path() .. '/node_modules/@vue/language-server'
local servers = { local servers = {
-- clangd = {}, -- clangd = {},
-- gopls = {}, -- gopls = {},
@@ -222,6 +227,30 @@ return {
}, },
}, },
}, },
ts_ls = {
init_options = {
plugins = {
{
name = '@vue/typescript-plugin',
location = vue_language_server_path,
languages = { 'vue' },
},
},
},
filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue' },
},
volar = {
on_attach = function(client, bufnr)
client.server_capabilities.documentFormattingProvider = false
end,
},
phpactor = {
on_attach = function(client, bufnr)
client.server_capabilities.documentFormattingProvider = false
end,
},
} }
-- Ensure the servers and tools above are installed -- Ensure the servers and tools above are installed

View File

@@ -1,4 +1,5 @@
-- Filesystem manager -- Filesystem manager
require('helpers').edit_cf('po', '/lua/plugins/oil.lua')
vim.keymap.set('n', '-', '<CMD>Oil<CR>', { desc = 'Open parent directory' }) vim.keymap.set('n', '-', '<CMD>Oil<CR>', { desc = 'Open parent directory' })
@@ -10,6 +11,9 @@ return {
view_options = { view_options = {
show_hidden = true, show_hidden = true,
}, },
keymaps = {
['<C-p>'] = false,
},
}, },
-- Optional dependencies -- Optional dependencies
dependencies = { { 'echasnovski/mini.icons', opts = {} } }, dependencies = { { 'echasnovski/mini.icons', opts = {} } },

View File

@@ -1,105 +1,119 @@
-- Fuzzy Finder (files, lsp, etc) -- Fuzzy Finder (files, lsp, etc)
-- See :help telescope -- See :help telescope
return { return {
"nvim-telescope/telescope.nvim", 'nvim-telescope/telescope.nvim',
event = "VimEnter", event = 'VimEnter',
dependencies = { dependencies = {
"nvim-lua/plenary.nvim", 'nvim-lua/plenary.nvim',
{ -- If encountering errors, see telescope-fzf-native README for installation instructions { -- If encountering errors, see telescope-fzf-native README for installation instructions
"nvim-telescope/telescope-fzf-native.nvim", 'nvim-telescope/telescope-fzf-native.nvim',
-- `build` is used to run some command when the plugin is installed/updated. -- `build` is used to run some command when the plugin is installed/updated.
-- This is only run then, not every time Neovim starts up. -- This is only run then, not every time Neovim starts up.
build = "make", build = 'make',
-- `cond` is a condition used to determine whether this plugin should be -- `cond` is a condition used to determine whether this plugin should be
-- installed and loaded. -- installed and loaded.
cond = function() cond = function()
return vim.fn.executable("make") == 1 return vim.fn.executable 'make' == 1
end, end,
}, },
{ "nvim-telescope/telescope-ui-select.nvim" }, { 'nvim-telescope/telescope-ui-select.nvim' },
-- Useful for getting pretty icons, but requires a Nerd Font. -- Useful for getting pretty icons, but requires a Nerd Font.
{ "nvim-tree/nvim-web-devicons", enabled = vim.g.have_nerd_font }, { 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font },
}, },
config = function() config = function()
-- Telescope is a fuzzy finder that comes with a lot of different things that -- Telescope is a fuzzy finder that comes with a lot of different things that
-- it can fuzzy find! It's more than just a "file finder", it can search -- it can fuzzy find! It's more than just a "file finder", it can search
-- many different aspects of Neovim, your workspace, LSP, and more! -- many different aspects of Neovim, your workspace, LSP, and more!
-- --
-- The easiest way to use Telescope, is to start by doing something like: -- The easiest way to use Telescope, is to start by doing something like:
-- :Telescope help_tags -- :Telescope help_tags
-- --
-- After running this command, a window will open up and you're able to -- After running this command, a window will open up and you're able to
-- type in the prompt window. You'll see a list of `help_tags` options and -- type in the prompt window. You'll see a list of `help_tags` options and
-- a corresponding preview of the help. -- a corresponding preview of the help.
-- --
-- Two important keymaps to use while in Telescope are: -- Two important keymaps to use while in Telescope are:
-- - Insert mode: <c-/> -- - Insert mode: <c-/>
-- - Normal mode: ? -- - Normal mode: ?
-- --
-- This opens a window that shows you all of the keymaps for the current -- This opens a window that shows you all of the keymaps for the current
-- Telescope picker. This is really useful to discover what Telescope can -- Telescope picker. This is really useful to discover what Telescope can
-- do as well as how to actually do it! -- do as well as how to actually do it!
-- [[ Configure Telescope ]] -- [[ Configure Telescope ]]
-- See `:help telescope` and `:help telescope.setup()` -- See `:help telescope` and `:help telescope.setup()`
require("telescope").setup({ require('telescope').setup {
-- You can put your default mappings / updates / etc. in here -- You can put your default mappings / updates / etc. in here
-- All the info you're looking for is in `:help telescope.setup()` -- All the info you're looking for is in `:help telescope.setup()`
-- --
-- defaults = { -- defaults = {
-- mappings = { -- mappings = {
-- i = { ['<c-enter>'] = 'to_fuzzy_refine' }, -- i = { ['<c-enter>'] = 'to_fuzzy_refine' },
-- }, -- },
-- }, -- },
-- pickers = {} -- pickers = {}
extensions = { extensions = {
["ui-select"] = { ['ui-select'] = {
require("telescope.themes").get_dropdown(), require('telescope.themes').get_dropdown(),
}, },
}, },
}) defaults = {
mappings = {
i = {
-- Insert mode mappings for Telescope
['<C-j>'] = 'move_selection_next',
['<C-k>'] = 'move_selection_previous',
},
n = {
-- Normal mode mappings for Telescope
['<C-j>'] = 'move_selection_next',
['<C-k>'] = 'move_selection_previous',
},
},
},
}
-- Enable Telescope extensions if they are installed -- Enable Telescope extensions if they are installed
pcall(require("telescope").load_extension, "fzf") pcall(require('telescope').load_extension, 'fzf')
pcall(require("telescope").load_extension, "ui-select") pcall(require('telescope').load_extension, 'ui-select')
-- See `:help telescope.builtin` -- See `:help telescope.builtin`
local builtin = require("telescope.builtin") local builtin = require 'telescope.builtin'
vim.keymap.set("n", "<leader>sh", builtin.help_tags, { desc = "[S]earch [H]elp" }) vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
vim.keymap.set("n", "<leader>sk", builtin.keymaps, { desc = "[S]earch [K]eymaps" }) vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
vim.keymap.set("n", "<leader>sf", builtin.find_files, { desc = "[S]earch [F]iles" }) vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
vim.keymap.set("n", "<leader>ss", builtin.builtin, { desc = "[S]earch [S]elect Telescope" }) vim.keymap.set('n', '<leader>ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' })
vim.keymap.set("n", "<leader>sw", builtin.grep_string, { desc = "[S]earch current [W]ord" }) vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
vim.keymap.set("n", "<leader>sg", builtin.live_grep, { desc = "[S]earch by [G]rep" }) vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
vim.keymap.set("n", "<leader>sd", builtin.diagnostics, { desc = "[S]earch [D]iagnostics" }) vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
vim.keymap.set("n", "<leader>sr", builtin.resume, { desc = "[S]earch [R]esume" }) vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
vim.keymap.set("n", "<leader>s.", builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
vim.keymap.set("n", "<leader><leader>", builtin.buffers, { desc = "[ ] Find existing buffers" }) vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
-- Slightly advanced example of overriding default behavior and theme -- Slightly advanced example of overriding default behavior and theme
vim.keymap.set("n", "<leader>/", function() vim.keymap.set('n', '<leader>/', function()
-- You can pass additional configuration to Telescope to change the theme, layout, etc. -- You can pass additional configuration to Telescope to change the theme, layout, etc.
builtin.current_buffer_fuzzy_find(require("telescope.themes").get_dropdown({ builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
winblend = 10, winblend = 10,
previewer = false, previewer = false,
})) })
end, { desc = "[/] Fuzzily search in current buffer" }) end, { desc = '[/] Fuzzily search in current buffer' })
-- It's also possible to pass additional configuration options. -- It's also possible to pass additional configuration options.
-- See `:help telescope.builtin.live_grep()` for information about particular keys -- See `:help telescope.builtin.live_grep()` for information about particular keys
vim.keymap.set("n", "<leader>s/", function() vim.keymap.set('n', '<leader>s/', function()
builtin.live_grep({ builtin.live_grep {
grep_open_files = true, grep_open_files = true,
prompt_title = "Live Grep in Open Files", prompt_title = 'Live Grep in Open Files',
}) }
end, { desc = "[S]earch [/] in Open Files" }) end, { desc = '[S]earch [/] in Open Files' })
-- Shortcut for searching your Neovim configuration files -- Shortcut for searching your Neovim configuration files
vim.keymap.set("n", "<leader>sn", function() vim.keymap.set('n', '<leader>sn', function()
builtin.find_files({ cwd = vim.fn.stdpath("config") }) builtin.find_files { cwd = vim.fn.stdpath 'config' }
end, { desc = "[S]earch [N]eovim files" }) end, { desc = '[S]earch [N]eovim files' })
end, end,
} }