GitHub | 您所在的位置:网站首页 › commentat › GitHub |
// Comment.nvim
⚡ Smart and Powerful commenting plugin for neovim ⚡ Most languages/filetypes have native support for comments via commentstring but there might be a filetype that is not supported. There are two ways to enable commenting for unsupported filetypes: You can set commentstring for that particular filetype like the following. Read :h commentstring for more info. vim.bo.commentstring = '//%s' -- or vim.api.nvim_command('set commentstring=//%s') You can also use this plugin interface to store both line and block commentstring for the filetype. You can treat this as a more powerful version of the commentstring. Read :h comment.ft for more info. local ft = require('Comment.ft') -- 1. Using set function ft -- Set only line comment .set('yaml', '#%s') -- Or set both line and block commentstring .set('javascript', {'//%s', '/*%s*/'}) -- 2. Metatable magic ft.javascript = {'//%s', '/*%s*/'} ft.yaml = '#%s' -- Multiple filetypes ft({'go', 'rust'}, ft.get('c')) ft({'toml', 'graphql'}, '#%s')PR(s) are welcome to add more commentstring inside the plugin 🤝 ContributingThere are multiple ways to contribute reporting/fixing bugs, feature requests. You can also submit commentstring to this plugin by updating ft.lua and sending PR. 📺 Videos TakeTuesday E02: Comment.nvim by TJ DeVries 💐 Credits tcomment - To be with me forever and motivated me to write this. nvim-comment - Little and less powerful cousin. Also I took some code from it. kommentary - Nicely done plugin but lacks some features. But it helped me to design this plugin. 🚗 Roadmap Doc comment i.e /**%s*/ (js), ///%s (rust) Header comment ---------------------- -- This is a header -- ---------------------- |
CopyRight 2018-2019 实验室设备网 版权所有 |