mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-23 07:00:04 +08:00
Add docker spacevim (#2238)
This commit is contained in:
parent
240d839614
commit
00c5192eac
@ -21,6 +21,16 @@ function! SpaceVim#dev#layers#update() abort
|
||||
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#dev#layers#updatedocker() abort
|
||||
let [start, end] = s:find_docker_position()
|
||||
if start != 0 && end != 0
|
||||
if end - start > 1
|
||||
exe (start + 1) . ',' . (end - 1) . 'delete'
|
||||
endif
|
||||
call append(start, s:generate_docker_content())
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! SpaceVim#dev#layers#updateCn() abort
|
||||
|
||||
let [start, end] = s:find_position_cn()
|
||||
@ -40,6 +50,12 @@ function! s:find_position() abort
|
||||
return sort([start, end], 'n')
|
||||
endfunction
|
||||
|
||||
function! s:find_docker_position() abort
|
||||
let start = search('^## -- SpaceVim layer list start$','bwnc')
|
||||
let end = search('^## -- SpaceVim layer list end$','bnwc')
|
||||
return sort([start, end], 'n')
|
||||
endfunction
|
||||
|
||||
function! s:find_position_cn() abort
|
||||
let start = search('^<!-- SpaceVim layer cn list start -->$','bwnc')
|
||||
let end = search('^<!-- SpaceVim layer cn list end -->$','bnwc')
|
||||
@ -58,6 +74,23 @@ function! s:generate_content_cn() abort
|
||||
return content
|
||||
endfunction
|
||||
|
||||
function! s:generate_docker_content() abort
|
||||
let layers = SpaceVim#util#globpath('~/.SpaceVim/', 'docs/cn/layers/**/*.md')
|
||||
let list = [
|
||||
\ ]
|
||||
call remove(layers, index(layers, '/home/wsdjeg/.SpaceVim/docs/cn/layers/index.md'))
|
||||
for layer in layers
|
||||
let name = split(layer, '/docs/cn/layers/')[1][:-4] . '/'
|
||||
if name ==# 'language-server-protocol/'
|
||||
let name = 'lsp'
|
||||
endif
|
||||
let name = join(split(name, '/'), '#')
|
||||
let snippet = ['[[layers]]', ' name = "' . name . '"', '']
|
||||
let list += snippet
|
||||
endfor
|
||||
return list
|
||||
endfunction
|
||||
|
||||
function! s:layer_list() abort
|
||||
let layers = SpaceVim#util#globpath('~/.SpaceVim/', 'docs/layers/**/*.md')
|
||||
let list = [
|
||||
|
@ -47,8 +47,12 @@ RUN mkdir -p $HOME/.config $HOME/.SpaceVim.d
|
||||
|
||||
RUN pip install --user neovim pipenv
|
||||
|
||||
RUN curl https://raw.githubusercontent.com/SpaceVim/SpaceVim/master/docker/init.toml > $HOME/.SpaceVim.d/init.toml
|
||||
|
||||
RUN curl -sLf https://spacevim.org/install.sh | bash
|
||||
|
||||
RUN nvim --headless +'call dein#install()' +qall
|
||||
|
||||
RUN rm $HOME/.SpaceVim.d/init.toml
|
||||
|
||||
ENTRYPOINT /usr/local/bin/nvim
|
||||
|
@ -1,37 +1,41 @@
|
||||
## SpaceVim and Neovim in Docker
|
||||
|
||||
![Docker Build Status](https://img.shields.io/docker/build/spacevim/spacevim.svg)
|
||||
|
||||
This Dockerfile builds neovim `HEAD` and installs the latest available version of SpaceVim. You might want to use this for several reasons:
|
||||
|
||||
* Have a consistent version of Neovim and SpaceVim as long as the machine supports Docker.
|
||||
* Try SpaceVim without modifying your current Vim/Neovim configuration.
|
||||
* Try the latest Neovim with SpaceVim.
|
||||
* Try SpaceVim with a newer version of Python.
|
||||
* Debug SpaceVim configurations. e.g. when posting a bug report if you can reproduce it in this container then there's a higher chance that it is a true bug and not just an issue with your machine.
|
||||
- Have a consistent version of Neovim and SpaceVim as long as the machine supports Docker.
|
||||
- Try SpaceVim without modifying your current Vim/Neovim configuration.
|
||||
- Try the latest Neovim with SpaceVim.
|
||||
- Try SpaceVim with a newer version of Python.
|
||||
- Debug SpaceVim configurations. e.g. when posting a bug report if you can reproduce it in this container then there's a higher chance that it is a true bug and not just an issue with your machine.
|
||||
|
||||
### FAQ
|
||||
|
||||
Isn't Docker stateless? Won't I have to reinstall all plugins each time I launch the container?
|
||||
* During the build we call `dein#install()` so all plugins are installed and frozen. Your custom configurations can be added as an additional build step using the Docker `COPY` command.
|
||||
|
||||
- During the build we call `dein#install()` so all plugins are installed and frozen. Your custom configurations can be added as an additional build step using the Docker `COPY` command.
|
||||
|
||||
### Build
|
||||
|
||||
You can build using the supplied `Makefile`:
|
||||
```
|
||||
make build
|
||||
```
|
||||
|
||||
make build
|
||||
|
||||
or call the command manually using:
|
||||
```
|
||||
docker build -t nvim -f Dockerfile.nvim-python3 .
|
||||
```
|
||||
|
||||
docker build -t nvim -f Dockerfile.nvim-python3 .
|
||||
|
||||
### Run
|
||||
|
||||
You can run the container using:
|
||||
```
|
||||
docker run -it nvim
|
||||
```
|
||||
|
||||
docker run -it nvim
|
||||
|
||||
but that isn't terribly useful since changes made inside the container won't be visible outside. More useful is mounting the current working directory inside the container:
|
||||
```
|
||||
docker run -it -v $(pwd):/home/spacevim/src nvim
|
||||
```
|
||||
|
||||
docker run -it -v $(pwd):/home/spacevim/src nvim
|
||||
|
||||
Even better is an alias `dnvim` which will do this automatically:
|
||||
```
|
||||
alias dnvim="docker run -it -v $(pwd):/home/spacevim/src nvim"
|
||||
```
|
||||
|
||||
alias dnvim="docker run -it -v $(pwd):/home/spacevim/src nvim"
|
||||
|
232
docker/init.toml
Normal file
232
docker/init.toml
Normal file
@ -0,0 +1,232 @@
|
||||
#=============================================================================
|
||||
# init.toml --- Docker config temp file
|
||||
# Copyright (c) 2016-2017 Wang Shidong & Contributors
|
||||
# Author: Wang Shidong < wsdjeg at 163.com >
|
||||
# URL: https://spacevim.org
|
||||
#=============================================================================
|
||||
|
||||
# SpaceVim options {{{
|
||||
[options]
|
||||
# vimcompatible = true
|
||||
# enable_language_specific_leader = false
|
||||
# }}}
|
||||
|
||||
## -- SpaceVim layer list start
|
||||
[[layers]]
|
||||
name = "VersionControl"
|
||||
|
||||
[[layers]]
|
||||
name = "autocomplete"
|
||||
|
||||
[[layers]]
|
||||
name = "chat"
|
||||
|
||||
[[layers]]
|
||||
name = "checkers"
|
||||
|
||||
[[layers]]
|
||||
name = "chinese"
|
||||
|
||||
[[layers]]
|
||||
name = "colorscheme"
|
||||
|
||||
[[layers]]
|
||||
name = "core#banner"
|
||||
|
||||
[[layers]]
|
||||
name = "core#statusline"
|
||||
|
||||
[[layers]]
|
||||
name = "core#tabline"
|
||||
|
||||
[[layers]]
|
||||
name = "core"
|
||||
|
||||
[[layers]]
|
||||
name = "cscope"
|
||||
|
||||
[[layers]]
|
||||
name = "ctrlp"
|
||||
|
||||
[[layers]]
|
||||
name = "debug"
|
||||
|
||||
[[layers]]
|
||||
name = "default"
|
||||
|
||||
[[layers]]
|
||||
name = "denite"
|
||||
|
||||
[[layers]]
|
||||
name = "edit"
|
||||
|
||||
[[layers]]
|
||||
name = "floobits"
|
||||
|
||||
[[layers]]
|
||||
name = "format"
|
||||
|
||||
[[layers]]
|
||||
name = "fzf"
|
||||
|
||||
[[layers]]
|
||||
name = "git"
|
||||
|
||||
[[layers]]
|
||||
name = "github"
|
||||
|
||||
[[layers]]
|
||||
name = "japanese"
|
||||
|
||||
[[layers]]
|
||||
name = "lang#WebAssembly"
|
||||
|
||||
[[layers]]
|
||||
name = "lang#agda"
|
||||
|
||||
[[layers]]
|
||||
name = "lang#asciidoc"
|
||||
|
||||
[[layers]]
|
||||
name = "lang#autohotkey"
|
||||
|
||||
[[layers]]
|
||||
name = "lang#c"
|
||||
|
||||
[[layers]]
|
||||
name = "lang#clojure"
|
||||
|
||||
[[layers]]
|
||||
name = "lang#csharp"
|
||||
|
||||
[[layers]]
|
||||
name = "lang#dart"
|
||||
|
||||
[[layers]]
|
||||
name = "lang#dockerfile"
|
||||
|
||||
[[layers]]
|
||||
name = "lang#elixir"
|
||||
|
||||
[[layers]]
|
||||
name = "lang#elm"
|
||||
|
||||
[[layers]]
|
||||
name = "lang#erlang"
|
||||
|
||||
[[layers]]
|
||||
name = "lang#extra"
|
||||
|
||||
[[layers]]
|
||||
name = "lang#fsharp"
|
||||
|
||||
[[layers]]
|
||||
name = "lang#go"
|
||||
|
||||
[[layers]]
|
||||
name = "lang#haskell"
|
||||
|
||||
[[layers]]
|
||||
name = "lang#html"
|
||||
|
||||
[[layers]]
|
||||
name = "lang#java"
|
||||
|
||||
[[layers]]
|
||||
name = "lang#javascript"
|
||||
|
||||
[[layers]]
|
||||
name = "lang#julia"
|
||||
|
||||
[[layers]]
|
||||
name = "lang#kotlin"
|
||||
|
||||
[[layers]]
|
||||
name = "lang#latex"
|
||||
|
||||
[[layers]]
|
||||
name = "lang#lisp"
|
||||
|
||||
[[layers]]
|
||||
name = "lang#lua"
|
||||
|
||||
[[layers]]
|
||||
name = "lang#markdown"
|
||||
|
||||
[[layers]]
|
||||
name = "lang#nim"
|
||||
|
||||
[[layers]]
|
||||
name = "lang#ocaml"
|
||||
|
||||
[[layers]]
|
||||
name = "lang#perl"
|
||||
|
||||
[[layers]]
|
||||
name = "lang#php"
|
||||
|
||||
[[layers]]
|
||||
name = "lang#plantuml"
|
||||
|
||||
[[layers]]
|
||||
name = "lang#puppet"
|
||||
|
||||
[[layers]]
|
||||
name = "lang#purescript"
|
||||
|
||||
[[layers]]
|
||||
name = "lang#python"
|
||||
|
||||
[[layers]]
|
||||
name = "lang#ruby"
|
||||
|
||||
[[layers]]
|
||||
name = "lang#rust"
|
||||
|
||||
[[layers]]
|
||||
name = "lang#scala"
|
||||
|
||||
[[layers]]
|
||||
name = "lang#sh"
|
||||
|
||||
[[layers]]
|
||||
name = "lang#swift"
|
||||
|
||||
[[layers]]
|
||||
name = "lang#typescript"
|
||||
|
||||
[[layers]]
|
||||
name = "lang#vim"
|
||||
|
||||
[[layers]]
|
||||
name = "lang#vue"
|
||||
|
||||
[[layers]]
|
||||
name = "lsp"
|
||||
|
||||
[[layers]]
|
||||
name = "leaderf"
|
||||
|
||||
[[layers]]
|
||||
name = "shell"
|
||||
|
||||
[[layers]]
|
||||
name = "sudo"
|
||||
|
||||
[[layers]]
|
||||
name = "tags"
|
||||
|
||||
[[layers]]
|
||||
name = "tmux"
|
||||
|
||||
[[layers]]
|
||||
name = "tools#dash"
|
||||
|
||||
[[layers]]
|
||||
name = "tools"
|
||||
|
||||
[[layers]]
|
||||
name = "ui"
|
||||
|
||||
## -- SpaceVim layer list end
|
||||
|
@ -15,6 +15,7 @@ lang: cn
|
||||
- [安装](#安装)
|
||||
- [Linux 或 macOS](#linux-或-macos)
|
||||
- [Windows](#windows)
|
||||
- [在 Docker 中运行](#在-docker-中运行)
|
||||
- [配置](#配置)
|
||||
- [学习SpaceVim](#学习spacevim)
|
||||
- [在线指南](#在线指南)
|
||||
@ -46,6 +47,21 @@ curl -sLf https://spacevim.org/cn/install.sh | bash -s -- -h
|
||||
|
||||
windows 下最快捷的安装方法是下载安装脚本 [install.cmd](https://spacevim.org/cn/install.cmd) 并运行。
|
||||
|
||||
|
||||
### 在 Docker 中运行
|
||||
|
||||
```sh
|
||||
docker pull spacevim/spacevim
|
||||
docker run -it --rm spacevim/spacevim nvim
|
||||
```
|
||||
|
||||
也可以通过挂载的方式,载入本地配置:
|
||||
|
||||
```sh
|
||||
docker run -it -v ~/.SpaceVim.d:/home/spacevim/.SpaceVim.d --rm spacevim/spacevim nvim
|
||||
```
|
||||
|
||||
|
||||
### 配置
|
||||
|
||||
SpaceVim 的默认配置文件为 `~/.SpaceVim.d/init.toml`。下面为一简单的配置示例。
|
||||
|
@ -14,6 +14,7 @@ show you how to install it, how to config it, and explain its features.
|
||||
- [Install](#install)
|
||||
- [Linux and macOS](#linux-and-macos)
|
||||
- [Windows](#windows)
|
||||
- [Run in docker](#run-in-docker)
|
||||
- [Configuration](#configuration)
|
||||
- [Online tutor](#online-tutor)
|
||||
- [Learning SpaceVim](#learning-spacevim)
|
||||
@ -45,6 +46,19 @@ curl -sLf https://spacevim.org/install.sh | bash -s -- -h
|
||||
|
||||
The easiest way is to download [install.cmd](https://spacevim.org/install.cmd) and run it as administrator, or install SpaceVim manually.
|
||||
|
||||
## Run in docker
|
||||
|
||||
```sh
|
||||
docker pull spacevim/spacevim
|
||||
docker run -it --rm spacevim/spacevim nvim
|
||||
```
|
||||
|
||||
you can also load local config:
|
||||
|
||||
```sh
|
||||
docker run -it -v ~/.SpaceVim.d:/home/spacevim/.SpaceVim.d --rm spacevim/spacevim nvim
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
The default configuration file of SpaceVim is `~/.SpaceVim.d/init.toml`. This is
|
||||
|
@ -12,6 +12,7 @@ The next release is v1.0.0.
|
||||
### Improvement
|
||||
|
||||
- Update runtime log for startup ([#2219](https://github.com/SpaceVim/SpaceVim/pull/2219))
|
||||
- Add doc for how run run spacevim in docker ([#2238](https://github.com/SpaceVim/SpaceVim/pull/2238))
|
||||
|
||||
### Changed
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user