Created
July 4, 2024 18:38
-
-
Save rafaelrojasmiliani/8ff5a1ad3c39227f25a61813496407d9 to your computer and use it in GitHub Desktop.
Create a vim plugin git repo with bash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
main() { | |
# Check if the plugin name is provided | |
if [ -z "$1" ]; then | |
echo "Usage: $0 <plugin_name>" | |
exit 1 | |
fi | |
PLUGIN_NAME=$1 | |
# Create the directory structure | |
mkdir -p $PLUGIN_NAME/{autoload,doc,plugin,syntax} | |
# Navigate to the plugin directory | |
cd $PLUGIN_NAME | |
# Create common files | |
touch autoload/$PLUGIN_NAME.vim | |
touch doc/$PLUGIN_NAME.txt | |
touch plugin/$PLUGIN_NAME.vim | |
touch syntax/$PLUGIN_NAME.vim | |
# Create a README.md file | |
cat <<EOL >README.md | |
# $PLUGIN_NAME | |
## Description | |
## Installation | |
## Usage | |
EOL | |
# Create a basic help file | |
cat <<EOL >doc/$PLUGIN_NAME.txt | |
*${PLUGIN_NAME}* | |
=============================================================================== | |
$PLUGIN_NAME *$PLUGIN_NAME.txt* | |
DESCRIPTION | |
A brief description of the plugin. | |
INSTALLATION | |
Instructions on how to install the plugin. | |
USAGE | |
Instructions on how to use the plugin. | |
=============================================================================== | |
vim:tw=78:ts=8:noet:ft=help:norl: | |
EOL | |
# Create a basic autoload file | |
cat <<EOL >autoload/$PLUGIN_NAME.vim | |
" Autoload functions for $PLUGIN_NAME | |
if exists('g:loaded_$PLUGIN_NAME') | |
finish | |
endif | |
let g:loaded_$PLUGIN_NAME = 1 | |
" Add your autoload functions here | |
EOL | |
# Create a basic plugin file | |
cat <<EOL >plugin/$PLUGIN_NAME.vim | |
" Plugin initialization for $PLUGIN_NAME | |
if exists('g:loaded_$PLUGIN_NAME') | |
finish | |
endif | |
let g:loaded_$PLUGIN_NAME = 1 | |
" Add your plugin initialization code here | |
EOL | |
# Create a basic syntax file | |
cat <<EOL >syntax/$PLUGIN_NAME.vim | |
" Syntax definitions for $PLUGIN_NAME | |
" Add your syntax definitions here | |
EOL | |
# Initialize a git repository | |
git init | |
# Create an initial commit | |
git add . | |
git commit -m "Initial commit for $PLUGIN_NAME plugin" | |
echo "Vim plugin repository for $PLUGIN_NAME created successfully." | |
} | |
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then | |
main "$@" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment