Added gitsigns commands

master
Rostyslav Hnatyshyn 2 years ago
parent 6f1f994625
commit f344708581
  1. 11
      nvim/cheatsheet.txt
  2. 24
      nvim/init.lua

@ -13,11 +13,10 @@ Add folder to workspace | <space>wa
Remove folder from workspace | <space>wr
List workspace folders | <space>wl
## Diagnostics
Open diagnostics as floating window | <space>e
Goto next diagnostic | [d
Goto previous diagnostic | ]d
Show diagnostics | <space>q
## Gitsigns
Toggle deleted | <leader>td
Diff | <leader> hd
Preview hunk | <leader> hp
## Misc
Trouble | <leader>xx
Find in project | <leader>f

@ -65,7 +65,6 @@ nmap("<leader>t", "<cmd>FloatermToggle<cr>")
map("t", "<leader>t", "<cmd>FloatermToggle<cr>")
-- lsp on_attach mappings
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
local on_attach = function(client, bufnr)
-- Enable completion triggered by <c-x><c-o>
@ -123,13 +122,6 @@ lsp.sumneko_lua.setup { on_attach = on_attach,
}
}
-- lsp diagnostic mapping
local opts = { noremap = true, silent = true }
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
vim.cmd("colorscheme carbonfox")
-- packer boilerplate
@ -201,7 +193,9 @@ return require('packer').startup(function(use)
}
use {
'folke/trouble.nvim',
config = function() require("trouble").setup {}
config = function() require("trouble").setup {
nmap("<leader>xx", "<cmd>TroubleToggle<cr>");
}
end
}
use {
@ -265,11 +259,17 @@ return require('packer').startup(function(use)
}
use { 'lewis6991/gitsigns.nvim',
config = function()
require('gitsigns').setup()
require('gitsigns').setup {
on_attach = function(bufnr)
nmap('<leader>hd', '<cmd>Gitsigns diffthis<cr>')
nmap('<leader>hp', '<cmd>Gitsigns preview_hunk<cr>')
nmap('<leader>td', '<cmd>Gitsigns toggle_deleted<cr>')
end
}
use {
'sudormrfbin/cheatsheet.nvim',
end
}
use { 'sudormrfbin/cheatsheet.nvim',
-- default toggle is <leader>?
requires = {
{ 'nvim-telescope/telescope.nvim' },
{ 'nvim-lua/popup.nvim' },

Loading…
Cancel
Save