Skip to content

sunwukonga/heading.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

heading.nvim

Create a comment heading from a selection not exceeding 64 characters in length.

Comment is inserted above selection without mutating selection.

Comment type is selected by the buffer filetype.

Default comment type (no filetype) is configurable with opts.default_style = 'shell'

Note

Possible values of default_style: apl, clang, clojure, haskell, html, latex, lua, matlab, pascal, python, roxgen2, shell, vim

Example

    /*//////////////////////////////////////////////////////////////
                           THIS IS AN EXAMPLE
    //////////////////////////////////////////////////////////////*/

Install

/lua/plugins/header.lua

local Plugin = { 'sunwukonga/heading.nvim' }

Plugin.keys = {
  {
    "<leader>ah",
    ":AddHeading<CR>",
    mode = "v",
    desc = "Use selected text to splat heading comment",
    silent = true,
    buffer = true
  },
}

Plugins.opts = {
    default_style = 'shell'
}

return Plugin

Supported Comment Types

Note

Default is to use CLANG style

APL

⍝⍝⍝⍝⍝⍝⍝⍝⍝

⍝⍝⍝⍝⍝⍝⍝⍝⍝

CLANG

Note

C, C++, C#, Java, JavaScript, TypeScript, PHP, Kotlin, Scala, Swift, Go, Rust, CSS, SQL, Objective-C, Dart, JSON5

/******

******/

CLOJURE

(comment ...........

...................)

HASKELL

{-------

-------}

HTML

Note

HTML, XML, SGML, Markdown (embedded)

<!-------

-------->

LATEX

Note

tex, latex, erlang

%%%%%%%%%%
%        %
%%%%%%%%%%

LUA

--[[======

========]]

MATLAB

%{%%%%%%%%

%%%%%%%%%}

PASCAL

{*********

*********}

PYTHON

"""''''''

''''''"""

ROXYGEN2

#'''''''''
#'      #'
#'''''''''

SHELL

Note

sh, bash, zsh, fish, ps1, asm, fortran, vb, fsharp, julia perl, ruby

##########
#        #
##########

VIM

""""""""""
"        "
""""""""""

About

Neovim plugin: builds a heading comment from selection and paste above

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages