mirror of
https://github.com/webinstall/webi-installers.git
synced 2026-08-23 22:16:48 +00:00
add and update vim plugins with sensible defaults
This commit is contained in:
@@ -70,6 +70,8 @@ pkg_post_install() {
|
||||
"$pkg_dst_cmd" get golang.org/x/tools/cmd/gotype > /dev/null #2>/dev/null
|
||||
echo stringer
|
||||
"$pkg_dst_cmd" get golang.org/x/tools/cmd/stringer > /dev/null #2>/dev/null
|
||||
echo goreturns
|
||||
"$pkg_dst_cmd" get github.com/sqs/goreturns > /dev/null #2>/dev/null
|
||||
}
|
||||
|
||||
pkg_done_message() {
|
||||
|
||||
+7
-3
@@ -16,7 +16,8 @@ webi vim-go
|
||||
> `vim-go` provides integration with various official and 3rd part go tooling
|
||||
> for linting, vetting, etc.
|
||||
|
||||
You'll also need `ALE`, `syntastic`, or similar.
|
||||
You'll also need `ALE`, [`syntastic`](https://webinstall.dev/vim-syntastic), or
|
||||
similar.
|
||||
|
||||
### How to install by hand
|
||||
|
||||
@@ -26,7 +27,7 @@ git clone --depth=1 https://github.com/fatih/vim-go.git ~/.vim/pack/plugins/star
|
||||
|
||||
### How to configure your `.vimrc`
|
||||
|
||||
```vimrc
|
||||
```vim
|
||||
" don't check syntax immediately on open or on quit
|
||||
let g:syntastic_check_on_open = 1
|
||||
let g:syntastic_check_on_wq = 0
|
||||
@@ -35,7 +36,7 @@ let g:syntastic_check_on_wq = 0
|
||||
autocmd BufWritePre * :%s/\s\+$//e
|
||||
```
|
||||
|
||||
```vimrc
|
||||
```vim
|
||||
"""""""""""""""""""""""""""
|
||||
" Golang-specific options "
|
||||
"""""""""""""""""""""""""""
|
||||
@@ -75,6 +76,9 @@ go get golang.org/x/tools/cmd/goimports
|
||||
# gorename
|
||||
go get golang.org/x/tools/cmd/gorename
|
||||
|
||||
# goreturns
|
||||
go get github.com/sqs/goreturns
|
||||
|
||||
# gotype
|
||||
go get golang.org/x/tools/cmd/gotype
|
||||
```
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
""""""""""""""""""""""""""""""
|
||||
" Golang-specific defaults "
|
||||
" from webinstall.dev/vim-go "
|
||||
""""""""""""""""""""""""""""""
|
||||
|
||||
" tell syntastic that go, golint, and errcheck are installed
|
||||
let g:syntastic_go_checkers = ['go', 'golint', 'errcheck']
|
||||
|
||||
" tell vim-go that goimports is installed
|
||||
let g:go_fmt_command = "goreturns"
|
||||
|
||||
" tell vim-go to highlight
|
||||
let g:go_highlight_functions = 1
|
||||
let g:go_highlight_methods = 1
|
||||
let g:go_highlight_structs = 1
|
||||
let g:go_highlight_operators = 1
|
||||
let g:go_highlight_build_constraints = 1
|
||||
+2
-3
@@ -1,7 +1,6 @@
|
||||
#!/usr/bin/env pwsh
|
||||
|
||||
IF (!(Test-Path -Path "$Env:USERPROFILE\.vim\pack\plugins\start")) {
|
||||
New-Item -Path "$Env:USERPROFILE\.vim\pack\plugins\start" -ItemType Directory -Force
|
||||
}
|
||||
New-Item -Path "$Env:USERPROFILE\.vim\pack\plugins\start" -ItemType Directory -Force
|
||||
|
||||
Remove-Item -Path "$Env:USERPROFILE\.vim\pack\plugins\start\vim-go" -Recurse -ErrorAction Ignore
|
||||
& git clone --depth=1 https://github.com/fatih/vim-go.git "$Env:USERPROFILE\.vim\pack\plugins\start\vim-go"
|
||||
|
||||
@@ -7,4 +7,33 @@
|
||||
mkdir -p "$HOME/.vim/pack/plugins/start"
|
||||
rm -rf "$HOME/.vim/pack/plugins/start/vim-go"
|
||||
git clone --depth=1 https://github.com/fatih/vim-go.git "$HOME/.vim/pack/plugins/start/vim-go"
|
||||
|
||||
# Install go linting tools
|
||||
echo "Building go language tools..."
|
||||
echo gopls
|
||||
go get golang.org/x/tools/gopls > /dev/null #2>/dev/null
|
||||
echo golint
|
||||
go get golang.org/x/lint/golint > /dev/null #2>/dev/null
|
||||
echo errcheck
|
||||
go get github.com/kisielk/errcheck > /dev/null #2>/dev/null
|
||||
echo goimports
|
||||
go get golang.org/x/tools/cmd/goimports > /dev/null #2>/dev/null
|
||||
echo goreturns
|
||||
go get github.com/sqs/goreturns > /dev/null #2>/dev/null
|
||||
|
||||
if [ -f "$HOME/.vimrc" ]; then
|
||||
set +e
|
||||
if ! grep 'source.*go.vim' -r ~/.vimrc; then
|
||||
mkdir -p ~/.vim/plugin
|
||||
printf '\n" Golang: reasonable defaults from webinstall.dev/vim-go\n' >> ~/.vimrc
|
||||
printf 'source ~/.vim/plugin/go.vim\n' >> ~/.vimrc
|
||||
fi
|
||||
set -e
|
||||
fi
|
||||
|
||||
if ! [ -f "$HOME/.vim/plugin/go.vim" ]; then
|
||||
mkdir -p ~/.vim/plugin
|
||||
WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"}
|
||||
curl -fsS -o ~/.vim/plugin/go.vim "$WEBI_HOST/packages/vim-go/go.vim"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
---
|
||||
title: vim-prettier
|
||||
homepage: https://github.com/prettier/vim-prettier
|
||||
tagline: |
|
||||
vim-prettier adds Prettier support for Vim.
|
||||
---
|
||||
|
||||
## Updating `vim-prettier`
|
||||
|
||||
```bash
|
||||
webi vim-prettier
|
||||
```
|
||||
|
||||
## Cheat Sheet
|
||||
|
||||
> `vim-prettier` is a vim plugin wrapper for prettier, pre-configured with
|
||||
> custom default prettier settings.
|
||||
|
||||
You'll also need `ALE`, [`syntastic`](https://webinstall.dev/vim-syntastic), or
|
||||
similar.
|
||||
|
||||
### How to install by hand
|
||||
|
||||
```bash
|
||||
git clone --depth=1 https://github.com/prettier/vim-prettier ~/.vim/pack/plugins/start/vim-prettier
|
||||
```
|
||||
|
||||
### How to configure your `.vimrc`
|
||||
|
||||
```vim
|
||||
" don't check syntax immediately on open or on quit
|
||||
let g:syntastic_check_on_open = 1
|
||||
let g:syntastic_check_on_wq = 0
|
||||
|
||||
" we also want to get rid of accidental trailing whitespace on save
|
||||
autocmd BufWritePre * :%s/\s\+$//e
|
||||
```
|
||||
|
||||
```vim
|
||||
"""""""""""""""""""""""""""
|
||||
" Prettier-specific options "
|
||||
"""""""""""""""""""""""""""
|
||||
|
||||
" format as-you-type is quite annoying, so we turn it off
|
||||
let g:prettier#autoformat = 0
|
||||
|
||||
" list all of the extensions for which prettier should run
|
||||
autocmd BufWritePre .babelrc,.eslintrc,.jshintrc,*.js,*.jsx,*.mjs,*.ts,*.tsx,*.css,*.less,*.scss,*.json,*.graphql,*.md,*.vue,*.yaml,*.html PrettierAsync
|
||||
```
|
||||
|
||||
### How to install Prettier
|
||||
|
||||
With `webi`:
|
||||
|
||||
```bash
|
||||
webi prettier
|
||||
```
|
||||
|
||||
With `node`:
|
||||
|
||||
```bash
|
||||
npm install -g prettier@2
|
||||
```
|
||||
@@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env pwsh
|
||||
|
||||
New-Item -Path "$Env:USERPROFILE\.vim\pack\plugins\start" -ItemType Directory -Force
|
||||
|
||||
Remove-Item -Path "$Env:USERPROFILE\.vim\pack\plugins\start\vim-prettier" -Recurse -ErrorAction Ignore
|
||||
& git clone --depth=1 https://github.com/prettier/vim-prettier.git "$Env:USERPROFILE\.vim\pack\plugins\start\vim-prettier"
|
||||
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
{
|
||||
set -e
|
||||
set -u
|
||||
|
||||
mkdir -p "$HOME/.vim/pack/plugins/start"
|
||||
rm -rf "$HOME/.vim/pack/plugins/start/vim-prettier"
|
||||
git clone --depth=1 https://github.com/prettier/vim-prettier.git "$HOME/.vim/pack/plugins/start/vim-prettier"
|
||||
|
||||
npm install -g prettier@2
|
||||
|
||||
if [ -f "$HOME/.vimrc" ]; then
|
||||
set +e
|
||||
if ! grep 'source.*prettier.vim' -r ~/.vimrc; then
|
||||
mkdir -p ~/.vim/plugin
|
||||
printf '\n" Prettier: reasonable defaults from webinstall.dev/vim-prettier\n' >> ~/.vimrc
|
||||
printf 'source ~/.vim/plugin/prettier.vim\n' >> ~/.vimrc
|
||||
fi
|
||||
set -e
|
||||
fi
|
||||
|
||||
if ! [ -f "$HOME/.vim/plugin/prettier.vim" ]; then
|
||||
mkdir -p ~/.vim/plugin
|
||||
WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"}
|
||||
curl -fsS -o ~/.vim/plugin/prettier.vim "$WEBI_HOST/packages/vim-prettier/prettier.vim"
|
||||
fi
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
""""""""""""""""""""""""""""""""""""
|
||||
" Prettier-specific defaults "
|
||||
" from webinstall.dev/vim-prettier "
|
||||
""""""""""""""""""""""""""""""""""""
|
||||
|
||||
" format as-you-type is quite annoying, so we turn it off
|
||||
let g:prettier#autoformat = 0
|
||||
|
||||
" list all of the extensions for which prettier should run
|
||||
autocmd BufWritePre .babelrc,.eslintrc,.jshintrc,*.js,*.jsx,*.mjs,*.ts,*.tsx,*.css,*.less,*.scss,*.json,*.graphql,*.md,*.vue,*.yaml,*.html PrettierAsync
|
||||
Reference in New Issue
Block a user