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 Remove folder from workspace | <space>wr
List workspace folders | <space>wl List workspace folders | <space>wl
## Diagnostics ## Gitsigns
Open diagnostics as floating window | <space>e Toggle deleted | <leader>td
Goto next diagnostic | [d Diff | <leader> hd
Goto previous diagnostic | ]d Preview hunk | <leader> hp
Show diagnostics | <space>q
## Misc ## Misc
Trouble | <leader>xx
Find in project | <leader>f Find in project | <leader>f

@ -65,7 +65,6 @@ nmap("<leader>t", "<cmd>FloatermToggle<cr>")
map("t", "<leader>t", "<cmd>FloatermToggle<cr>") map("t", "<leader>t", "<cmd>FloatermToggle<cr>")
-- lsp on_attach mappings -- lsp on_attach mappings
local augroup = vim.api.nvim_create_augroup("LspFormatting", {}) local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
local on_attach = function(client, bufnr) local on_attach = function(client, bufnr)
-- Enable completion triggered by <c-x><c-o> -- 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") vim.cmd("colorscheme carbonfox")
-- packer boilerplate -- packer boilerplate
@ -201,7 +193,9 @@ return require('packer').startup(function(use)
} }
use { use {
'folke/trouble.nvim', 'folke/trouble.nvim',
config = function() require("trouble").setup {} config = function() require("trouble").setup {
nmap("<leader>xx", "<cmd>TroubleToggle<cr>");
}
end end
} }
use { use {
@ -265,11 +259,17 @@ return require('packer').startup(function(use)
} }
use { 'lewis6991/gitsigns.nvim', use { 'lewis6991/gitsigns.nvim',
config = function() 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 end
} }
use { end
'sudormrfbin/cheatsheet.nvim', }
use { 'sudormrfbin/cheatsheet.nvim',
-- default toggle is <leader>?
requires = { requires = {
{ 'nvim-telescope/telescope.nvim' }, { 'nvim-telescope/telescope.nvim' },
{ 'nvim-lua/popup.nvim' }, { 'nvim-lua/popup.nvim' },

Loading…
Cancel
Save