A Neovim plugin to change js/ts
comment into JSDoc
style.
- With
lazy.nvim
:
return {
-- change ts comment case
{
'moecasts/nvim-ts-comment-case',
build = function(plugin)
os.execute(string.format('cd %s && npm i --no-save', plugin.dir))
end,
config = function(plugin)
require('ts_comment_case').setup({
plugin_dir = plugin.dir,
})
end,
},
}
return {
-- change ts comment case
{
'moecasts/nvim-ts-comment-case',
build = function(plugin)
os.execute(string.format('cd %s && npm i --no-save', plugin.dir))
end,
config = function(plugin)
require('ts_comment_case').setup({
plugin_dir = plugin.dir,
})
end,
},
}
Property | Type | Description |
---|---|---|
plugin_dir | string? | the plugin directory, a npm package tscc will be installed in there |
keymaps | Keymaps? | the keymaps of the plugin actions |
{
config = function(plugin)
require('ts_comment_case').setup({
plugin_dir = '',
keymaps = {
transform_jsdoc = '<leader>cctj',
range_transform_jsdoc = '<leader>cctj',
transform_single = '<leader>ccts',
range_transform_single = '<leader>ccts',
move_trailing_comment_to_leading = '<leader>ccm',
range_move_trailing_comment_to_leading = '<leader>ccm',
move_and_transform_jsdoc = '<leader>ccxj',
range_move_and_transform_jsdoc = '<leader>ccxj',
move_and_transform_single = '<leader>ccxs',
range_move_and_transform_single = '<leader>ccxs',
},
})
end,
},
-
<leader>cctj
: Comment case as JSDoc -
<leader>ccts
: Comment case as single line -
<leader>ccm
: Move tailing comment to leading comment -
<leader>ccxj
: Move Trailing comment and Comment case as JSDoc -
<leader>ccxs
: Move Trailing comment and Comment case as single line
TSCCTransformJSDoc
: Comment case as JSDoc all linesTSCCRangeTransformJSDoc
: Comment case as JSDoc selected linesTSCCTransformSingle
: Comment case as single line all linesTSCCRangeTransformSingle
: Comment case as single line selected linesTSCCMove
: Move tailing comment to leading comment all linesTSCCRangeMove
: Move tailing comment to leading comment selected linesTSCCMoveTransformJSDoc
: Move Trailing comment and Comment case as JSDoc all linesTSCCRangeMoveTransformJSDoc
: Move Trailing comment and Comment case as JSDoc selected linesTSCCMoveTransformSingle
: Move Trailing comment and Comment case as single line all linesTSCCRangeMoveTransformSingle
: Move Trailing comment and Comment case as single line selected lines