Move the commenting variables back to commenting.kak
Initialising the `comment_line_chars` and `comment_selection_chars` variables in language support scripts created a hard dependency of those scripts to `commenting.kak`, which would create errors when this script was not loaded, e.g. when running tests.
This commit is contained in:
parent
67a8e8ca3c
commit
5db1d1beef
|
@ -72,8 +72,6 @@ hook global WinSetOption filetype=css %[
|
||||||
hook window InsertEnd .* -group css-hooks _css_filter_around_selections
|
hook window InsertEnd .* -group css-hooks _css_filter_around_selections
|
||||||
hook window InsertChar \n -group css-indent _css_indent_on_new_line
|
hook window InsertChar \n -group css-indent _css_indent_on_new_line
|
||||||
hook window InsertChar \} -group css-indent _css_indent_on_closing_curly_brace
|
hook window InsertChar \} -group css-indent _css_indent_on_closing_curly_brace
|
||||||
|
|
||||||
set comment_line_chars ""
|
|
||||||
]
|
]
|
||||||
|
|
||||||
hook -group css-highlight global WinSetOption filetype=(?!css).* %{ rmhl css }
|
hook -group css-highlight global WinSetOption filetype=(?!css).* %{ rmhl css }
|
||||||
|
|
|
@ -110,8 +110,6 @@ hook global WinSetOption filetype=d %{
|
||||||
hook window InsertChar \n -group d-indent _d-indent-on-new-line
|
hook window InsertChar \n -group d-indent _d-indent-on-new-line
|
||||||
hook window InsertChar \{ -group d-indent _d-indent-on-opening-curly-brace
|
hook window InsertChar \{ -group d-indent _d-indent-on-opening-curly-brace
|
||||||
hook window InsertChar \} -group d-indent _d-indent-on-closing-curly-brace
|
hook window InsertChar \} -group d-indent _d-indent-on-closing-curly-brace
|
||||||
|
|
||||||
set window comment_selection_chars "/+:+/"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
hook -group d-highlight global WinSetOption filetype=(?!d).* %{ rmhl d }
|
hook -group d-highlight global WinSetOption filetype=(?!d).* %{ rmhl d }
|
||||||
|
|
|
@ -69,8 +69,6 @@ hook global WinSetOption filetype=html %{
|
||||||
hook window InsertEnd .* -group html-hooks _html_filter_around_selections
|
hook window InsertEnd .* -group html-hooks _html_filter_around_selections
|
||||||
hook window InsertChar .* -group html-indent _html_indent_on_char
|
hook window InsertChar .* -group html-indent _html_indent_on_char
|
||||||
hook window InsertChar \n -group html-indent _html_indent_on_new_line
|
hook window InsertChar \n -group html-indent _html_indent_on_new_line
|
||||||
|
|
||||||
set window comment_selection_chars '<!--:-->'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
hook -group html-highlight global WinSetOption filetype=(?!html).* %{ rmhl html }
|
hook -group html-highlight global WinSetOption filetype=(?!html).* %{ rmhl html }
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
# http://lua.org
|
# http://lua.org
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
# require commenting.kak
|
|
||||||
|
|
||||||
# Detection
|
# Detection
|
||||||
# ‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -103,9 +101,6 @@ hook global WinSetOption filetype=lua %{
|
||||||
hook window InsertChar \n -group lua-indent _lua_indent_on_new_line
|
hook window InsertChar \n -group lua-indent _lua_indent_on_new_line
|
||||||
|
|
||||||
alias window alt lua-alternative-file
|
alias window alt lua-alternative-file
|
||||||
|
|
||||||
set window comment_line_chars '--'
|
|
||||||
set window comment_selection_chars '\Q--[[:]]'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
hook -group lua-highlight global WinSetOption filetype=(?!lua).* %{ rmhl lua }
|
hook -group lua-highlight global WinSetOption filetype=(?!lua).* %{ rmhl lua }
|
||||||
|
|
|
@ -117,9 +117,6 @@ hook global WinSetOption filetype=perl %{
|
||||||
hook window InsertChar \n -group perl-indent _perl-indent-on-new-line
|
hook window InsertChar \n -group perl-indent _perl-indent-on-new-line
|
||||||
hook window InsertChar \{ -group perl-indent _perl-indent-on-opening-curly-brace
|
hook window InsertChar \{ -group perl-indent _perl-indent-on-opening-curly-brace
|
||||||
hook window InsertChar \} -group perl-indent _perl-indent-on-closing-curly-brace
|
hook window InsertChar \} -group perl-indent _perl-indent-on-closing-curly-brace
|
||||||
|
|
||||||
set window comment_selection_chars ""
|
|
||||||
set window comment_line_chars "#"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
hook -group perl-highlight global WinSetOption filetype=(?!perl).* %{ rmhl perl }
|
hook -group perl-highlight global WinSetOption filetype=(?!perl).* %{ rmhl perl }
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
# http://ruby-lang.org
|
# http://ruby-lang.org
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
# require commenting.kak
|
|
||||||
|
|
||||||
# Detection
|
# Detection
|
||||||
# ‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -158,9 +156,6 @@ hook global WinSetOption filetype=ruby %{
|
||||||
hook window InsertChar \n -group ruby-insert _ruby_insert_on_new_line
|
hook window InsertChar \n -group ruby-insert _ruby_insert_on_new_line
|
||||||
|
|
||||||
alias window alt ruby-alternative-file
|
alias window alt ruby-alternative-file
|
||||||
|
|
||||||
set window comment_line_chars '#'
|
|
||||||
set window comment_selection_chars '^begin=:^=end'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
hook -group ruby-highlight global WinSetOption filetype=(?!ruby).* %{ rmhl ruby }
|
hook -group ruby-highlight global WinSetOption filetype=(?!ruby).* %{ rmhl ruby }
|
||||||
|
|
|
@ -4,6 +4,50 @@ decl str-list comment_selection_chars "/*:*/"
|
||||||
## Characters that will be inserted at the beginning of a line to comment
|
## Characters that will be inserted at the beginning of a line to comment
|
||||||
decl str comment_line_chars "//"
|
decl str comment_line_chars "//"
|
||||||
|
|
||||||
|
## Default characters for all languages
|
||||||
|
hook global BufSetOption filetype=coffee %{
|
||||||
|
set buffer comment_line_chars '#'
|
||||||
|
set buffer comment_selection_chars '###:###'
|
||||||
|
}
|
||||||
|
|
||||||
|
hook global BufSetOption filetype=css %{
|
||||||
|
set buffer comment_line_chars ''
|
||||||
|
}
|
||||||
|
|
||||||
|
hook global BufSetOption filetype=d %{
|
||||||
|
set buffer comment_selection_chars '/+:+/'
|
||||||
|
}
|
||||||
|
|
||||||
|
hook global BufSetOption filetype=html %{
|
||||||
|
set buffer comment_line_chars ''
|
||||||
|
set buffer comment_selection_chars '<!--:-->'
|
||||||
|
}
|
||||||
|
|
||||||
|
hook global BufSetOption filetype=latex %{
|
||||||
|
set buffer comment_line_chars '%'
|
||||||
|
set buffer comment_selection_chars ''
|
||||||
|
}
|
||||||
|
|
||||||
|
hook global BufSetOption filetype=lua %{
|
||||||
|
set buffer comment_line_chars '--'
|
||||||
|
set buffer comment_selection_chars '--[[:]]'
|
||||||
|
}
|
||||||
|
|
||||||
|
hook global BufSetOption filetype=moon %{
|
||||||
|
set buffer comment_line_chars '--'
|
||||||
|
set buffer comment_selection_chars ''
|
||||||
|
}
|
||||||
|
|
||||||
|
hook global BufSetOption filetype=(perl|makefile) %{
|
||||||
|
set buffer comment_line_chars '#'
|
||||||
|
set buffer comment_selection_chars ''
|
||||||
|
}
|
||||||
|
|
||||||
|
hook global BufSetOption filetype=ruby %{
|
||||||
|
set buffer comment_line_chars '#'
|
||||||
|
set buffer comment_selection_chars '^begin=:^=end'
|
||||||
|
}
|
||||||
|
|
||||||
def comment-selection -docstring "Comment/uncomment the current selection" %{
|
def comment-selection -docstring "Comment/uncomment the current selection" %{
|
||||||
%sh{
|
%sh{
|
||||||
function exec_proof {
|
function exec_proof {
|
||||||
|
|
|
@ -58,9 +58,6 @@ hook -group makefile-highlight global WinSetOption filetype=makefile %{ addhl re
|
||||||
|
|
||||||
hook global WinSetOption filetype=makefile %{
|
hook global WinSetOption filetype=makefile %{
|
||||||
hook window InsertChar \n -group makefile-indent _makefile-indent-on-new-line
|
hook window InsertChar \n -group makefile-indent _makefile-indent-on-new-line
|
||||||
|
|
||||||
set window comment_selection_chars ""
|
|
||||||
set window comment_line_chars "#"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
hook -group makefile-highlight global WinSetOption filetype=(?!makefile).* %{ rmhl makefile }
|
hook -group makefile-highlight global WinSetOption filetype=(?!makefile).* %{ rmhl makefile }
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
# http://coffeescript.org
|
# http://coffeescript.org
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
# require commenting.kak
|
|
||||||
|
|
||||||
# Detection
|
# Detection
|
||||||
# ‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -80,9 +78,6 @@ hook -group coffee-highlight global WinSetOption filetype=coffee %{ addhl ref co
|
||||||
hook global WinSetOption filetype=coffee %{
|
hook global WinSetOption filetype=coffee %{
|
||||||
hook window InsertEnd .* -group coffee-hooks _coffee_filter_around_selections
|
hook window InsertEnd .* -group coffee-hooks _coffee_filter_around_selections
|
||||||
hook window InsertChar \n -group coffee-indent _coffee_indent_on_new_line
|
hook window InsertChar \n -group coffee-indent _coffee_indent_on_new_line
|
||||||
|
|
||||||
set window comment_line_chars '#'
|
|
||||||
set window comment_selection_chars '###:###'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
hook -group coffee-highlight global WinSetOption filetype=(?!coffee).* %{ rmhl coffee }
|
hook -group coffee-highlight global WinSetOption filetype=(?!coffee).* %{ rmhl coffee }
|
||||||
|
|
|
@ -35,8 +35,4 @@ addhl -group /latex/content regex '\\textbf\{([^}]+)\}' 1:default+b
|
||||||
|
|
||||||
hook -group latex-highlight global WinSetOption filetype=latex %{ addhl ref latex }
|
hook -group latex-highlight global WinSetOption filetype=latex %{ addhl ref latex }
|
||||||
|
|
||||||
hook global WinSetOption filetype=latex %{
|
|
||||||
set window comment_line_chars '%'
|
|
||||||
}
|
|
||||||
|
|
||||||
hook -group latex-highlight global WinSetOption filetype=(?!latex).* %{ rmhl latex }
|
hook -group latex-highlight global WinSetOption filetype=(?!latex).* %{ rmhl latex }
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
# http://moonscript.org
|
# http://moonscript.org
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
# require commenting.kak
|
|
||||||
|
|
||||||
# Detection
|
# Detection
|
||||||
# ‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -106,9 +104,6 @@ hook global WinSetOption filetype=moon %{
|
||||||
hook window InsertChar \n -group moon-indent _moon_indent_on_new_line
|
hook window InsertChar \n -group moon-indent _moon_indent_on_new_line
|
||||||
|
|
||||||
alias window alt moon-alternative-file
|
alias window alt moon-alternative-file
|
||||||
|
|
||||||
set window comment_line_chars '--'
|
|
||||||
set window comment_selection_chars ''
|
|
||||||
}
|
}
|
||||||
|
|
||||||
hook -group moon-highlight global WinSetOption filetype=(?!moon).* %{ rmhl moon }
|
hook -group moon-highlight global WinSetOption filetype=(?!moon).* %{ rmhl moon }
|
||||||
|
|
Loading…
Reference in New Issue
Block a user