diff --git a/init.lua b/init.lua index 1167ffa9..7f7d5eaf 100644 --- a/init.lua +++ b/init.lua @@ -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', 'pv', ':Ex', { noremap = true, silent = true }) + -- Clear highlights on search when pressing in normal mode -- See `:help hlsearch` vim.keymap.set('n', '', 'nohlsearch') @@ -175,11 +178,11 @@ vim.keymap.set('n', 'q', vim.diagnostic.setloclist, { desc = 'Open diagn -- or just use to exit terminal mode vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' }) --- TIP: Disable arrow keys in normal mode --- vim.keymap.set('n', '', 'echo "Use h to move!!"') --- vim.keymap.set('n', '', 'echo "Use l to move!!"') --- vim.keymap.set('n', '', 'echo "Use k to move!!"') --- vim.keymap.set('n', '', 'echo "Use j to move!!"') +-- Disable arrow keys in normal mode +vim.keymap.set('n', '', 'echo "Use h to move!!"') +vim.keymap.set('n', '', 'echo "Use l to move!!"') +vim.keymap.set('n', '', 'echo "Use k to move!!"') +vim.keymap.set('n', '', 'echo "Use j to move!!"') -- Keybinds to make split navigation easier. -- Use CTRL+ to switch between windows @@ -193,6 +196,14 @@ vim.keymap.set('n', '', '', { 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', '', 'copilot#Accept("")', { silent = true, expr = true }) + end, }, -- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the