File tree Expand file tree Collapse file tree 4 files changed +25
-2
lines changed
lua/neo-tree/sources/git_status Expand file tree Collapse file tree 4 files changed +25
-2
lines changed Original file line number Diff line number Diff line change 6464 [" ga" ] = " git_add_file" ,
6565 [" gr" ] = " git_revert_file" ,
6666 [" gc" ] = " git_commit"
67+ [" gp" ] = " git_push" ,
68+ [" gg" ] = " git_commit_and_push" ,
6769 }
6870 }
6971 }
Original file line number Diff line number Diff line change @@ -367,5 +367,7 @@ specific commands:
367367 ["gu"] = "git_unstage_file",
368368 ["gr"] = "git_revert_file",
369369 ["gc"] = "git_commit"
370+ ["gp"] = "git_push",
371+ ["gg"] = "git_commit_and_push",
370372
371373vim:tw=80:ts=2:et:ft=help:
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ M.git_add_all = function (state)
2323 gs .refresh ()
2424end
2525
26- M .git_commit = function (state )
26+ M .git_commit = function (state , and_push )
2727 local width = vim .fn .winwidth (0 ) - 2
2828 local row = vim .api .nvim_win_get_height (0 ) - 3
2929 local popup_options = {
@@ -38,12 +38,29 @@ M.git_commit = function (state)
3838 inputs .input (" Commit message: " , " " , function (msg )
3939 msg = msg :gsub (' "' , " '" )
4040 local cmd = " git commit -m \" " .. msg .. " \" "
41+ if and_push then
42+ cmd = cmd .. " && git push"
43+ end
4144 local result = vim .fn .systemlist (cmd )
4245 gs .refresh ()
4346 popups .alert (" Commit Results" , result )
4447 end , popup_options )
4548end
4649
50+ M .git_commit_and_push = function (state )
51+ M .git_commit (state , true )
52+ end
53+
54+ M .git_push = function (state )
55+ inputs .confirm (" Are you sure you want to push your changes?" , function (yes )
56+ if yes then
57+ local result = vim .fn .systemlist (" git push" )
58+ gs .refresh ()
59+ popups .alert (" Git Push" , result )
60+ end
61+ end )
62+ end
63+
4764M .git_unstage_file = function (state )
4865 local node = state .tree :get_node ()
4966 local path = node :get_id ()
Original file line number Diff line number Diff line change @@ -24,7 +24,9 @@ local filesystem = {
2424 [" gu" ] = " git_unstage_file" ,
2525 [" ga" ] = " git_add_file" ,
2626 [" gr" ] = " git_revert_file" ,
27- [" gc" ] = " git_commit"
27+ [" gc" ] = " git_commit" ,
28+ [" gp" ] = " git_push" ,
29+ [" gg" ] = " git_commit_and_push" ,
2830 }
2931 },
3032 before_render = function (state )
You can’t perform that action at this time.
0 commit comments