Skip to content

Commit

Permalink
add vim extension
Browse files Browse the repository at this point in the history
  • Loading branch information
momaek committed Apr 19, 2021
1 parent 953f8af commit 1e7c7c8
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 6 deletions.
25 changes: 19 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
build_x86:
GOOS=darwin GOARCH=amd64 go build -o formattag-amd64 main.go
build_macOS_x86:
GOOS=darwin GOARCH=amd64 go build -o formattag-macOS-amd64 main.go

build_m1:
GOOS=darwin GOARCH=arm64 go build -o formattag-arm64 main.go
build_macOS_arm:
GOOS=darwin GOARCH=arm64 go build -o formattag-macOS-arm64 main.go

build: build_x86 build_m1
build_macOS: build_macOS_arm build_macOS_x86

build_linux_x86:
GOOS=linux GOARCH=amd64 go build -o formattag-linux-amd64 main.go

build_linux_arm64:
GOOS=linux GOARCH=arm64 go build -o formattag-linux-arm64 main.go

build_linux_386:
GOOS=linux GOARCH=386 go build -o formattag-linux-386 main.go

build_linux: build_linux_386 build_linux_arm64 build_linux_x86

build: build_linux build_macOS

tar:
tar zcvf formattag.tar.gz formattag-amd64 formattag-arm64
tar zcvf formattag.tar.gz formattag-macOS-amd64 formattag-macOS-arm64 formattag-linux-amd64 formattag-linux-arm64 formattag-linux-386
25 changes: 25 additions & 0 deletions vim/ftplugin/go/pretty.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
" Copyright 2021 momaek. All rights reserved.
" Use of this source code is governed by a BSD-style
" license that can be found in the LICENSE file.
"
" This filetype plugin add a new commands for go buffers:
"
" :PrettyTag
"
" Run formattag for the current Go file.
"
if exists("b:did_ftplugin_go_pretty_tag")
finish
endif

if !executable("formattag")
finish
endif

command! -buffer PrettyTag call s:GoPrettyTag()

function! s:GoPrettyTag() abort
cexpr system('formattag -file ' . shellescape(expand('%')))
endfunction

let b:did_ftplugin_go_pretty_tag = 1

0 comments on commit 1e7c7c8

Please sign in to comment.