rename line and block comments options
This commit is contained in:
parent
98cc81ae07
commit
165227dac2
|
@ -1,93 +1,93 @@
|
||||||
## Characters that will be inserted at the beginning of a line to comment
|
## Line comments
|
||||||
decl str comment_line_chars "#"
|
decl str comment_line "#"
|
||||||
|
|
||||||
## Characters that will be used to surround a selection with
|
## Block comments
|
||||||
decl str-list comment_block_chars ""
|
decl str-list comment_block ""
|
||||||
|
|
||||||
## Default characters for all languages
|
## Default comments for all languages
|
||||||
hook global BufSetOption filetype=asciidoc %{
|
hook global BufSetOption filetype=asciidoc %{
|
||||||
set buffer comment_block_chars '///:///'
|
set buffer comment_block '///:///'
|
||||||
}
|
}
|
||||||
|
|
||||||
hook global BufSetOption filetype=(c|cpp|go|java|javascript|objc|sass|scala|scss|swift) %{
|
hook global BufSetOption filetype=(c|cpp|go|java|javascript|objc|sass|scala|scss|swift) %{
|
||||||
set buffer comment_line_chars '//'
|
set buffer comment_line '//'
|
||||||
set buffer comment_block_chars '/*:*/'
|
set buffer comment_block '/*:*/'
|
||||||
}
|
}
|
||||||
|
|
||||||
hook global BufSetOption filetype=(cabal|haskell|moon) %{
|
hook global BufSetOption filetype=(cabal|haskell|moon) %{
|
||||||
set buffer comment_line_chars '--'
|
set buffer comment_line '--'
|
||||||
}
|
}
|
||||||
|
|
||||||
hook global BufSetOption filetype=clojure %{
|
hook global BufSetOption filetype=clojure %{
|
||||||
set buffer comment_line_chars '#_ '
|
set buffer comment_line '#_ '
|
||||||
set buffer comment_block_chars '(comment :)'
|
set buffer comment_block '(comment :)'
|
||||||
}
|
}
|
||||||
|
|
||||||
hook global BufSetOption filetype=coffee %{
|
hook global BufSetOption filetype=coffee %{
|
||||||
set buffer comment_block_chars '###:###'
|
set buffer comment_block '###:###'
|
||||||
}
|
}
|
||||||
|
|
||||||
hook global BufSetOption filetype=css %{
|
hook global BufSetOption filetype=css %{
|
||||||
set buffer comment_line_chars ''
|
set buffer comment_line ''
|
||||||
set buffer comment_block_chars '/*:*/'
|
set buffer comment_block '/*:*/'
|
||||||
}
|
}
|
||||||
|
|
||||||
hook global BufSetOption filetype=d %{
|
hook global BufSetOption filetype=d %{
|
||||||
set buffer comment_line_chars '//'
|
set buffer comment_line '//'
|
||||||
set buffer comment_block_chars '/+:+/'
|
set buffer comment_block '/+:+/'
|
||||||
}
|
}
|
||||||
|
|
||||||
hook global BufSetOption filetype=(gas|ini) %{
|
hook global BufSetOption filetype=(gas|ini) %{
|
||||||
set buffer comment_line_chars ';'
|
set buffer comment_line ';'
|
||||||
}
|
}
|
||||||
|
|
||||||
hook global BufSetOption filetype=haml %{
|
hook global BufSetOption filetype=haml %{
|
||||||
set buffer comment_line_chars '-#'
|
set buffer comment_line '-#'
|
||||||
}
|
}
|
||||||
|
|
||||||
hook global BufSetOption filetype=html %{
|
hook global BufSetOption filetype=html %{
|
||||||
set buffer comment_line_chars ''
|
set buffer comment_line ''
|
||||||
set buffer comment_block_chars '<!--:-->'
|
set buffer comment_block '<!--:-->'
|
||||||
}
|
}
|
||||||
|
|
||||||
hook global BufSetOption filetype=latex %{
|
hook global BufSetOption filetype=latex %{
|
||||||
set buffer comment_line_chars '%'
|
set buffer comment_line '%'
|
||||||
}
|
}
|
||||||
|
|
||||||
hook global BufSetOption filetype=lisp %{
|
hook global BufSetOption filetype=lisp %{
|
||||||
set buffer comment_line_chars ';'
|
set buffer comment_line ';'
|
||||||
set buffer comment_block_chars '#|:|#'
|
set buffer comment_block '#|:|#'
|
||||||
}
|
}
|
||||||
|
|
||||||
hook global BufSetOption filetype=lua %{
|
hook global BufSetOption filetype=lua %{
|
||||||
set buffer comment_line_chars '--'
|
set buffer comment_line '--'
|
||||||
set buffer comment_block_chars '--[[:]]'
|
set buffer comment_block '--[[:]]'
|
||||||
}
|
}
|
||||||
|
|
||||||
hook global BufSetOption filetype=markdown %{
|
hook global BufSetOption filetype=markdown %{
|
||||||
set buffer comment_line_chars ''
|
set buffer comment_line ''
|
||||||
set buffer comment_block_chars '[//]: # (:)'
|
set buffer comment_block '[//]: # (:)'
|
||||||
}
|
}
|
||||||
|
|
||||||
hook global BufSetOption filetype=perl %{
|
hook global BufSetOption filetype=perl %{
|
||||||
set buffer comment_block_chars '#[:]'
|
set buffer comment_block '#[:]'
|
||||||
}
|
}
|
||||||
|
|
||||||
hook global BufSetOption filetype=(pug|rust) %{
|
hook global BufSetOption filetype=(pug|rust) %{
|
||||||
set buffer comment_line_chars '//'
|
set buffer comment_line '//'
|
||||||
}
|
}
|
||||||
|
|
||||||
hook global BufSetOption filetype=python %{
|
hook global BufSetOption filetype=python %{
|
||||||
set buffer comment_block_chars '\'\'\':\'\'\''
|
set buffer comment_block '\'\'\':\'\'\''
|
||||||
}
|
}
|
||||||
|
|
||||||
hook global BufSetOption filetype=ragel %{
|
hook global BufSetOption filetype=ragel %{
|
||||||
set buffer comment_line_chars '%%'
|
set buffer comment_line '%%'
|
||||||
set buffer comment_block_chars '%%{:}%%'
|
set buffer comment_block '%%{:}%%'
|
||||||
}
|
}
|
||||||
|
|
||||||
hook global BufSetOption filetype=ruby %{
|
hook global BufSetOption filetype=ruby %{
|
||||||
set buffer comment_block_chars '^begin=:^=end'
|
set buffer comment_block '^begin=:^=end'
|
||||||
}
|
}
|
||||||
|
|
||||||
def comment-block -docstring "(un)comment selected lines using block comments" %{
|
def comment-block -docstring "(un)comment selected lines using block comments" %{
|
||||||
|
@ -97,11 +97,11 @@ def comment-block -docstring "(un)comment selected lines using block comments" %
|
||||||
printf %s\\n "$@" | sed 's,<,<lt>,g'
|
printf %s\\n "$@" | sed 's,<,<lt>,g'
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly opening=$(exec_proof "${kak_opt_comment_block_chars%:*}")
|
readonly opening=$(exec_proof "${kak_opt_comment_block%:*}")
|
||||||
readonly closing=$(exec_proof "${kak_opt_comment_block_chars##*:}")
|
readonly closing=$(exec_proof "${kak_opt_comment_block##*:}")
|
||||||
|
|
||||||
if [ -z "${opening}" ] || [ -z "${closing}" ]; then
|
if [ -z "${opening}" ] || [ -z "${closing}" ]; then
|
||||||
echo "echo -debug 'The \`comment_block_chars\` variable is empty, could not comment the selection'"
|
echo "echo -debug 'The \`comment_block\` variable is empty, could not comment the selection'"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -125,11 +125,11 @@ def comment-block -docstring "(un)comment selected lines using block comments" %
|
||||||
|
|
||||||
def comment-line -docstring "(un)comment selected lines using line comments" %{
|
def comment-line -docstring "(un)comment selected lines using line comments" %{
|
||||||
%sh{
|
%sh{
|
||||||
readonly opening="${kak_opt_comment_line_chars}"
|
readonly opening="${kak_opt_comment_line}"
|
||||||
readonly opening_escaped="\\Q${opening}\\E"
|
readonly opening_escaped="\\Q${opening}\\E"
|
||||||
|
|
||||||
if [ -z "${opening}" ]; then
|
if [ -z "${opening}" ]; then
|
||||||
echo "echo -debug 'The \`comment_line_chars\` variable is empty, could not comment the line'"
|
echo "echo -debug 'The \`comment_line\` variable is empty, could not comment the line'"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user