Fix #4 terminal borked when piping content with Vim

pull/15/head
Mickaël Menu 3 years ago
parent c58e68e0e2
commit ec574ff519
No known key found for this signature in database
GPG Key ID: 53D73664CD359895

@ -16,6 +16,10 @@ All notable changes to this project will be documented in this file.
* By setting `ZK_NOTEBOOK_DIR` in your shell configuration file (e.g. `~/.profile`), you are declaring a default global notebook which will be used when `zk` is not in a notebook.
* When the notebook directory is set explicitly, any path given as argument will be relative to it instead of the actual working directory.
### Fixed
* [#4](https://github.com/mickael-menu/zk/issues/4) Terminal borked when piping content with Vim
## 0.2.1

@ -20,7 +20,11 @@ func Edit(zk *zk.Zk, paths ...string) error {
return fmt.Errorf("no editor set in config")
}
cmd := executil.CommandFromString(editor.String() + " " + shellquote.Join(paths...))
// /dev/tty is restored as stdin, in case the user used a pipe to feed
// initial note content to `zk new`. Without this, Vim doesn't work
// properly in this case.
// See https://github.com/mickael-menu/zk/issues/4
cmd := executil.CommandFromString(editor.String() + " " + shellquote.Join(paths...) + " </dev/tty")
cmd.Stdin = os.Stdin
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr

Loading…
Cancel
Save