Let's start simple: let's get our plugin to add a key binding that comments out the current line by prefixing it with a Python-style comment (#).
Let's start in ~/.vim/pack/plugins/start/vim-commenter/plugin/commenter.vim:
" Comment out the current line in Python.function! g:commenter#Comment() let l:line = getline('.') call setline('.', '# ' . l:line)endfunctionnnoremap gc :call g:commenter#Comment()<cr>
In the previous example, we've created a function that inserts # in front of the current line (.) and maps it to gc. As you might remember, g, while having some mappings assigned to it (see :help g), is effectively a free namespace for the user to fill, and c stands for "comment".