Skip to content

squattingmonk/vim-nwscript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vim-nwscript

This is an add-on for vim providing support for editing NWScript.

Features

  • syntax highlighting
  • auto-indention
  • auto-wrapping of comments
  • code snippets for UltiSnips
  • shortcut for generating ctags files

Requirements

Installation

If you use vim-plug, add the following to your .vimrc:

Plug 'squattingmonk/vim-nwscript'

Then run :PlugInstall.

Customization

This plugin has sensible (read: opinionated) defaults. If you don't like one of the behaviors below, you can change it in your .vimrc using one of the settings below (default values are shown).

This plugin is divided into several modules and will be expanded over time. By default, all modules are enabled, but you can enable or disable them selectively in your .vimrc:

" Whitelist modules
let g:nwscript#modules#enabled = ['ctags', 'fold', 'format']

" Blacklist modules
let g:nwscript#modules#disabled = []

format module

By default, comments will auto-wrap at column 80, preserving any indentation. Pressing <cr> (insert mode) or o/O (normal mode) will continue a comment block.

let g:nwscript#format#textwidth = 80
let g:nwscript#format#options = 'croqwa2lj'

All trailing whitespace is removed when saving the file.

let g:nwscript#format#whitespace = 1

fold module

Code between brackets is automatically folded.

let g:nwscript#fold#method = 'syntax'
let g:nwscript#fold#level = &foldlevel
let g:nwscript#fold#column = 1

ctags module

This plugin comes with an options file to generate tags for NWScript files. If you wish to use your own options file, you can set the path to it in your .vimrc:

let g:nwscript#ctags#file = '/your/path/to/nwscript.ctags'

To generate a tags file, you can run :NWScriptTagGen or press <localleader>tt while in normal mode. Alternatively, you can set your own mapping:

nmap <localleader>tt <Plug>NWScriptTagGen

The tags file will be placed into your project's git root, nasher root, or the directory of the current file if no git or nasher project was detected. The generation is recursive, so any nwscript file in the project will be searched for tags.

You can also add extra directories outside of your project that will be tagged:

let g:nwscript#ctags#includes = ['~/.local/share/nwscript']

To generate a tag file for the current project and all included directories, you can run :NWScriptTagGenAll or press <localleader>TT while in normal mode. Alternatively, you can set your own mapping:

nmap <localleader>TT <Plug>NWScriptTagGenAll

About

NWScript support for Vim

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published