mirror of
https://github.com/webinstall/webi-installers.git
synced 2026-02-14 09:39:51 +00:00
add _vim-example
This commit is contained in:
49
_vim-example/README.md
Normal file
49
_vim-example/README.md
Normal file
@@ -0,0 +1,49 @@
|
||||
---
|
||||
title: vim-example
|
||||
homepage: https://github.com/CHANGEME/example
|
||||
tagline: |
|
||||
Vim Example: A template for webi vim plugins.
|
||||
---
|
||||
|
||||
To update (replacing the current version) run `webi vim-example`.
|
||||
|
||||
## Cheat Sheet
|
||||
|
||||

|
||||
|
||||
> Replace this text with a nice summary, perhaps from the plugins documentation.
|
||||
|
||||
If there are some important key bindings, use a table like this:
|
||||
|
||||
| Key | Action |
|
||||
| ----------------------- | ---------------------------------------------------- |
|
||||
| **Global Key Bindings** | |
|
||||
| `<Leader>n` | Move cursor to NERDTree |
|
||||
| `ctrl+w`, w | Rotate between open windows |
|
||||
| `:e **/api.js<tab>` | Open and edit file matching api.js, in any subfolder |
|
||||
|
||||
### How to install and configure manually
|
||||
|
||||
1. Place EXAMPLE into your `~/.vim/pack/plugins/start`:
|
||||
|
||||
```bash
|
||||
mkdir -p ~/.vim/pack/plugins/start/
|
||||
git clone --depth=1 https://github.com/CHANGEME/EXAMPLE.git ~/.vim/pack/plugins/start/example
|
||||
```
|
||||
|
||||
2. Create the file `~/.vim/plugins/example.vim`. Add the same contents as
|
||||
<https://github.com/webinstall/webi-installers/blob/master/vim-example/example.vim>,
|
||||
which will look something like this:
|
||||
|
||||
```vim
|
||||
" ~/.vim/plugins/example.vim
|
||||
|
||||
" default mappings for example
|
||||
nnoremap <leader>x :EXAMPLE<CR>
|
||||
```
|
||||
|
||||
3. Update `~/.vimrc` to source that plugin:
|
||||
```vim
|
||||
" example: reasonable defaults from webinstall.dev/vim-example
|
||||
source ~/.vim/plugins/example.vim
|
||||
```
|
||||
3
_vim-example/changeme.vim
Normal file
3
_vim-example/changeme.vim
Normal file
@@ -0,0 +1,3 @@
|
||||
" sets an option that would be reasonable to have on by default
|
||||
" to actually be on, as it should be
|
||||
let g:SomePluginOptions = 1
|
||||
7
_vim-example/install.ps1
Normal file
7
_vim-example/install.ps1
Normal file
@@ -0,0 +1,7 @@
|
||||
#!/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
|
||||
}
|
||||
Remove-Item -Path "$Env:USERPROFILE\.vim\pack\plugins\start\example" -Recurse -ErrorAction Ignore
|
||||
& git clone --depth=1 https://github.com/CHANGEME/example.git "$Env:USERPROFILE\.vim\pack\plugins\start\example"
|
||||
37
_vim-example/install.sh
Normal file
37
_vim-example/install.sh
Normal file
@@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
|
||||
function __init_vim_example() {
|
||||
set -e
|
||||
set -u
|
||||
|
||||
mkdir -p "$HOME/.vim/pack/plugins/start"
|
||||
rm -rf "$HOME/.vim/pack/plugins/start/example.vim"
|
||||
git clone --depth=1 https://github.com/CHANGEME/example.git "$HOME/.vim/pack/plugins/start/example"
|
||||
|
||||
if [ ! -f "$HOME/.vimrc" ]; then
|
||||
touch "$HOME/.vimrc"
|
||||
fi
|
||||
|
||||
mkdir -p ~/.vim/plugins
|
||||
if ! [ -f "$HOME/.vim/plugins/example.vim" ]; then
|
||||
WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"}
|
||||
curl -fsSL -o ~/.vim/plugins/example.vim "$WEBI_HOST/packages/vim-example/example.vim"
|
||||
fi
|
||||
|
||||
if ! grep 'source.*plugins.example.vim' -r ~/.vimrc >/dev/null 2>/dev/null; then
|
||||
set +e
|
||||
mkdir -p ~/.vim/plugins
|
||||
printf '\n" example: reasonable defaults from webinstall.dev/vim-example\n' >> ~/.vimrc
|
||||
printf 'source ~/.vim/plugins/example.vim\n' >> ~/.vimrc
|
||||
set -e
|
||||
echo ""
|
||||
echo "add ~/.vim/plugins/example.vim"
|
||||
echo "updated ~/.vimrc with 'source ~/.vim/plugins/example.vim'"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "vim-example enabled with reasonable defaults"
|
||||
|
||||
}
|
||||
|
||||
__init_vim_example
|
||||
Reference in New Issue
Block a user