GithubHelp home page GithubHelp logo

witekbobrowski / vim-swiftdocstring Goto Github PK

View Code? Open in Web Editor NEW
17.0 4.0 1.0 243 KB

๐Ÿ“‘ Vim plugin for generating docstrings in Swift sources

License: MIT License

Vim Script 100.00%
vim vim-plugin neovim swift docstring vim-script hacktoberfest

vim-swiftdocstring's Introduction

vim-swiftdocstring

screenshot

Version Contact

A simple vim/neovim plugin that provides Xcode-like docstring templates for Swift

Features

  • ๐Ÿ“‘ Generate Swift docstrings for types, functions and properties
  • ๐ŸŽ› Support for /// and /** ... */ 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)

Installation

vim-plug
Plug 'witekbobrowski/vim-swiftdocstring'
Vundle
Plugin 'witekbobrowski/vim-swiftdocstring'
Dein
call dein#add('witekbobrowski/vim-swiftdocstring')

Usage

Commands
  • :SwiftDocstringCurrent

    Generates docstring for the context in the current line of the cursor

  • :SwiftDocstringTypes

    Generates docstrings for every type declaration in current buffer

  • :SwiftDocstringFunctions

    Generates docstrings for every function declaration in current buffer

Mappings

For your own convenience add the following to your .vimrc

" Generate docstring for current context on 'Tab' + '/'
autocmd Filetype swift nnoremap <silent><tab>/ :SwiftDocstringCurrent<CR>
Options

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 = ['<#', '#>']

Documentation

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 :h command.

:help swiftdocstring

Why

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.

Resources

To learn more about Swift docstrings read this awesome article at NSHipster: Swift Documentation

Swift Documentation

Written by Nate Cook & Mattt โ€” July 11th, 2018 (revised)

License

The plugin in licensed under MIT license so do what ever you want with it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.