Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mac vim excess characters bug fix #138

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Keybinding | Description
<kbd>Ctrl+C</kbd> | Quit
<kbd>Ctrl+K</kbd>, <kbd>Shift+Tab</kbd> | Previous view
<kbd>Ctlr+J</kbd>, <kbd>Tab</kbd> | Next view
<kbd>Ctrl+O</kbd> | Open view in text editor
<kbd>Ctlr+T</kbd> | Toggle context specific search
<kbd>Alt+H</kbd> | Toggle history
<kbd>Down</kbd> | Move down one view line
Expand Down
11 changes: 10 additions & 1 deletion commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@ import (
"io/ioutil"
"os"
"os/exec"
"runtime"
"strings"
"unicode"

"github.com/jroimartin/gocui"
"github.com/nsf/termbox-go"
)

const MAC_OS = "darwin"

type CommandFunc func(*gocui.Gui, *gocui.View) error

var COMMANDS map[string]func(string, *App) CommandFunc = map[string]func(string, *App) CommandFunc{
Expand Down Expand Up @@ -236,7 +239,13 @@ func openEditor(g *gocui.Gui, v *gocui.View, editor string) error {
return nil
}

cmd := exec.Command(editor, file.Name())
var cmd *exec.Cmd
// Some .vimrc files might not play nice. To play it safe, don't use them.
if editor == "vim" && runtime.GOOS == MAC_OS {
cmd = exec.Command(editor, "-u", "NONE", file.Name())
} else {
cmd = exec.Command(editor, file.Name())
}
cmd.Stdout = os.Stdout
cmd.Stdin = os.Stdin
cmd.Stderr = os.Stderr
Expand Down
3 changes: 3 additions & 0 deletions wuzz.go
Original file line number Diff line number Diff line change
Expand Up @@ -1845,6 +1845,9 @@ func main() {
fmt.Printf("wuzz %v\n", VERSION)
return
case "-c", "--config":
if i+1 >= len(os.Args) {
log.Fatal("Expected file after -c")
}
configPath = os.Args[i+1]
args = append(os.Args[:i], os.Args[i+2:]...)
if _, err := os.Stat(configPath); os.IsNotExist(err) {
Expand Down