Implement additional comments commands (open_comment_above
, open_comment_below
etc.)
#8167
Unanswered
andreystepanov
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I find myself writing custom commands to add comment lines above/below current line, to easily document code i'm writing. Especially true for
haddock
style comments used in Haskell.Currently i can achieve this with following configuration:
The problem with this approach is that i can't have single shortcut for all the languages i might write. In this case it will only work for languages with the
comment-token = "--"
.It would've been nice to have a dedicated commands that can insert/append new comment lines using
comment-token
defined in configuration of currently active language. All of this information is already available to the editor.Suggested names might be:
add_comment_line_above
(similar toadd_newline_above
)add_comment_line_below
(similar toadd_newline_below
)But since it puts user in
Insert Mode
after execution, maybe would be better to useopen_
prefix, similar toopen_above
/open_below
commands.open_comment_above
- opens new comment line above selection.open_comment_below
- opens new comment line below selection.Basic commands:
insert_comment_token
- insertscomment-token
and 1 space before each selection (similar to:insert-output
).append_comment_token
- appendscomment-token
and 1 space after each selection (similar to:append-output
).insert_comment_token
/append_comment_token
might be a basis for other commands - which may cover other use-cases - such as commenting the rest of the line (everything after current cursor), or commenting just a part of the line (using block comments).Having basic commands we then can also implement universal keybindings using following configuration (in this case there's no hard-coded
comment-token
's and it will work in any language):What do you think?
Beta Was this translation helpful? Give feedback.
All reactions