mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-27 23:08:02 +02:00
Allow opening worktree in editor
This does the job but I think we need yet another editor command for opening a directory in a new window.
This commit is contained in:
parent
2e68967e02
commit
87b2455dbb
@ -44,6 +44,11 @@ func (self *WorktreesController) GetKeybindings(opts types.KeybindingsOpts) []*t
|
|||||||
Handler: self.add,
|
Handler: self.add,
|
||||||
Description: self.c.Tr.CreateWorktree,
|
Description: self.c.Tr.CreateWorktree,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Key: opts.GetKey(opts.Config.Universal.OpenFile),
|
||||||
|
Handler: self.checkSelected(self.open),
|
||||||
|
Description: self.c.Tr.OpenInEditor,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
return bindings
|
return bindings
|
||||||
@ -110,6 +115,10 @@ func (self *WorktreesController) enter(worktree *models.Worktree) error {
|
|||||||
return self.c.Helpers().Worktree.Switch(worktree.Path, context.WORKTREES_CONTEXT_KEY)
|
return self.c.Helpers().Worktree.Switch(worktree.Path, context.WORKTREES_CONTEXT_KEY)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (self *WorktreesController) open(worktree *models.Worktree) error {
|
||||||
|
return self.c.Helpers().Files.OpenFile(worktree.Path)
|
||||||
|
}
|
||||||
|
|
||||||
func (self *WorktreesController) checkSelected(callback func(worktree *models.Worktree) error) func() error {
|
func (self *WorktreesController) checkSelected(callback func(worktree *models.Worktree) error) func() error {
|
||||||
return func() error {
|
return func() error {
|
||||||
worktree := self.context().GetSelected()
|
worktree := self.context().GetSelected()
|
||||||
|
@ -156,6 +156,7 @@ type TranslationSet struct {
|
|||||||
GitconfigParseErr string
|
GitconfigParseErr string
|
||||||
EditFile string
|
EditFile string
|
||||||
OpenFile string
|
OpenFile string
|
||||||
|
OpenInEditor string
|
||||||
IgnoreFile string
|
IgnoreFile string
|
||||||
ExcludeFile string
|
ExcludeFile string
|
||||||
RefreshFiles string
|
RefreshFiles string
|
||||||
@ -881,6 +882,7 @@ func EnglishTranslationSet() TranslationSet {
|
|||||||
GitconfigParseErr: `Gogit failed to parse your gitconfig file due to the presence of unquoted '\' characters. Removing these should fix the issue.`,
|
GitconfigParseErr: `Gogit failed to parse your gitconfig file due to the presence of unquoted '\' characters. Removing these should fix the issue.`,
|
||||||
EditFile: `Edit file`,
|
EditFile: `Edit file`,
|
||||||
OpenFile: `Open file`,
|
OpenFile: `Open file`,
|
||||||
|
OpenInEditor: "Open in editor",
|
||||||
IgnoreFile: `Add to .gitignore`,
|
IgnoreFile: `Add to .gitignore`,
|
||||||
ExcludeFile: `Add to .git/info/exclude`,
|
ExcludeFile: `Add to .git/info/exclude`,
|
||||||
RefreshFiles: `Refresh files`,
|
RefreshFiles: `Refresh files`,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user