Compare commits
2 Commits
cf5425bec3
...
0578a3dede
Author | SHA1 | Date | |
---|---|---|---|
0578a3dede | |||
19c453974f |
@ -191,7 +191,10 @@ local function spec(use)
|
||||
"TimUntersberger/neogit",
|
||||
requires = {
|
||||
{ "nvim-lua/plenary.nvim" },
|
||||
}
|
||||
},
|
||||
config = function ()
|
||||
require("valeth.packer.neogit")
|
||||
end
|
||||
}
|
||||
|
||||
|
||||
|
14
lua/valeth/packer/neogit.lua
Normal file
14
lua/valeth/packer/neogit.lua
Normal file
@ -0,0 +1,14 @@
|
||||
local neogit = require("neogit")
|
||||
|
||||
local function git_status()
|
||||
neogit.open()
|
||||
end
|
||||
|
||||
local function git_commit()
|
||||
neogit.open({ "commit" })
|
||||
end
|
||||
|
||||
vim.keymap.set("n", "<Leader>vs", git_status)
|
||||
vim.keymap.set("n", "<Leader>vc", git_commit)
|
||||
|
||||
neogit.setup()
|
@ -10,11 +10,14 @@ local function session_name()
|
||||
end
|
||||
end
|
||||
|
||||
local function started_without_args()
|
||||
return vim.fn.argc(-1) == 0
|
||||
end
|
||||
|
||||
-- Only restore and save session if NeoVim was started without any arguments
|
||||
vim.api.nvim_create_autocmd("VimEnter", {
|
||||
callback = function()
|
||||
local started_without_args = vim.fn.argc(-1) == 0
|
||||
|
||||
if started_without_args then
|
||||
if started_without_args() then
|
||||
resession.load(session_name(), { dir = "dirsession", silence_errors = true })
|
||||
end
|
||||
end
|
||||
@ -22,8 +25,10 @@ vim.api.nvim_create_autocmd("VimEnter", {
|
||||
|
||||
vim.api.nvim_create_autocmd("VimLeavePre", {
|
||||
callback = function()
|
||||
if started_without_args() then
|
||||
resession.save(session_name(), { dir = "dirsession", notify = false })
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
resession.setup()
|
||||
|
Loading…
Reference in New Issue
Block a user