Skip to content

Commit

Permalink
Use nvim and default to vi
Browse files Browse the repository at this point in the history
  • Loading branch information
RasmusLindroth committed Mar 24, 2020
1 parent 3fe51ab commit 25ab273
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,31 @@ Explanation of the non obvious keys when viewing a toot
* `O` = open. Gives you a list of all URLs in the toot. Opens them in your default browser.
* `M` = media. Opens the media with `xdg-open`.

### Install instructions
If you don't use the binary that you find under releases
you will need Go. Use a newer one that supports modules.

```bash
# First clone this repository
git clone https://github.com/RasmusLindroth/tut.git

# Go to that folder
cd tut

# Build or install

# Install (usally /home/user/go/bin)
go install

#Build (same directory i.e. ./ )
go build
```

If you choose to install and want to be able to just run `tut`
you will have to add `go/bin` to your `$PATH`.



### On my TODO-list:
* Support for config files (theme, default image/video viewer)
* Multiple accounts
Expand Down
6 changes: 5 additions & 1 deletion util.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ func cleanTootHTML(content string) (string, []URL) {
}

func openEditor(app *tview.Application, content string) (string, error) {
editor, exists := os.LookupEnv("EDITOR")
if !exists || editor == "" {
editor = "vi"
}
f, err := ioutil.TempFile("", "tut")
if err != nil {
return "", err
Expand All @@ -72,7 +76,7 @@ func openEditor(app *tview.Application, content string) (string, error) {
return "", err
}
}
cmd := exec.Command("nvim", f.Name())
cmd := exec.Command(editor, f.Name())
cmd.Stdin = os.Stdin
cmd.Stdout = os.Stdout
var text []byte
Expand Down

0 comments on commit 25ab273

Please sign in to comment.