pull/1697/head
David Bland 5 months ago
parent 34e7d29aa7
commit 142445bb06

@ -102,7 +102,7 @@ vim.g.have_nerd_font = false
vim.opt.number = true
-- You can also add relative line numbers, to help with jumping.
-- Experiment for yourself to see if you like it!
-- vim.opt.relativenumber = true
vim.opt.relativenumber = true
-- Enable mouse mode, can be useful for resizing splits for example!
vim.opt.mouse = 'a'
@ -188,6 +188,7 @@ vim.keymap.set('n', '<C-h>', '<C-w><C-h>', { desc = 'Move focus to the left wind
vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' })
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
vim.keymap.set('n', '<leader>e', ':Explor<CR>', { desc = 'Open [E]xplor' })
-- [[ Basic Autocommands ]]
-- See `:help lua-guide-autocommands`
@ -236,7 +237,6 @@ require('lazy').setup({
--
-- Use `opts = {}` to automatically pass options to a plugin's `setup()` function, forcing the plugin to be loaded.
--
-- Alternatively, use `config = function() ... end` for full control over the configuration.
-- If you prefer to call `setup` explicitly, use:
-- {
@ -252,6 +252,33 @@ require('lazy').setup({
-- options to `gitsigns.nvim`.
--
-- See `:help gitsigns` to understand what the configuration keys do
{
'zbirenbaum/copilot.lua',
cmd = 'Copilot',
build = ':Copilot auth',
event = 'BufReadPost',
opts = {
suggestion = {
enabled = not vim.g.ai_cmp,
auto_trigger = true,
hide_during_completion = vim.g.ai_cmp,
keymap = {
accept = false, -- handled by nvim-cmp / blink.cmp
next = '<M-]>',
prev = '<M-[>',
},
},
panel = { enabled = false },
filetypes = {
markdown = true,
help = true,
},
},
},
{
'nvim-tree/nvim-tree.lua',
},
{ -- Adds git related signs to the gutter, as well as utilities for managing changes
'lewis6991/gitsigns.nvim',
opts = {
@ -479,6 +506,7 @@ require('lazy').setup({
'hrsh7th/cmp-nvim-lsp',
},
config = function()
require('lspconfig').lua_ls.setup {}
-- Brief aside: **What is LSP?**
--
-- LSP is an initialism you've probably heard, but might not understand what it is.
@ -835,7 +863,15 @@ require('lazy').setup({
-- This will auto-import if your LSP supports it.
-- This will expand snippets if the LSP sent a snippet.
['<C-y>'] = cmp.mapping.confirm { select = true },
['<C-o>'] = cmp.mapping(function(fallback)
local fallback_key = vim.api.nvim_replace_termcodes('<Tab>', true, true, true)
local resolved_key = vim.fn['copilot#Accept'](fallback)
if fallback_key == resolved_key then
cmp.confirm { select = true }
else
vim.api.nvim_feedkeys(resolved_key, 'n', true)
end
end),
-- If you prefer more traditional completion keymaps,
-- you can uncomment the following lines
--['<CR>'] = cmp.mapping.confirm { select = true },
@ -846,7 +882,23 @@ require('lazy').setup({
-- Generally you don't need this, because nvim-cmp will display
-- completions whenever it has completion options available.
['<C-Space>'] = cmp.mapping.complete {},
['<Tab>'] = cmp.mapping(function(fallback)
local copilot = require 'copilot.suggestion'
if copilot.is_visible() then
copilot.accept()
elseif cmp.visible() then
local entry = cmp.get_selected_entry()
if not entry then
cmp.select_next_item { behavior = cmp.SelectBehavior.Select }
else
cmp.confirm()
end
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end, { 'i', 's' }),
-- Think of <c-l> as moving to the right of your snippet expansion.
-- So if you have a snippet that's like:
-- function $name($args)
@ -875,6 +927,7 @@ require('lazy').setup({
-- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
group_index = 0,
},
{ name = 'copilot' },
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
{ name = 'path' },

Loading…
Cancel
Save