Move keymaps to on_attach function, disable current line highlight

This commit is contained in:
Evie Litherland-Smith 2022-11-01 14:26:33 +00:00
parent 672b50786b
commit 27c72a484d
2 changed files with 17 additions and 5 deletions

View file

@ -1,10 +1,26 @@
vim.o.showtabline = 2 vim.o.showtabline = 2
require('gitsigns').setup()
require('tabby.tabline').use_preset('active_wins_at_tail', { nerdfont = false }) require('tabby.tabline').use_preset('active_wins_at_tail', { nerdfont = false })
require('trouble').setup() require('trouble').setup()
require('fidget').setup() require('fidget').setup()
require('hop').setup() require('hop').setup()
-- gitsigns config
require('gitsigns').setup{
signcolumn = true,
numhl = true,
linehl = true,
current_line_blame = true,
on_attach = function(bufnr)
-- Setup keymaps
vim.api.nvim_buf_set_keymap(bufnr, 'n', '[g', '<cmd>Gitsigns prev_hunk<CR>', {})
vim.api.nvim_buf_set_keymap(bufnr, 'n', ']g', '<cmd>Gitsigns next_hunk<CR>', {})
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>hp', '<cmd>Gitsigns preview_hunk<CR>', {})
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>hs', '<cmd>Gitsigns select_hunk<CR>', {})
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>bl', '<cmd>Gitsigns blame_line<CR>', {})
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>bt', '<cmd>Gitsigns toggle_current_line_blame<CR>', {})
end,
}
-- lualine config -- lualine config
require('lualine').setup{ require('lualine').setup{
options = { options = {

View file

@ -71,8 +71,6 @@ if executable('ag')
let g:ackprg = 'ag --vimgrep' let g:ackprg = 'ag --vimgrep'
endif endif
set cursorline
set number set number
set relativenumber set relativenumber
set listchars=trail:.,tab:>_ set listchars=trail:.,tab:>_
@ -125,8 +123,6 @@ nnoremap <leader>nt <cmd>NvimTreeToggle<cr>
nnoremap <leader>nf <cmd>NvimTreeFindFile<cr> nnoremap <leader>nf <cmd>NvimTreeFindFile<cr>
nnoremap [g <cmd>Gitsigns prev_hunk<cr> nnoremap [g <cmd>Gitsigns prev_hunk<cr>
nnoremap ]g <cmd>Gitsigns next_hunk<cr> nnoremap ]g <cmd>Gitsigns next_hunk<cr>
nnoremap <leader>hp <cmd>Gitsigns preview_hunk<cr>
nnoremap <leader>hs <cmd>Gitsigns select_hunk<cr>
set splitbelow set splitbelow
set splitright set splitright