Merge remote-tracking branch 'lenormf/key-percent'

This commit is contained in:
Maxime Coste 2020-06-25 20:58:26 +10:00
commit f5127f8b22
4 changed files with 9 additions and 8 deletions

View File

@ -170,7 +170,7 @@ the Shift modifier and moving will extend each selection instead.
trim selections to only contain full lines (not including last trim selections to only contain full lines (not including last
end-of-line) end-of-line)
*%*:: *%*, *<percent>*::
select whole buffer select whole buffer
*<a-h>*:: *<a-h>*::

View File

@ -96,7 +96,7 @@ define-command -hidden modeline-parse-impl %{
# [text]{white}{vi:|vim:|Vim:|ex:}[white]se[t] {options}:[text] # [text]{white}{vi:|vim:|Vim:|ex:}[white]se[t] {options}:[text]
define-command modeline-parse -docstring "Read and interpret vi-format modelines at the beginning/end of the buffer" %{ define-command modeline-parse -docstring "Read and interpret vi-format modelines at the beginning/end of the buffer" %{
try %{ evaluate-commands -draft %{ try %{ evaluate-commands -draft %{
execute-keys \%s\A|.\z<ret> %opt{modelines}k <a-x> %opt{modelines}X \ execute-keys <percent> s\A|.\z<ret> %opt{modelines}k <a-x> %opt{modelines}X \
s^\S*?\s+?(vim?|kak(oune)?):\s?[^\n]+<ret> <a-x> s^\S*?\s+?(vim?|kak(oune)?):\s?[^\n]+<ret> <a-x>
evaluate-commands -draft -itersel modeline-parse-impl evaluate-commands -draft -itersel modeline-parse-impl
} } } }

View File

@ -8,7 +8,7 @@ declare-option -hidden range-specs doc_anchors
define-command -hidden -params 4 doc-render-regex %{ define-command -hidden -params 4 doc-render-regex %{
evaluate-commands -draft %{ try %{ evaluate-commands -draft %{ try %{
execute-keys \%s %arg{1} <ret> execute-keys <percent> s %arg{1} <ret>
execute-keys -draft s %arg{2} <ret> d execute-keys -draft s %arg{2} <ret> d
execute-keys "%arg{3}" execute-keys "%arg{3}"
evaluate-commands %sh{ evaluate-commands %sh{
@ -23,7 +23,7 @@ define-command -hidden -params 4 doc-render-regex %{
define-command -hidden doc-parse-links %{ define-command -hidden doc-parse-links %{
evaluate-commands -draft %{ try %{ evaluate-commands -draft %{ try %{
execute-keys \%s <lt><lt>(.*?),.*?<gt><gt> <ret> execute-keys <percent> s <lt><lt>(.*?),.*?<gt><gt> <ret>
execute-keys -draft s <lt><lt>.*,|<gt><gt> <ret> d execute-keys -draft s <lt><lt>.*,|<gt><gt> <ret> d
execute-keys H execute-keys H
set-option buffer doc_links %val{timestamp} set-option buffer doc_links %val{timestamp}
@ -39,13 +39,13 @@ define-command -hidden doc-parse-anchors %{
evaluate-commands -draft %{ try %{ evaluate-commands -draft %{ try %{
set-option buffer doc_anchors %val{timestamp} set-option buffer doc_anchors %val{timestamp}
# Find sections as add them as imlicit anchors # Find sections as add them as imlicit anchors
execute-keys \%s ^={2,}\h+([^\n]+)$ <ret> execute-keys <percent> s ^={2,}\h+([^\n]+)$ <ret>
evaluate-commands -itersel %{ evaluate-commands -itersel %{
set-option -add buffer doc_anchors "%val{selection_desc}|%sh{printf '%s' ""$kak_main_reg_1"" | tr '[A-Z ]' '[a-z-]'}" set-option -add buffer doc_anchors "%val{selection_desc}|%sh{printf '%s' ""$kak_main_reg_1"" | tr '[A-Z ]' '[a-z-]'}"
} }
# Parse explicit anchors and remove their text # Parse explicit anchors and remove their text
execute-keys \%s \[\[(.*?)\]\]\s* <ret> execute-keys <percent> s \[\[(.*?)\]\]\s* <ret>
evaluate-commands -itersel %{ evaluate-commands -itersel %{
set-option -add buffer doc_anchors "%val{selection_desc}|%reg{1}" set-option -add buffer doc_anchors "%val{selection_desc}|%reg{1}"
} }
@ -110,7 +110,7 @@ define-command -params 1 -hidden doc-render %{
} }
# Remove some line end markers # Remove some line end markers
try %{ execute-keys -draft \%s \h*(\+|:{2,})$ <ret> d } try %{ execute-keys -draft <percent> s \h*(\+|:{2,})$ <ret> d }
# Setup the doc_render_ranges option # Setup the doc_render_ranges option
set-option buffer doc_render_ranges %val{timestamp} set-option buffer doc_render_ranges %val{timestamp}
@ -124,7 +124,7 @@ define-command -params 1 -hidden doc-render %{
doc-parse-links doc-parse-links
# Remove escaping of * and ` # Remove escaping of * and `
try %{ execute-keys -draft \%s \\((?=\*)|(?=`)) <ret> d } try %{ execute-keys -draft <percent> s \\((?=\*)|(?=`)) <ret> d }
set-option buffer readonly true set-option buffer readonly true
add-highlighter buffer/ ranges doc_render_ranges add-highlighter buffer/ ranges doc_render_ranges

View File

@ -79,6 +79,7 @@ static constexpr KeyAndName keynamemap[] = {
{ "plus", '+' }, { "plus", '+' },
{ "minus", '-' }, { "minus", '-' },
{ "semicolon", ';' }, { "semicolon", ';' },
{ "percent", '%' },
}; };
KeyList parse_keys(StringView str) KeyList parse_keys(StringView str)