Skip to content

l-zeuch/yagpdb.vim

Repository files navigation

YAGPDB Custom Commands Vim plugin

Syntax highlighting for YAGPDB custom commands in (N)Vim.

CI

Installing

Manually

To install without any external plugin-manager dependencies, simply download the Makefile and run make install. For a different destination, invoke make with DESTDIR=/path/to/destination.

wget https://raw.githubusercontent.com/l-zeuch/yagpdb.vim/master/Makefile && make install

Note If you wish to install this for your Vim, but also have Neovim installed, make sure to invoke the install-vim target instead.

See also as Greg Hurrell's excellent Youtube video: Vim screencast #75: Plugin managers.

With a Plugin Manager

Note Installing with a plugin manager is recommended for Windows installations.

Use your favorite plugin manager to install this plugin. tpope/vim-pathogen, VundleVim/Vundle.vim, junegunn/vim-plug, and Shougo/dein.vim are some of the more popular ones. A lengthy discussion of these and other managers can be found on vi.stackexchange.com. Basic instructions are provided below, but please be sure to read, understand, and follow all the safety rules that come with your power tools plugin manager.

Pathogen Pathogen is more of a runtime path manager than a plugin manager. You must clone the plugins' repositories yourself to a specific location, and Pathogen makes sure they are available in Vim.
  1. In the terminal,

    git clone https://github.com/l-zeuch/yagpdb.vim.git ~/.vim/bundle/yagpdb.vim
  2. In your vimrc,

    call pathogen#infect()
    syntax on
    filetype plugin indent on
Vundle
  1. Install Vundle, according to its instructions.

  2. Add the following text to your vimrc.

    call vundle#begin()
      Plugin 'l-zeuch/yagpdb.vim'
    call vundle#end()
  3. Restart Vim, and run the :PluginInstall statement to install your plugins.

Vim-Plug
  1. Install Vim-Plug, according to its instructions.

  2. Add the following text to your vimrc.

    call plug#begin()
      Plug 'l-zeuch/yagpdb.vim'
    call plug#end()
  3. Restart Vim, and run the :PlugInstall statement to install your plugins.

Dein
  1. Install Dein, according to its instructions.

  2. Add the following text to your vimrc.

    call dein#begin()
      call dein#add('l-zeuch/yagpdb.vim')
    call dein#end()
  3. Restart Vim, and run the :call dein#install() statement to install your plugins.

Configuration

Clipboard

If you prefer to insert text on a middle click with your mouse instead of Ctrl + V, change the register used as follows:

let g:yagpdbcc_use_primary = 1

Code Completion (Neovim >0.5 ONLY)

We provide bundled sources for code-completion to be used with hrsh7th/nvim-cmp. Follow the installation instructions there and enable the source as follows:

sources = cmp.config.sources({
    ...
    { name = 'yagpdb-cc' },
    ...
})

Supported File Extensions

We support the following list of file extensions:

  • *.yag
  • *.yagcc
  • *.tmpl 1)
  • *.go.tmpl 1)

1) These extensions are not detected by default, as they are already used by Go. Please see below for instructions on how to enable them.

Overriding Filetypes

Sometimes, you may wish to use a file extension already in use by another language, such as *.gotmpl. Enable also detecting those extension as follows, if needed:

let g:yagpdbcc_override_ft = 1

Snippet Engines

We provide snippets for two distinct engines: UltiSnips, and Neosnippet.

Select which one to use by setting the g:yagpdbcc_snippet_engine variable to either ultisnips, or neosnippet, like so:

let g:yagpdbcc_snippet_engine = "ultisnips"

Contributing

If you spot an error, or want to contribute new features, feel free open a pull request! Please refer to CONTRIBUTING for our guidelines on how to contribute.

Other Contributions

Some of the regex in this plugin was developed by @DZ-TM. If you like it, feel free to give him cookies as a reward.

(Re-)Generating Function Syntax

We aim to provide up-to-date function syntax highlighting based on the official instance of YAGPDB located at botlabs-gg/yagpdb. Should you use a fork or otherwise modified version, and wish to generate the highlighting for that repository, modify the Makefile such that the call to .bundle/lytfs in the syntax: recipe reads as follows:

syntax: .bundle/lytfs
    .bundle/lytfs owner/repo@branch > syntax/funcs
# [...]

Where owner/repo is the repository you wish to generate the syntax for, and branch is the branch you wish to use. A current Python 3 installation is required.

After your modification, run make generate to update syntax definitions and the completion source file.

Warning

The lytfs tool is potentially fragile — it makes assumptions about the file structure of the project. Make sure to read the source code of the tool before using it and verify compatibility with your version of YAGPDB.

Legal Mumbo Jumbo

Disclaimer

  1. The YAGPDB developers, staff, and/or support are not responsible for any difficulties caused by this plugin.

  2. This plugin is provided as-is, without the intention to cause offense of any kind.

  3. YAGPDB is a service provided by botlabs and is in no way associated with this plugin.

  4. The developers of this plugin have been granted permission to use the brand name YAGPDB in this plugin. Please view the permission file for details.

License

This project is licensed under the terms of the GNU General Public License, version 2.0 (SPDX-Identifier GPL-2.0). Please refer to the LICENSE file for more details.