mirror of
https://github.com/jesseduffield/lazygit.git
synced 2024-12-04 10:34:55 +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,
|
||||
Description: self.c.Tr.CreateWorktree,
|
||||
},
|
||||
{
|
||||
Key: opts.GetKey(opts.Config.Universal.OpenFile),
|
||||
Handler: self.checkSelected(self.open),
|
||||
Description: self.c.Tr.OpenInEditor,
|
||||
},
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
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 {
|
||||
return func() error {
|
||||
worktree := self.context().GetSelected()
|
||||
|
@ -156,6 +156,7 @@ type TranslationSet struct {
|
||||
GitconfigParseErr string
|
||||
EditFile string
|
||||
OpenFile string
|
||||
OpenInEditor string
|
||||
IgnoreFile string
|
||||
ExcludeFile 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.`,
|
||||
EditFile: `Edit file`,
|
||||
OpenFile: `Open file`,
|
||||
OpenInEditor: "Open in editor",
|
||||
IgnoreFile: `Add to .gitignore`,
|
||||
ExcludeFile: `Add to .git/info/exclude`,
|
||||
RefreshFiles: `Refresh files`,
|
||||
|
Loading…
Reference in New Issue
Block a user