Skip to content

Commit ca4b0dd

Browse files
committed
fix(#388): fix incompatibility with old setups
1 parent 16dd197 commit ca4b0dd

File tree

6 files changed

+30
-38
lines changed

6 files changed

+30
-38
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ Enable live blame annotations directly in your editor to see the author and comm
102102
> Releases prior to the major versions will no longer be maintained.
103103
> Branch `v1.0.x` contains several new features and massive optimizations but unfortunately also contains several breaking and deprecated changes.
104104
> For the time being the main branch will still be following `v0.2.x` while core users slowly migrate to `v1.0.x` without breaking their current workflow.
105-
> New users please use tag `v1.0.3` or branch `v1.0.x` for the latest changes!
105+
> New users please use tag `v1.0.4` or branch `v1.0.x` for the latest changes!
106106
107107
---
108108

@@ -111,7 +111,7 @@ Using [packer.nvim](https://github.com/wbthomason/packer.nvim)
111111
```lua
112112
use {
113113
'tanvirtin/vgit.nvim', branch = 'v1.0.x',
114-
-- or , tag = 'v1.0.3',
114+
-- or , tag = 'v1.0.4',
115115
requires = { 'nvim-lua/plenary.nvim', 'nvim-tree/nvim-web-devicons' },
116116
-- Lazy loading on 'VimEnter' event is necessary.
117117
event = 'VimEnter',
@@ -124,7 +124,7 @@ Using [lazy.nvim](https://github.com/folke/lazy.nvim)
124124
```lua
125125
{
126126
'tanvirtin/vgit.nvim', branch = 'v1.0.x',
127-
-- or , tag = 'v1.0.3',
127+
-- or , tag = 'v1.0.4',
128128
dependencies = { 'nvim-lua/plenary.nvim', 'nvim-tree/nvim-web-devicons' },
129129
-- Lazy loading on 'VimEnter' event is necessary.
130130
event = 'VimEnter',

lua/vgit/features/screens/DiffScreen/init.lua

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,16 @@ function DiffScreen:create_app_bar_view(scene, model)
5151
local keymaps = diff_preview_setting:get('keymaps')
5252
if model:is_staged() then
5353
return {
54-
{ keymaps['buffer_unstage'] },
55-
{ keymaps['buffer_hunk_unstage'] },
56-
{ 'Switch to Staged View', keymaps['toggle_view'] },
54+
{ 'Unstage', keymaps['buffer_unstage'] },
55+
{ 'Unstage hunk', keymaps['buffer_hunk_unstage'] },
56+
{ 'Switch to Staged View', keymaps['toggle_view'] },
5757
}
5858
end
5959
return {
60-
{ keymaps['buffer_stage'] },
61-
{ keymaps['buffer_hunk_stage'] },
62-
{ keymaps['reset'] },
63-
{ 'Switch to Unstage View', keymaps['toggle_view'] },
60+
{ 'Stage', keymaps['buffer_stage'] },
61+
{ 'Stage hunk', keymaps['buffer_hunk_stage'] },
62+
{ 'Reset', keymaps['reset'] },
63+
{ 'Switch to Unstage View', keymaps['toggle_view'] },
6464
}
6565
end,
6666
})

lua/vgit/features/screens/ProjectCommitScreen/init.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function ProjectCommitScreen:constructor(opts)
2121
app_bar_view = KeyHelpBarView(scene, {
2222
keymaps = function()
2323
local keymaps = project_commit_preview_setting:get('keymaps')
24-
return { { keymaps['save'] } }
24+
return { { 'Save commit', keymaps['save'] } }
2525
end,
2626
}),
2727
view = SimpleView(scene, {

lua/vgit/features/screens/ProjectDiffScreen/init.lua

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ function ProjectDiffScreen:constructor(opts)
2828
keymaps = function()
2929
local keymaps = project_diff_preview_setting:get('keymaps')
3030
return {
31-
{ keymaps['buffer_stage'] },
32-
{ keymaps['buffer_unstage'] },
33-
{ keymaps['buffer_reset'] },
34-
{ keymaps['buffer_hunk_stage'] },
35-
{ keymaps['buffer_hunk_unstage'] },
36-
{ keymaps['stage_all'] },
37-
{ keymaps['unstage_all'] },
38-
{ keymaps['reset_all'] },
39-
{ keymaps['commit'] },
31+
{ 'Stage', keymaps['buffer_stage'] },
32+
{ 'Unstage', keymaps['buffer_unstage'] },
33+
{ 'Reset', keymaps['buffer_reset'] },
34+
{ 'Stage hunk', keymaps['buffer_hunk_stage'] },
35+
{ 'Unstage hunk', keymaps['buffer_hunk_unstage'] },
36+
{ 'Stage all', keymaps['stage_all'] },
37+
{ 'Unstage all', keymaps['unstage_all'] },
38+
{ 'Reset all', keymaps['reset_all'] },
39+
{ 'Commit', keymaps['commit'] },
4040
}
4141
end,
4242
}),

lua/vgit/features/screens/ProjectStashScreen/init.lua

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ function ProjectStashScreen:constructor(opts)
2525
keymaps = function()
2626
local keymaps = project_stash_preview_setting:get('keymaps')
2727
return {
28-
{ keymaps['add'] },
29-
{ keymaps['apply'] },
30-
{ keymaps['pop'] },
31-
{ keymaps['drop'] },
32-
{ keymaps['clear'] },
28+
{ 'Add stash', keymaps['add'] },
29+
{ 'Apply stash', keymaps['apply'] },
30+
{ 'Pop stash', keymaps['pop'] },
31+
{ 'Drop stash', keymaps['drop'] },
32+
{ 'Clear stash', keymaps['clear'] },
3333
}
3434
end,
3535
}),

lua/vgit/ui/views/KeyHelpBarView.lua

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,12 @@ function KeyHelpBarView:render_help_text(component)
4242
local key
4343
local desc
4444

45-
if #keymap == 1 then
46-
local config = keymap[1]
47-
key = config.key
48-
desc = config.desc
45+
if type(keymap[2]) == 'table' then
46+
key = keymap[2].key
47+
desc = keymap[2].desc
4948
else
50-
if keymap[2] == 'table' then
51-
local config = keymap[1]
52-
key = config.key
53-
desc = keymap[1]
54-
else
55-
local config = keymap[2]
56-
key = config
57-
desc = keymap[1]
58-
end
49+
key = keymap[2]
50+
desc = keymap[1]
5951
end
6052

6153
text = i == 1 and string.format('%s (%s)', desc, key) or string.format('%s | %s (%s)', text, desc, key)

0 commit comments

Comments
 (0)