From 4ad4b2d41a4f9618284621a672d29a193f455b73 Mon Sep 17 00:00:00 2001 From: Alex Leferry 2 Date: Sun, 15 Jan 2017 14:25:32 +0100 Subject: [PATCH 1/7] rename commenting.kak to comment.kak --- rc/core/{commenting.kak => comment.kak} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename rc/core/{commenting.kak => comment.kak} (100%) diff --git a/rc/core/commenting.kak b/rc/core/comment.kak similarity index 100% rename from rc/core/commenting.kak rename to rc/core/comment.kak From 1f0ec535bdb9bb0588b0438c5879fd0738d2298f Mon Sep 17 00:00:00 2001 From: Alex Leferry 2 Date: Sun, 15 Jan 2017 14:43:45 +0100 Subject: [PATCH 2/7] tweak :comment-line behaviour to comment selected lines --- rc/core/comment.kak | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rc/core/comment.kak b/rc/core/comment.kak index 7e89d749..127b5163 100644 --- a/rc/core/comment.kak +++ b/rc/core/comment.kak @@ -123,7 +123,7 @@ def comment-selection -docstring "Comment/uncomment the current selection" %{ } } -def comment-line -docstring "Comment/uncomment the current line" %{ +def comment-line -docstring "(un)comment selected lines using line comments" %{ %sh{ readonly opening="${kak_opt_comment_line_chars}" readonly opening_escaped="\\Q${opening}\\E" @@ -134,8 +134,8 @@ def comment-line -docstring "Comment/uncomment the current line" %{ fi printf %s\\n "eval -draft %{ - ## Select the content of the line, without indentation - exec I + ## Select the content of the lines, without indentation + exec I try %{ ## There's no text on the line From 98cc81ae07f6152a9465a3e4b6e0b78057c06a7d Mon Sep 17 00:00:00 2001 From: Alex Leferry 2 Date: Sun, 15 Jan 2017 14:45:22 +0100 Subject: [PATCH 3/7] rename :comment-selection to :comment-block --- rc/core/comment.kak | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/rc/core/comment.kak b/rc/core/comment.kak index 127b5163..003436dc 100644 --- a/rc/core/comment.kak +++ b/rc/core/comment.kak @@ -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,<,,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 From 165227dac2ee91f5d4361e061bae26c1329ca9d3 Mon Sep 17 00:00:00 2001 From: Alex Leferry 2 Date: Sun, 15 Jan 2017 14:58:07 +0100 Subject: [PATCH 4/7] rename line and block comments options --- rc/core/comment.kak | 76 ++++++++++++++++++++++----------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/rc/core/comment.kak b/rc/core/comment.kak index 003436dc..cbf48712 100644 --- a/rc/core/comment.kak +++ b/rc/core/comment.kak @@ -1,93 +1,93 @@ -## Characters that will be inserted at the beginning of a line to comment -decl str comment_line_chars "#" +## Line comments +decl str comment_line "#" -## Characters that will be used to surround a selection with -decl str-list comment_block_chars "" +## Block comments +decl str-list comment_block "" -## Default characters for all languages +## Default comments for all languages 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) %{ - set buffer comment_line_chars '//' - set buffer comment_block_chars '/*:*/' + set buffer comment_line '//' + set buffer comment_block '/*:*/' } hook global BufSetOption filetype=(cabal|haskell|moon) %{ - set buffer comment_line_chars '--' + set buffer comment_line '--' } hook global BufSetOption filetype=clojure %{ - set buffer comment_line_chars '#_ ' - set buffer comment_block_chars '(comment :)' + set buffer comment_line '#_ ' + set buffer comment_block '(comment :)' } hook global BufSetOption filetype=coffee %{ - set buffer comment_block_chars '###:###' + set buffer comment_block '###:###' } hook global BufSetOption filetype=css %{ - set buffer comment_line_chars '' - set buffer comment_block_chars '/*:*/' + set buffer comment_line '' + set buffer comment_block '/*:*/' } hook global BufSetOption filetype=d %{ - set buffer comment_line_chars '//' - set buffer comment_block_chars '/+:+/' + set buffer comment_line '//' + set buffer comment_block '/+:+/' } hook global BufSetOption filetype=(gas|ini) %{ - set buffer comment_line_chars ';' + set buffer comment_line ';' } hook global BufSetOption filetype=haml %{ - set buffer comment_line_chars '-#' + set buffer comment_line '-#' } hook global BufSetOption filetype=html %{ - set buffer comment_line_chars '' - set buffer comment_block_chars '' + set buffer comment_line '' + set buffer comment_block '' } hook global BufSetOption filetype=latex %{ - set buffer comment_line_chars '%' + set buffer comment_line '%' } hook global BufSetOption filetype=lisp %{ - set buffer comment_line_chars ';' - set buffer comment_block_chars '#|:|#' + set buffer comment_line ';' + set buffer comment_block '#|:|#' } hook global BufSetOption filetype=lua %{ - set buffer comment_line_chars '--' - set buffer comment_block_chars '--[[:]]' + set buffer comment_line '--' + set buffer comment_block '--[[:]]' } hook global BufSetOption filetype=markdown %{ - set buffer comment_line_chars '' - set buffer comment_block_chars '[//]: # (:)' + set buffer comment_line '' + set buffer comment_block '[//]: # (:)' } hook global BufSetOption filetype=perl %{ - set buffer comment_block_chars '#[:]' + set buffer comment_block '#[:]' } hook global BufSetOption filetype=(pug|rust) %{ - set buffer comment_line_chars '//' + set buffer comment_line '//' } hook global BufSetOption filetype=python %{ - set buffer comment_block_chars '\'\'\':\'\'\'' + set buffer comment_block '\'\'\':\'\'\'' } hook global BufSetOption filetype=ragel %{ - set buffer comment_line_chars '%%' - set buffer comment_block_chars '%%{:}%%' + set buffer comment_line '%%' + set buffer comment_block '%%{:}%%' } 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" %{ @@ -97,11 +97,11 @@ def comment-block -docstring "(un)comment selected lines using block comments" % printf %s\\n "$@" | sed 's,<,,g' } - readonly opening=$(exec_proof "${kak_opt_comment_block_chars%:*}") - readonly closing=$(exec_proof "${kak_opt_comment_block_chars##*:}") + readonly opening=$(exec_proof "${kak_opt_comment_block%:*}") + readonly closing=$(exec_proof "${kak_opt_comment_block##*:}") 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 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" %{ %sh{ - readonly opening="${kak_opt_comment_line_chars}" + readonly opening="${kak_opt_comment_line}" readonly opening_escaped="\\Q${opening}\\E" 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 fi From d6cb1b8e53b8d2243fd20eea3e77339860e60a61 Mon Sep 17 00:00:00 2001 From: Alex Leferry 2 Date: Sun, 15 Jan 2017 15:05:01 +0100 Subject: [PATCH 5/7] fix typo --- rc/core/comment.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/core/comment.kak b/rc/core/comment.kak index cbf48712..ea48b008 100644 --- a/rc/core/comment.kak +++ b/rc/core/comment.kak @@ -138,7 +138,7 @@ def comment-line -docstring "(un)comment selected lines using line comments" %{ exec I try %{ - ## There's no text on the line + ## There’s no text on the line exec \\A[\\h\\v\\n]*\\z try %{ From b66d58b70322e48549159a2a65ea3fe0ccdbe179 Mon Sep 17 00:00:00 2001 From: Alex Leferry 2 Date: Sun, 15 Jan 2017 15:07:17 +0100 Subject: [PATCH 6/7] remove optional value --- rc/core/comment.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/core/comment.kak b/rc/core/comment.kak index ea48b008..f0f73ce7 100644 --- a/rc/core/comment.kak +++ b/rc/core/comment.kak @@ -2,7 +2,7 @@ decl str comment_line "#" ## Block comments -decl str-list comment_block "" +decl str-list comment_block ## Default comments for all languages hook global BufSetOption filetype=asciidoc %{ From 4f3c28aa377789f35d48ab8c5d6deb2e41006284 Mon Sep 17 00:00:00 2001 From: Alex Leferry 2 Date: Sun, 15 Jan 2017 15:12:57 +0100 Subject: [PATCH 7/7] fix quote convention --- rc/core/comment.kak | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rc/core/comment.kak b/rc/core/comment.kak index f0f73ce7..c536ece3 100644 --- a/rc/core/comment.kak +++ b/rc/core/comment.kak @@ -1,5 +1,5 @@ ## Line comments -decl str comment_line "#" +decl str comment_line '#' ## Block comments decl str-list comment_block @@ -90,7 +90,7 @@ hook global BufSetOption filetype=ruby %{ 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' %{ %sh{ exec_proof() { ## Replace the '<' sign that is interpreted differently in `exec` @@ -123,7 +123,7 @@ 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{ readonly opening="${kak_opt_comment_line}" readonly opening_escaped="\\Q${opening}\\E"