You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.8 KiB
Lua

local map = vim.keymap.set
options = { noremap = true }
-- FILE NAVIGATION
local builtin = require('telescope.builtin')
map('n', '<leader>f', builtin.find_files, options)
map('n', '<leader>af', builtin.git_files, options)
-- Grep project file contents with live results, respecting .gitignore
map('n', '<leader>g', builtin.live_grep, options)
-- Telescope fuzzy search for buffers
map('n', '<leader>b', builtin.buffers, options)
map('n', 'ga', '<C-^><CR>', options) -- ga to switch to last used buffer
-- Quick Fix Lists
-- global -- using control
map('n', '<C-n>', '<cmd>cnext<CR>zz', options) -- Go to next item in global qfixlist
map('n', '<C-p>', '<cmd>cprev<CR>zz', options) -- Go to previous item in global qfixlist
-- Toggle the window if there are items in the qfixlist; allow recursive
map('n', 'Q', '<cmd>call ToggleQFList(1)<CR>', {}) -- see plugin/navigation.vim for ToggleQFList definition
-- local -- using leader
map('n', '<leader>j', '<cmd>lnext<CR>zz', options) -- Go to next item in local qfixlist
map('n', '<leader>k', '<cmd>lprev<CR>zz', options) -- Go to previous item in global qfixlist
-- Toggle the window if there are items in the qfixlist; allow recursive
map('n', '<leader>q', '<cmd>call ToggleQFList(0)<CR>', {}) -- see plugin/navigation.vim for ToggleQFList definition
-- 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>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