SourcePawn support for Neovim:
:SourcePawnInstalldownloads sourcepawn-studio and SourceMod..spfiles (and.incfiles under aninclude/folder) get thesourcepawnfiletype.- Treesitter highlighting starts automatically when the
sourcepawnparser is installed. - sourcepawn-studio runs as the language server, with SourceMod's includes and compiler wired in.
:makecompiles the current file with spcomp and fills the quickfix list.
- Neovim 0.12+.
curlandtarfor:SourcePawnInstall. Windows 10 and later include both.
vim.pack.add({ 'https://github.com/misscatmint/sourcepawn.nvim' })Then run :SourcePawnInstall once and check :checkhealth sourcepawn. The
full reference is in :help sourcepawn.
Highlighting comes from the sourcepawn treesitter parser. With
nvim-treesitter:
require('nvim-treesitter').install({ 'sourcepawn' })setup() is optional. The defaults:
require('sourcepawn').setup({
-- Folder containing spcomp and include/. Defaults to the SourceMod
-- downloaded by :SourcePawnInstall.
scripting_dir = nil,
-- SourceMod release :SourcePawnInstall downloads, as listed on
-- https://github.com/alliedmodders/sourcemod/releases
sourcemod_version = '1.12.0.7255',
-- sourcepawn-studio release :SourcePawnInstall downloads.
server_version = 'v8.1.8',
})To use your own SourceMod build or release instead, point scripting_dir at
its scripting folder, for example addons/sourcemod/scripting in a release or
package in a configure.py --scripting-only build.
| Platform | sourcepawn-studio | SourceMod |
|---|---|---|
| Linux x86_64 | downloaded | compiler and includes |
| Windows x86_64, arm64 | downloaded | compiler and includes |
| Linux arm64, armv7 | downloaded | includes only |
| macOS | downloaded | includes only |
SourceMod only publishes compilers for Linux x86 and Windows. Elsewhere the
includes still give you completion, hover and go-to-definition. To compile,
point scripting_dir at a scripting folder with spcomp built for your
platform.
- The language server uses the nearest
.gitfolder as the project root. Outside a git repo it still works for the file you're editing, but won't load the rest of the project. :makewrites the.smxfile to Neovim's current directory.
MIT.