|
| 1 | +# setup-vim |
| 2 | + |
| 3 | +[![Test][test-ci-badge]][test-ci-action] |
| 4 | +[![Lint][lint-ci-badge]][lint-ci-action] |
| 5 | + |
| 6 | +`setup-vim` is a GitHub Action to setup [Vim][vim], [Neovim][neovim], or [MacVim][macvim]. |
| 7 | + |
| 8 | + |
| 9 | +## Usage |
| 10 | + |
| 11 | +Basic: |
| 12 | + |
| 13 | +```yaml |
| 14 | +# Setup the head version of Vim |
| 15 | +- uses: thinca/action-setup-vim@v3 |
| 16 | +``` |
| 17 | +
|
| 18 | +With options: |
| 19 | +
|
| 20 | +```yaml |
| 21 | +- uses: thinca/action-setup-vim@v3 |
| 22 | + with: |
| 23 | + vim_version: v9.1.0000 |
| 24 | +``` |
| 25 | +
|
| 26 | +Setup Vim and Neovim with 2 versions for each platforms using matrix: |
| 27 | +
|
| 28 | +```yaml |
| 29 | +strategy: |
| 30 | + matrix: |
| 31 | + vim_type: ['Vim', 'Neovim'] |
| 32 | + version: ['head', 'stable'] |
| 33 | + os: ['ubuntu-latest', 'macos-latest', 'windows-latest'] |
| 34 | + include: |
| 35 | + - vim_type: 'Vim' |
| 36 | + version: 'stable' |
| 37 | + vim_version: 'v9.1.0000' |
| 38 | +runs-on: '${{ matrix.os }}' |
| 39 | +steps: |
| 40 | + - uses: 'actions/checkout@v4' |
| 41 | + - name: 'Setup Vim' |
| 42 | + id: 'vim' |
| 43 | + uses: 'thinca/action-setup-vim@v3' |
| 44 | + with: |
| 45 | + vim_version: '${{ matrix.vim_version || matrix.version }}' |
| 46 | + vim_type: '${{ matrix.vim_type }}' |
| 47 | + - name: 'Run test' |
| 48 | + run: | |
| 49 | + # Show Vim's version |
| 50 | + ${{ steps.vim.outputs.executable }} --version |
| 51 | + # ... run tests ... |
| 52 | +``` |
| 53 | +
|
| 54 | +
|
| 55 | +### About installation |
| 56 | +
|
| 57 | +This action provides two ways to setup Vim. |
| 58 | +
|
| 59 | +1. Build Vim from source code. |
| 60 | + You can specify Git's ref(tag, branch, or sha1) for [`vim_version`](#vim_version). |
| 61 | + The result is cached by default. See [`cache`](#cache) input. |
| 62 | + |
| 63 | +2. Download pre-built Vim from releases page. |
| 64 | + You can specify semver(v9.1.0146, v0.9.5) or tag name of GitHub Release for [`vim_version`](#vim_version). |
| 65 | + |
| 66 | +Some combinations not available. See the following. |
| 67 | +By default, uses `download` if available, otherwise uses `build`. |
| 68 | + |
| 69 | + |
| 70 | +#### Vim |
| 71 | + |
| 72 | +| OS | way | GUI | Installation | |
| 73 | +| ------- | ---------- | ------ | ------------------------------------------------------------------ | |
| 74 | +| Linux | `build` | `gvim` | Sources from [vim/vim][vim]. | |
| 75 | +| Linux | `download` | `gvim` | Releases from [vim/vim-appimage][appimage-releases]. (*) | |
| 76 | +| MacOS | `build` | `gvim` | Sources from [vim/vim][vim]. | |
| 77 | +| MacOS | `download` | N/A | Not available. | |
| 78 | +| Windows | `build` | `gvim` | Sources from [vim/vim][vim]. | |
| 79 | +| Windows | `download` | `gvim` | Releases from [vim/vim-win32-installer][win32-installer-releases]. | |
| 80 | + |
| 81 | +(*) Downloading Vim from AppImage is available from v8.1.1239. Before v8.1.1234 cannot start vim. This was fixed by [vim/vim-appimage#6](https://github.com/vim/vim-appimage/pull/6). |
| 82 | + |
| 83 | + |
| 84 | +#### Neovim |
| 85 | + |
| 86 | +| OS | way | GUI | Installation | |
| 87 | +| ------- | ---------- | ------------- | ----------------------------------------------- | |
| 88 | +| Linux | `build` | N/A | Sources from [neovim/neovim][neovim]. | |
| 89 | +| Linux | `download` | N/A | Releases from [neovim/neovim][neovim-releases]. | |
| 90 | +| MacOS | `build` | N/A | Sources from [neovim/neovim][neovim]. (**) | |
| 91 | +| MacOS | `download` | N/A | Releases from [neovim/neovim][neovim-releases]. | |
| 92 | +| Windows | `build` | N/A | Not available(Help wanted). | |
| 93 | +| Windows | `download` | `nvim-qt.exe` | Releases from [neovim/neovim][neovim-releases]. | |
| 94 | + |
| 95 | +(**) Building Neovim on MacOS(Catalina) has a problem. |
| 96 | + |
| 97 | +Building v0.4.3 and before versions will be failure. |
| 98 | +See [neovim/neovim#11412](https://github.com/neovim/neovim/pull/11412) for the detail. |
| 99 | + |
| 100 | + |
| 101 | +#### MacVim |
| 102 | + |
| 103 | +| OS | way | GUI | Installation | |
| 104 | +| ------- | ---------- | --- | --------------------------------------------------- | |
| 105 | +| Linux | `build` | N/A | Not available. | |
| 106 | +| Linux | `download` | N/A | Not available. | |
| 107 | +| MacOS | `build` | N/A | Sources from [macvim-dev/macvim][macvim]. | |
| 108 | +| MacOS | `download` | N/A | Releases from [macvim-dev/macvim][macvim-releases]. | |
| 109 | +| Windows | `build` | N/A | Not available. | |
| 110 | +| Windows | `download` | N/A | Not available. | |
| 111 | + |
| 112 | +MacVim has a GUI version, but it is not supported yet because it is too difficult treating on CI. |
| 113 | + |
| 114 | +Building snapshot-157 and before versions will be failure. |
| 115 | +See [macvim-dev/macvim#946](https://github.com/macvim-dev/macvim/issues/946) for the detail. |
| 116 | + |
| 117 | + |
| 118 | +### Action Inputs |
| 119 | + |
| 120 | +#### `vim_version` |
| 121 | + |
| 122 | +Version of Vim. |
| 123 | +The meaning of this value depends on `vim_type` and `download`. |
| 124 | + |
| 125 | +The value `head` is always head version: |
| 126 | +When `download` is on, this points head of release. |
| 127 | +When `download` is off, this points master of repository. |
| 128 | + |
| 129 | +When `download` is on and specified a semver such as `v8.2.0000`, this action finds a minimum version that is higher than a specified version. |
| 130 | +For example, when there are some released versions: `v8.2.0052` `v8.2.0057` `v8.2.0065` |
| 131 | +And when a specified version is `v8.2.0055`, `v8.2.0057` is actually selected. |
| 132 | +Also, when a specified version is `v8.2.0060`, `v8.2.0065` is actually selected. |
| 133 | + |
| 134 | +When `download` is off, this is a tag of repository. |
| 135 | +Note that the repository of MacVim has tags like `release-xxx` instead of like `vx.x.xxx`. |
| 136 | + |
| 137 | +default: `head` |
| 138 | + |
| 139 | + |
| 140 | +#### `vim_type` |
| 141 | + |
| 142 | +Type of Vim. |
| 143 | +This is one of `vim`, `neovim`, or `macvim`. |
| 144 | + |
| 145 | +default: `vim` |
| 146 | + |
| 147 | + |
| 148 | +#### `gui` |
| 149 | + |
| 150 | +When this is `yes`, setups the GUI version. |
| 151 | +And `outputs.executable` points to GUI version of Vim. |
| 152 | + |
| 153 | +default: `no` |
| 154 | + |
| 155 | + |
| 156 | +#### `arch` |
| 157 | + |
| 158 | +Architecture of Vim. |
| 159 | +This is either of `x86_64` or `x86`, enable when `vim_type` is `vim` on Windows. |
| 160 | + |
| 161 | +default: `x86_64` |
| 162 | + |
| 163 | + |
| 164 | +#### `download` |
| 165 | + |
| 166 | +When this is `always`, downloads the officially released binary, or fail if unavailable. |
| 167 | +When this is `available`, downloads the officially released binary if available, otherwise builds from source code. |
| 168 | +When this is `never`, always builds from source code. |
| 169 | + |
| 170 | +default: `available` |
| 171 | + |
| 172 | + |
| 173 | +#### `cache` |
| 174 | + |
| 175 | +When this is `true`(default), cache the built Vim. |
| 176 | + |
| 177 | +This uses same caching mechanism from [actions/cache][actions/cache]. |
| 178 | +Therefore, this consumes the limitation of cache size. |
| 179 | + |
| 180 | +Ref: [Caching dependencies to speed up workflows#Usage limits and eviction policy][caching-policy] |
| 181 | + |
| 182 | +This is automatically disabled when `download` is on. |
| 183 | + |
| 184 | +default: `true` |
| 185 | + |
| 186 | + |
| 187 | +#### `github_token` |
| 188 | + |
| 189 | +Your GitHub API token to access to releases of repositories without limit. |
| 190 | +Normally this is automatically set so you do not need set this. |
| 191 | + |
| 192 | +default: `${{ github.token }}` |
| 193 | + |
| 194 | + |
| 195 | +### Action Outputs |
| 196 | + |
| 197 | +#### `executable` |
| 198 | + |
| 199 | +The name of executable file. |
| 200 | +This is not a full path, just name. |
| 201 | +When `gui` is yes, this points to GUI version. |
| 202 | +e.g. `vim` `nvim` `gvim` |
| 203 | + |
| 204 | + |
| 205 | +#### `executable_path` |
| 206 | + |
| 207 | +The full path of executable file. |
| 208 | + |
| 209 | + |
| 210 | +#### `actual_vim_version` |
| 211 | + |
| 212 | +Version of Vim actually installed. |
| 213 | +e.g. `v8.2.0123` `v0.4.3` `49cd750d6a72efc0571a89d7a874bbb01081227f` |
| 214 | + |
| 215 | + |
| 216 | +#### `install_type` |
| 217 | + |
| 218 | +Install was done with `build` or `download`. |
| 219 | + |
| 220 | + |
| 221 | +#### `install_path` |
| 222 | + |
| 223 | +Base path of installed Vim. |
| 224 | +Note that this does not point to `bin`. |
| 225 | + |
| 226 | + |
| 227 | +#### `cache_hit` |
| 228 | + |
| 229 | +When `cache` is enabled and cache was found, this is `true`. Otherwise this is `false`. |
| 230 | + |
| 231 | + |
| 232 | +## License |
| 233 | + |
| 234 | +[zlib License](LICENSE.txt) |
| 235 | + |
| 236 | + |
| 237 | +## Author |
| 238 | + |
| 239 | + |
| 240 | + |
| 241 | + |
| 242 | +[test-ci-badge]: ./../../workflows/Test/badge.svg |
| 243 | +[test-ci-action]: ./../../actions?query=workflow%3ATest |
| 244 | +[lint-ci-badge]: ./../../workflows/Lint/badge.svg |
| 245 | +[lint-ci-action]: ./../../actions?query=workflow%3ALint |
| 246 | +[vim]: https://github.com/vim/vim |
| 247 | +[neovim]: https://github.com/neovim/neovim |
| 248 | +[macvim]: https://github.com/macvim-dev/macvim |
| 249 | +[appimage-releases]: https://github.com/vim/vim-appimage/releases |
| 250 | +[win32-installer-releases]: https://github.com/vim/vim-win32-installer/releases |
| 251 | +[neovim-releases]: https://github.com/neovim/neovim/releases |
| 252 | +[macvim-releases]: https://github.com/macvim-dev/macvim/releases |
| 253 | +[actions/cache]: https://github.com/actions/cache |
| 254 | +[caching-policy]: https://help.github.com/en/actions/automating-your-workflow-with-github-actions/caching-dependencies-to-speed-up-workflows#usage-limits-and-eviction-policy |
0 commit comments