tweaked copilot, keybinds, comments
This commit is contained in:
parent
0c9b81dd8a
commit
8f2adb18fa
26
init.lua
26
init.lua
|
|
@ -160,6 +160,9 @@ vim.opt.scrolloff = 10
|
||||||
-- [[ Basic Keymaps ]]
|
-- [[ Basic Keymaps ]]
|
||||||
-- See `:help vim.keymap.set()`
|
-- 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
|
-- Clear highlights on search when pressing <Esc> in normal mode
|
||||||
-- See `:help hlsearch`
|
-- See `:help hlsearch`
|
||||||
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
|
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
|
-- or just use <C-\><C-n> to exit terminal mode
|
||||||
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })
|
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })
|
||||||
|
|
||||||
-- TIP: Disable arrow keys in normal mode
|
-- Disable arrow keys in normal mode
|
||||||
-- vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
|
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', '<right>', '<cmd>echo "Use l to move!!"<CR>')
|
||||||
-- vim.keymap.set('n', '<up>', '<cmd>echo "Use k 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>')
|
vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
|
||||||
|
|
||||||
-- Keybinds to make split navigation easier.
|
-- Keybinds to make split navigation easier.
|
||||||
-- Use CTRL+<hjkl> to switch between windows
|
-- 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 ]]
|
-- [[ Basic Autocommands ]]
|
||||||
-- See `:help lua-guide-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
|
-- Highlight when yanking (copying) text
|
||||||
-- Try it with `yap` in normal mode
|
-- Try it with `yap` in normal mode
|
||||||
-- See `:help vim.highlight.on_yank()`
|
-- See `:help vim.highlight.on_yank()`
|
||||||
|
|
@ -924,6 +935,11 @@ require('lazy').setup({
|
||||||
cmd = 'Copilot',
|
cmd = 'Copilot',
|
||||||
event = 'InsertEnter',
|
event = 'InsertEnter',
|
||||||
build = ':Copilot auth',
|
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
|
-- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue