|
|
|
@ -6,6 +6,8 @@ options = { noremap = true }
|
|
|
|
|
-- Navigation
|
|
|
|
|
map('n', 'gh', '0', options) -- make gh go to beginning of line
|
|
|
|
|
map('n', 'gl', '$', options) -- make gl go to end of line
|
|
|
|
|
map('n', 'gk', 'gg', options) -- make gk go to top of document
|
|
|
|
|
map('n', 'gj', 'G', options) -- make gj go to bottom of document
|
|
|
|
|
|
|
|
|
|
-- WINDOW MANAGEMENT
|
|
|
|
|
|
|
|
|
@ -38,33 +40,14 @@ map('n', '<leader>q', '<cmd>call ToggleQFList(0)<CR>', {}) -- see plugin/navigat
|
|
|
|
|
|
|
|
|
|
-- GIT
|
|
|
|
|
-- top level commands
|
|
|
|
|
map('n', '<leader>gs', '<cmd>keepalt Git<CR>', options) -- Show git status
|
|
|
|
|
map('n', '<leader>gc', '<cmd>G commit -v<CR>', options) -- git commit
|
|
|
|
|
map('n', '<leader>gs', '<cmd>G<CR>', options) -- Show git status
|
|
|
|
|
map('n', '<leader>gc', '<cmd>G commit<CR>', options) -- git commit
|
|
|
|
|
map('n', '<leader>gp', '<cmd>G push<CR>', {}) -- git push
|
|
|
|
|
map('n', '<leader>gd', '<cmd>G diff<CR>', options)
|
|
|
|
|
map('n', '<leader>gds', '<cmd>G diff --staged<CR>', options)
|
|
|
|
|
|
|
|
|
|
-- staging
|
|
|
|
|
map('n', '<leader>dp', '<cmd>diffput<CR>', options)
|
|
|
|
|
|
|
|
|
|
-- merge
|
|
|
|
|
map('n', '<leader>gh', '<cmd>diffget //2<CR>', options) -- merge from left pane
|
|
|
|
|
map('n', '<leader>gl', '<cmd>diffget //3<CR>', options) -- merge from right pane
|
|
|
|
|
|
|
|
|
|
vim.keymap.set(
|
|
|
|
|
"i",
|
|
|
|
|
"<Plug>(vimrc:copilot-dummy-map)",
|
|
|
|
|
'copilot#Accept("")',
|
|
|
|
|
{ silent = true, expr = true, desc = "Copilot dummy accept" }
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
-- remap copilot key to <C-j>
|
|
|
|
|
vim.g.copilot_no_tab_map = true
|
|
|
|
|
vim.g.copilot_assume_mapped = true
|
|
|
|
|
|
|
|
|
|
local map = vim.keymap.set
|
|
|
|
|
map("i", "<C-j>", "copilot#Accept('<CR>')", {noremap = true, silent = true, expr=true, replace_keycodes = false })
|
|
|
|
|
|
|
|
|
|
-- LSP
|
|
|
|
|
-- Use an on_attach function to only map the following keys
|
|
|
|
|
-- after the language server attaches to the current buffer
|
|
|
|
@ -83,19 +66,19 @@ local on_attach = function(client, bufnr)
|
|
|
|
|
vim.keymap.set('n', '<leader>F', function() vim.lsp.buf.format() end, opts)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local cmp_mappings = function ()
|
|
|
|
|
local cmp = require('cmp')
|
|
|
|
|
local cmp_select = {behavior = cmp.SelectBehavior.Select}
|
|
|
|
|
local cmp_mappings = {
|
|
|
|
|
['<C-d>'] = cmp.mapping.scroll_docs(4),
|
|
|
|
|
['<C-u>'] = cmp.mapping.scroll_docs(-4),
|
|
|
|
|
return {
|
|
|
|
|
['<C-j>'] = cmp.mapping.scroll_docs(4),
|
|
|
|
|
['<C-k>'] = cmp.mapping.scroll_docs(-4),
|
|
|
|
|
['<C-Space>'] = cmp.mapping.complete(),
|
|
|
|
|
['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
|
|
|
|
|
['<C-n>'] = cmp.mapping.select_next_item(cmp_select),
|
|
|
|
|
['<CR>'] = cmp.mapping.confirm({
|
|
|
|
|
['<CR>'] = cmp.mapping.confirm {
|
|
|
|
|
behavior = cmp.ConfirmBehavior.Replace,
|
|
|
|
|
select = true,
|
|
|
|
|
}),
|
|
|
|
|
['<C-e>'] = cmp.mapping.abort(),
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return { on_attach = on_attach, cmp_mappings = cmp_mappings }
|
|
|
|
|