tweaked copilot, keybinds, comments

This commit is contained in:
a-rossetti 2025-01-12 15:18:18 +01:00
parent 0c9b81dd8a
commit 8f2adb18fa
1 changed files with 21 additions and 5 deletions

View File

@ -160,6 +160,9 @@ vim.opt.scrolloff = 10
-- [[ Basic Keymaps ]]
-- See `:help vim.keymap.set()`
-- Change the default file explorer command to leader + e
vim.api.nvim_set_keymap('n', '<leader>pv', ':Ex<CR>', { noremap = true, silent = true })
-- Clear highlights on search when pressing <Esc> in normal mode
-- See `:help hlsearch`
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
@ -175,11 +178,11 @@ vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagn
-- or just use <C-\><C-n> to exit terminal mode
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })
-- TIP: Disable arrow keys in normal mode
-- vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
-- vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
-- vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
-- vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
-- Disable arrow keys in normal mode
vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
-- Keybinds to make split navigation easier.
-- Use CTRL+<hjkl> to switch between windows
@ -193,6 +196,14 @@ vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper win
-- [[ Basic Autocommands ]]
-- See `:help lua-guide-autocommands`
-- Disable auto-commenting on new lines for all file types
vim.api.nvim_create_autocmd('FileType', {
pattern = '*',
callback = function()
vim.bo.formatoptions = vim.bo.formatoptions:gsub('c', ''):gsub('r', '')
end,
})
-- Highlight when yanking (copying) text
-- Try it with `yap` in normal mode
-- See `:help vim.highlight.on_yank()`
@ -924,6 +935,11 @@ require('lazy').setup({
cmd = 'Copilot',
event = 'InsertEnter',
build = ':Copilot auth',
config = function()
vim.g.copilot_no_tab_map = true
vim.g.copilot_no_y_map = true
vim.api.nvim_set_keymap('i', '<C-J>', 'copilot#Accept("<CR>")', { silent = true, expr = true })
end,
},
-- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the