1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-01-04 03:48:07 +02:00

add vscode keybinding

This commit is contained in:
Jesse Duffield 2018-08-06 13:49:15 +10:00
parent 6126ddd373
commit 9a3b565806
3 changed files with 12 additions and 3 deletions

View File

@ -180,8 +180,10 @@ func genericFileOpen(g *gocui.Gui, v *gocui.View, open func(string) (string, err
}
return nil
}
_, err = open(file.Name)
return err
if output, err := open(file.Name); err != nil {
return createErrorPanel(g, output)
}
return nil
}
func handleFileOpen(g *gocui.Gui, v *gocui.View) error {

View File

@ -305,7 +305,11 @@ func runCommand(command string) (string, error) {
splitCmd := strings.Split(command, " ")
cmdOut, err := exec.Command(splitCmd[0], splitCmd[1:]...).CombinedOutput()
devLog("run command time: ", time.Now().Sub(commandStartTime))
return string(cmdOut), err
outputString := string(cmdOut)
if outputString == "" && err != nil {
return err.Error(), err
}
return outputString, err
}
func openFile(filename string) (string, error) {

3
gui.go
View File

@ -124,6 +124,9 @@ func keybindings(g *gocui.Gui) error {
if err := g.SetKeybinding("files", 's', gocui.ModNone, handleSublimeFileOpen); err != nil {
return err
}
if err := g.SetKeybinding("files", 'v', gocui.ModNone, handleVsCodeFileOpen); err != nil {
return err
}
if err := g.SetKeybinding("files", 'i', gocui.ModNone, handleIgnoreFile); err != nil {
return err
}