LoginSignup
5
5

More than 5 years have passed since last update.

docker コンテナ上で vim-go を使う

Posted at

設定ファイルいじる趣味ないので個人的にはこれぐらいでいい気する。

Dockerfile 作成

$ vi Dockerfile
FROM golang
RUN apt-get update && \
    apt-get install -y vim && \
    mkdir -p ~/.vim/autoload ~/.vim/bundle && \
    curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim && \
    echo 'execute pathogen#infect()' >> ~/.vimrc && \
    echo 'syntax on' >> ~/.vimrc && \
    echo 'filetype plugin indent on' >> ~/.vimrc && \
    git clone https://github.com/fatih/vim-go.git ~/.vim/bundle/vim-go

docker イメージビルド & コンテナ起動

$ docker build -t vim-go .
$ docker run -ti --rm vim-go bash

コンテナの中にログインして main.go とかを作成。

> vim main.go

こう書いて :w すると、

package main

import ("fmt")

func main() {
fmt.Println("vim-go")
}

こう整形してくれることが確認できた。

package main

import (
        "fmt"
)

func main() {
        fmt.Println("vim-go")
}
5
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
5