1
0
Fork 0

nvim: misc

This commit is contained in:
Vladimír Dudr 2022-12-20 09:48:28 +01:00
parent 3b66576c5f
commit 42f9170e8f
3 changed files with 6 additions and 19 deletions

View file

@ -1,7 +0,0 @@
function! go#Gofmt(path) abort
let cmd = 'gofmt -w '.a:path
call system(cmd)
let winstate = winsaveview()
exec 'edit!'
call winrestview(winstate)
endfunction

View file

@ -13,15 +13,10 @@ function M.setup()
}
})
-- Use this to toggle gitui in a floating terminal
vim.keymap.set('n', '<Space>g', function()
lazygit:toggle()
end)
vim.keymap.set('n', '<Space>H', function()
local git_history = function()
local file = vim.api.nvim_buf_get_name(0)
local cmd = 'git log -p --ext-diff ' .. file
local git_history = fterm:new({
fterm.scratch({
-- ft = 'git_history', -- You can also override the default filetype, if you want
cmd = cmd,
dimensions = {
@ -29,9 +24,10 @@ function M.setup()
width = 0.9
}
})
end
git_history:open()
end)
vim.keymap.set('n', '<Space>g', function() lazygit:toggle() end,{ desc = 'Toggle lazygit'} )
vim.keymap.set('n', '<Space>H', git_history, { desc = 'Show git history'})
end
return M

View file

@ -28,9 +28,7 @@ vim.api.nvim_create_autocmd('TermOpen', {
-- local buf = args.buf
vim.api.nvim_win_set_option(0, 'number', false)
vim.api.nvim_win_set_option(0, 'signcolumn', 'no')
-- vim.wo.number = false
-- vim.wo.signcolumn = 'no'
vim.cmd('startinsert')
vim.schedule(vim.cmd.startinsert) -- without schedule it lock screen refresh
end
})
--}}}