rename :comment-selection to :comment-block

This commit is contained in:
Alex Leferry 2 2017-01-15 14:45:22 +01:00
parent 1f0ec535bd
commit 98cc81ae07

View File

@ -2,16 +2,16 @@
decl str comment_line_chars "#"
## Characters that will be used to surround a selection with
decl str-list comment_selection_chars ""
decl str-list comment_block_chars ""
## Default characters for all languages
hook global BufSetOption filetype=asciidoc %{
set buffer comment_selection_chars '///:///'
set buffer comment_block_chars '///:///'
}
hook global BufSetOption filetype=(c|cpp|go|java|javascript|objc|sass|scala|scss|swift) %{
set buffer comment_line_chars '//'
set buffer comment_selection_chars '/*:*/'
set buffer comment_block_chars '/*:*/'
}
hook global BufSetOption filetype=(cabal|haskell|moon) %{
@ -20,21 +20,21 @@ hook global BufSetOption filetype=(cabal|haskell|moon) %{
hook global BufSetOption filetype=clojure %{
set buffer comment_line_chars '#_ '
set buffer comment_selection_chars '(comment :)'
set buffer comment_block_chars '(comment :)'
}
hook global BufSetOption filetype=coffee %{
set buffer comment_selection_chars '###:###'
set buffer comment_block_chars '###:###'
}
hook global BufSetOption filetype=css %{
set buffer comment_line_chars ''
set buffer comment_selection_chars '/*:*/'
set buffer comment_block_chars '/*:*/'
}
hook global BufSetOption filetype=d %{
set buffer comment_line_chars '//'
set buffer comment_selection_chars '/+:+/'
set buffer comment_block_chars '/+:+/'
}
hook global BufSetOption filetype=(gas|ini) %{
@ -47,7 +47,7 @@ hook global BufSetOption filetype=haml %{
hook global BufSetOption filetype=html %{
set buffer comment_line_chars ''
set buffer comment_selection_chars '<!--:-->'
set buffer comment_block_chars '<!--:-->'
}
hook global BufSetOption filetype=latex %{
@ -56,21 +56,21 @@ hook global BufSetOption filetype=latex %{
hook global BufSetOption filetype=lisp %{
set buffer comment_line_chars ';'
set buffer comment_selection_chars '#|:|#'
set buffer comment_block_chars '#|:|#'
}
hook global BufSetOption filetype=lua %{
set buffer comment_line_chars '--'
set buffer comment_selection_chars '--[[:]]'
set buffer comment_block_chars '--[[:]]'
}
hook global BufSetOption filetype=markdown %{
set buffer comment_line_chars ''
set buffer comment_selection_chars '[//]: # (:)'
set buffer comment_block_chars '[//]: # (:)'
}
hook global BufSetOption filetype=perl %{
set buffer comment_selection_chars '#[:]'
set buffer comment_block_chars '#[:]'
}
hook global BufSetOption filetype=(pug|rust) %{
@ -78,30 +78,30 @@ hook global BufSetOption filetype=(pug|rust) %{
}
hook global BufSetOption filetype=python %{
set buffer comment_selection_chars '\'\'\':\'\'\''
set buffer comment_block_chars '\'\'\':\'\'\''
}
hook global BufSetOption filetype=ragel %{
set buffer comment_line_chars '%%'
set buffer comment_selection_chars '%%{:}%%'
set buffer comment_block_chars '%%{:}%%'
}
hook global BufSetOption filetype=ruby %{
set buffer comment_selection_chars '^begin=:^=end'
set buffer comment_block_chars '^begin=:^=end'
}
def comment-selection -docstring "Comment/uncomment the current selection" %{
def comment-block -docstring "(un)comment selected lines using block comments" %{
%sh{
exec_proof() {
## Replace the '<' sign that is interpreted differently in `exec`
printf %s\\n "$@" | sed 's,<,<lt>,g'
}
readonly opening=$(exec_proof "${kak_opt_comment_selection_chars%:*}")
readonly closing=$(exec_proof "${kak_opt_comment_selection_chars##*:}")
readonly opening=$(exec_proof "${kak_opt_comment_block_chars%:*}")
readonly closing=$(exec_proof "${kak_opt_comment_block_chars##*:}")
if [ -z "${opening}" ] || [ -z "${closing}" ]; then
echo "echo -debug 'The \`comment_selection_chars\` variable is empty, could not comment the selection'"
echo "echo -debug 'The \`comment_block_chars\` variable is empty, could not comment the selection'"
exit
fi