all repos

gopher.nvim @ 9bf72afc63a9d2061299e9defa6c45d726dfb3be

Minimalistic plugin for Go development
19 files changed, 204 insertions(+), 2 deletions(-)
chore: add demos (#118)

* chore: add dataset for demos

* chore(demos): add demos

* chore: update CONTRIBUTING

* this copefully will fix comments gif
Author: Oleksandr Smirnov ss2316544@gmail.com
Committed by: Oleksandr Smirnov olexsmir@gmail.com
Committed at: 2025-08-30 16:59:50 +0300
Change ID: psypmpxmsyupsqzttwkwkxxqumyxowmm
Parent: c0951c4
M CONTRIBUTING.md

@@ -25,11 +25,15 @@ ```

### Documentation Here we're using [mini.doc](https://github.com/echasnovski/mini.nvim/blob/main/readmes/mini-doc.md) -for generating help files based on [LuaCats](https://luals.github.io/wiki/annotations/) annotations in comments. +for generating vimhelp files based on [LuaCats](https://luals.github.io/wiki/annotations/) annotations in comments. + +For demo gifs in [readme](./README.md) we're using [vhs](https://github.com/charmbracelet/vhs). +All files related to demos live in [/vhs](./vhs) dir. You can generate docs with: ```bash -task docgen +task docgen # generates vimhelp +task vhs:generate # generates demo gifs ``` ### Commit messages
M README.md

@@ -99,6 +99,8 @@ <summary>

<b>Add and remove tags for structs via <a href="https://github.com/fatih/gomodifytags">gomodifytags</a></b> </summary> + ![Add tags demo](./vhs/tags.gif) + By default `json` tag will be added/removed, if not set: ```vim

@@ -176,6 +178,8 @@ <summary>

<b>Interface implementation via <a href="https://github.com/josharian/impl">impl<a></b> </summary> + ![Auto interface implementation demo](./vhs/impl.gif) + Syntax of the command: ```vim :GoImpl [receiver] [interface]

@@ -199,6 +203,8 @@ <summary>

<b>Generate boilerplate for doc comments</b> </summary> + ![Generate comments](./vhs/comment.gif) + First set a cursor on **public** package/function/interface/struct and execute: ```vim

@@ -211,6 +217,8 @@ <details>

<summary> <b>Generate <code>if err != nil {</code> via <a href="https://github.com/koron/iferr">iferr</a></b> </summary> + + ![Generate if err != nil {](./vhs/iferr.gif) Set the cursor on the line with `err` and execute
M Taskfile.yml

@@ -1,4 +1,10 @@

version: "3" + +includes: + vhs: + taskfile: ./vhs/Taskfile.yml + dir: ./vhs + tasks: lint: cmds:
M scripts/minimal_init.lua

@@ -23,6 +23,7 @@

install_plug "nvim-lua/plenary.nvim" install_plug "nvim-treesitter/nvim-treesitter" install_plug "echasnovski/mini.doc" -- used for docs generation +install_plug "folke/tokyonight.nvim" -- theme for generating demos install_plug "echasnovski/mini.test" vim.env.XDG_CONFIG_HOME = root ".tests/config"

@@ -32,6 +33,8 @@ vim.env.XDG_CACHE_HOME = root ".tests/cache"

vim.opt.runtimepath:append(root()) vim.opt.packpath:append(root ".tests/site") +vim.o.swapfile = false +vim.o.writebackup = false vim.notify = vim.print -- install go treesitter parse

@@ -51,6 +54,13 @@ return vim.fn.globpath("spec", "**/*_test.lua", true, true)

end, }, } +end + +-- set colorscheme only when running ui +if #vim.api.nvim_list_uis() == 1 then + vim.cmd.colorscheme "tokyonight-night" + vim.o.cursorline = true + vim.o.number = true end -- needed for tests, i dont know the reason why, but on start
A vhs/Taskfile.yml

@@ -0,0 +1,20 @@

+version: "3" +tasks: + generate: + deps: + - comment + - iferr + - tags + - impl + + comment: + cmd: vhs comment.tape + + iferr: + cmd: vhs iferr.tape + + tags: + cmd: vhs tags.tape + + impl: + cmd: vhs impl.tape
A vhs/comment.gif

Not showing binary file.

A vhs/comment.go

@@ -0,0 +1,7 @@

+package demos + +func doSomethingImportant() {} + +type User struct{} + +type DataProvider interface{}
A vhs/comment.tape

@@ -0,0 +1,34 @@

+Output comment.gif +Require nvim + +Set FontFamily "JetBrains Mono" +Set Height 800 +Set Width 1500 +Set Padding 20 +Set Shell "bash" +Set Theme "tokyonight" +Set TypingSpeed 250ms + +Hide +Type@0ms "alias nvim='./nvim.sh'" Enter +Type@0ms "clear" Enter +Show + +Type "nvim comment.go" Sleep 150ms Enter + +# package +Type ":GoCmt" Enter Sleep 500ms Escape Sleep 700ms + +# func +Type "3j" +Type ":GoCmt" Enter Sleep 500ms Escape Sleep 700ms + +# struct +Type "3j" +Type ":GoCmt" Enter Sleep 500ms Escape Sleep 700ms + +# interface +Type "3j" +Type ":GoCmt" Enter Sleep 500ms Escape Sleep 700ms + +Sleep 5s
A vhs/go.mod

@@ -0,0 +1,3 @@

+module demos + +go 1.25.0
A vhs/iferr.gif

Not showing binary file.

A vhs/iferr.go

@@ -0,0 +1,11 @@

+package demos + +func ifErr() { + out, err := doSomething() + + _ = out +} + +func doSomething() (string, error) { + return "", nil +}
A vhs/iferr.tape

@@ -0,0 +1,23 @@

+Output iferr.gif +Require nvim +Require iferr + +Set FontFamily "JetBrains Mono" +Set Height 800 +Set Width 1500 +Set Padding 20 +Set Shell "bash" +Set Theme "tokyonight" +Set TypingSpeed 250ms + +Hide +Type@0ms "alias nvim='./nvim.sh'" Enter +Type@0ms "clear" Enter +Show + +Type "nvim iferr.go" Sleep 150ms Enter + +Type "3j" +Type ":GoIfErr" Sleep 500ms Enter + +Sleep 5s
A vhs/impl.gif

Not showing binary file.

A vhs/impl.go

@@ -0,0 +1,3 @@

+package demos + +type CloserExample struct{}
A vhs/impl.tape

@@ -0,0 +1,23 @@

+Output impl.gif +Require nvim +Require iferr + +Set FontFamily "JetBrains Mono" +Set Height 800 +Set Width 1500 +Set Padding 20 +Set Shell "bash" +Set Theme "tokyonight" +Set TypingSpeed 250ms + +Hide +Type@0ms "alias nvim='./nvim.sh'" Enter +Type@0ms "clear" Enter +Show + +Type "nvim impl.go" Sleep 150ms Enter + +Type "2j" +Type ":GoImpl io.Reader" Sleep 500ms Enter + +Sleep 5s
A vhs/nvim.sh

@@ -0,0 +1,2 @@

+#!/usr/bin/env bash +nvim --clean -u "../scripts/minimal_init.lua" $@
A vhs/tags.gif

Not showing binary file.

A vhs/tags.go

@@ -0,0 +1,12 @@

+package demos + +type AddTagsToMe struct { + Name string + ID int + Address string + Aliases []string + Nested struct { + Foo string + Bar float32 + } +}
A vhs/tags.tape

@@ -0,0 +1,36 @@

+Output tags.gif +Require nvim +Require gomodifytags + +Set FontFamily "JetBrains Mono" +Set Height 800 +Set Width 1500 +Set Padding 20 +Set Shell "bash" +Set Theme "tokyonight" +Set TypingSpeed 250ms + +Hide +Type@0ms "alias nvim='./nvim.sh'" Enter +Type@0ms "clear" Enter +Show + +Type "nvim tags.go" Sleep 150ms Enter + +Type "3j" +Type ":GoTagAdd json yaml" Sleep 500ms Enter +Type@120ms ":w" Enter +Sleep 1s + +Type ":GoTagRm json" Sleep 500ms Enter +Type@120ms ":w" Enter +Sleep 1s + +Type ":GoTagClear" Sleep 500ms Enter +Type@120ms ":w" Enter +Sleep 1s + +Type "jV2j" +Type ":GoTagAdd xml" Sleep 500ms Enter + +Sleep 5s