A simple vim/neovim plugin that provides Xcode-like docstring templates for Swift
📑Generate Swift docstrings for types, functions and properties 🎛Support for
/** ... */delimiters
🎨Even more customizable output 🔨Xcode-like style of docstrings 🧠Better context awarness than in Xcode 🔥Fast parsing using regular expressions 👌Zero dependency (100% vim-script)
Generates docstring for the context in the current line of the cursor
Generates docstrings for every type declaration in current buffer
Generates docstrings for every function declaration in current buffer
For your own convenience add the following to your
" Generate docstring for current context on 'Tab' + '/' autocmd Filetype swift nnoremap <silent><tab>/ :SwiftDocstringCurrent<CR>
For customized behaviour, change values of these properties. Values presented below are the defaults.
" Use Multi-line delimiter '/** ... */' instead of single-line '///' " Boolen value (0 or 1) let g:swiftdocstring#use_multi_line_delimiter = 0
" Set indentation for dosctring between the text and delimiters " Integer value (>=0) let g:swiftdocstring#text_indentation_level = 1
" Use placeholders for some components of the docstring " Boolen value (0 or 1) let g:swiftdocstring#use_placeholders = 1
" Placeholders to be used if setting above is set as true " Two element string array let g:swiftdocstring#placeholder_template = ['<#', '#>']
Everything you need to know about the usage of this plugin is basically here
in this readme. Feel free to dive into the codebase for more answers. Very
basic documentation is available from inside of vim itself with
This plugin was made under the desire to have a powerful Swift development environment in vim. Although the plugin brings only a small feature ported from Xcode, I want to add at least one brick to the wall. This is as far as I can go at the moment with the amount of time it took to create this piece of code. I intend it to remain simple, yet useful. Contributions are welcomed.
To learn more about Swift docstrings read this awesome article at NSHipster: Swift Documentation
Written by Nate Cook & Mattt — July 11th, 2018 (revised)
The plugin in licensed under MIT license so do what ever you want with it.