mirror of
https://github.com/mawww/kakoune.git
synced 2024-10-26 21:57:54 +03:00
Compare commits
6 Commits
e54932cb39
...
6cdd1c083f
Author | SHA1 | Date | |
---|---|---|---|
|
6cdd1c083f | ||
|
6674fe7587 | ||
|
4a00a6edea | ||
|
6493ddad42 | ||
|
880ad98a30 | ||
|
0bb355557e |
@ -41,22 +41,27 @@ highlighter is replaced with the new one.
|
||||
using the `Whitespace` face, with the following *options*:
|
||||
|
||||
*-lf* <separator>:::
|
||||
a one character long separator that will replace line feeds
|
||||
a one character long separator that will replace line feeds,
|
||||
or an empty string to ignore them.
|
||||
|
||||
*-spc* <separator>:::
|
||||
a one character long separator that will replace spaces
|
||||
a one character long separator that will replace spaces,
|
||||
or an empty string to ignore them.
|
||||
|
||||
*-nbsp* <separator>:::
|
||||
a one character long separator that will replace non-breakable spaces
|
||||
a one character long separator that will replace non-breakable spaces,
|
||||
or an empty string to ignore them.
|
||||
|
||||
*-tab* <separator>:::
|
||||
a one character long separator that will replace tabulations
|
||||
a one character long separator that will replace tabulations,
|
||||
or an empty string to ignore them.
|
||||
|
||||
*-tabpad* <separator>:::
|
||||
a one character long separator that will be appended to tabulations to honor the *tabstop* option
|
||||
|
||||
*-indent* <separator>:::
|
||||
a one character long separator that will replace the first space in indentation according to the *indentwidth* option
|
||||
a one character long separator that will replace the first space in indentation
|
||||
according to the *indentwidth* option, or an empty string to ignore them.
|
||||
This will use the `WhitespaceIndent` face.
|
||||
|
||||
*-only-trailing*:::
|
||||
|
@ -8,7 +8,7 @@ hook global BufCreate .*[.](ex|exs) %{
|
||||
set-option buffer filetype elixir
|
||||
}
|
||||
|
||||
hook global BufCreate .*[.]html[.]l?eex %{
|
||||
hook global BufCreate .*[.]html[.][lh]?eex %{
|
||||
set-option buffer filetype eex
|
||||
}
|
||||
|
||||
@ -64,6 +64,7 @@ add-highlighter shared/elixir/single_string region "'" "(?<!\\)(?:\\\\)*'" fill
|
||||
add-highlighter shared/elixir/comment region '#' '$' fill comment
|
||||
|
||||
add-highlighter shared/elixir/leex region -match-capture '~L("""|")' '(?<!\\)(?:\\\\)*("""|")' ref eex
|
||||
add-highlighter shared/elixir/heex region -match-capture '~H("""|")' '(?<!\\)(?:\\\\)*("""|")' ref eex
|
||||
|
||||
add-highlighter shared/elixir/double_string/base default-region fill string
|
||||
add-highlighter shared/elixir/double_string/interpolation region -recurse \{ \Q#{ \} fill builtin
|
||||
|
@ -1,12 +1,14 @@
|
||||
provide-module fifo %{
|
||||
|
||||
define-command -params .. -docstring %{
|
||||
fifo [-name <buffer-name>] [-scroll] [--] <command>...: run command in a fifo buffer
|
||||
fifo [-name <name>] [-scroll] [-script <script>] [--] <args>...: run command in a fifo buffer
|
||||
if <script> is used, eval it with <args> as '$@', else pass arguments directly to the shell
|
||||
} fifo %{ evaluate-commands %sh{
|
||||
name='*fifo*'
|
||||
while true; do
|
||||
case "$1" in
|
||||
"-scroll") scroll="-scroll"; shift ;;
|
||||
"-script") script="$2"; shift 2 ;;
|
||||
"-name") name="$2"; shift 2 ;;
|
||||
"--") shift; break ;;
|
||||
*) break ;;
|
||||
@ -14,7 +16,11 @@ define-command -params .. -docstring %{
|
||||
done
|
||||
output=$(mktemp -d "${TMPDIR:-/tmp}"/kak-fifo.XXXXXXXX)/fifo
|
||||
mkfifo ${output}
|
||||
( eval "$@" > ${output} 2>&1 & ) > /dev/null 2>&1 < /dev/null
|
||||
if [ -n "$script" ]; then
|
||||
( eval "$script" > ${output} 2>&1 & ) > /dev/null 2>&1 < /dev/null
|
||||
else
|
||||
( "$@" > ${output} 2>&1 & ) > /dev/null 2>&1 < /dev/null
|
||||
fi
|
||||
|
||||
printf %s\\n "
|
||||
edit! -fifo ${output} ${scroll} ${name}
|
||||
|
@ -12,8 +12,7 @@ define-command -params .. -docstring %{
|
||||
Passing no argument will perform a literal-string grep for the current selection
|
||||
} grep %{
|
||||
evaluate-commands -try-client %opt{toolsclient} %{
|
||||
fifo -name *grep* %{
|
||||
shift 2
|
||||
fifo -name *grep* -script %{
|
||||
trap - INT QUIT
|
||||
if [ $# -eq 0 ]; then
|
||||
case "$kak_opt_grepcmd" in
|
||||
@ -29,7 +28,7 @@ define-command -params .. -docstring %{
|
||||
esac
|
||||
fi
|
||||
$kak_opt_grepcmd "$@" 2>&1 | tr -d '\r'
|
||||
} 'exit;' %arg{@} # pass arguments for "$@" above, exit to avoid evaluating them
|
||||
} %arg{@}
|
||||
set-option buffer filetype grep
|
||||
set-option buffer jump_current_line 0
|
||||
}
|
||||
|
@ -14,11 +14,10 @@ define-command -params .. -docstring %{
|
||||
} make %{
|
||||
evaluate-commands -try-client %opt{toolsclient} -save-regs a %{
|
||||
set-register a %opt{make_error_pattern} # save current error_pattern
|
||||
fifo -scroll -name *make* %{
|
||||
shift 2
|
||||
fifo -scroll -name *make* -script %{
|
||||
trap - INT QUIT
|
||||
$kak_opt_makecmd "$@"
|
||||
} 'exit;' %arg{@} # pass arguments for "$@" above, exit to avoid evaluating them
|
||||
} %arg{@} # pass arguments for "$@" above, exit to avoid evaluating them
|
||||
set-option buffer filetype make
|
||||
set-option buffer jump_current_line 0
|
||||
set-option buffer make_error_pattern %reg{a} # set the pattern to the value while firing the make command
|
||||
|
@ -981,18 +981,14 @@ struct ShowWhitespacesHighlighter : Highlighter
|
||||
bool only_trailing = (bool) parser.get_switch("only-trailing");
|
||||
auto get_param = [&](StringView param, StringView fallback) {
|
||||
StringView value = parser.get_switch(param).value_or(fallback);
|
||||
if (value.char_length() != 1)
|
||||
throw runtime_error{format("-{} expects a single character parameter", param)};
|
||||
if (value.char_length() > 1)
|
||||
throw runtime_error{format("-{} expects a single character or empty parameter", param)};
|
||||
return value.str();
|
||||
};
|
||||
|
||||
String indent = parser.get_switch("indent").value_or("│").str();
|
||||
if (indent.char_length() > 1)
|
||||
throw runtime_error{format("-indent expects a single character or empty parameter")};
|
||||
|
||||
return std::make_unique<ShowWhitespacesHighlighter>(
|
||||
get_param("tab", "→"), get_param("tabpad", " "), get_param("spc", "·"),
|
||||
get_param("lf", "¬"), get_param("nbsp", "⍽"), indent, only_trailing);
|
||||
get_param("lf", "¬"), get_param("nbsp", "⍽"), get_param("indent", "│"), only_trailing);
|
||||
}
|
||||
|
||||
private:
|
||||
@ -1043,28 +1039,28 @@ private:
|
||||
if (it != end)
|
||||
atom_it = line.split(atom_it, it.coord());
|
||||
|
||||
if (cp == '\t')
|
||||
if (cp == '\t' and not m_tab.empty() and not m_tabpad.empty())
|
||||
{
|
||||
const ColumnCount column = get_column(buffer, tabstop, coord);
|
||||
const ColumnCount count = tabstop - (column % tabstop);
|
||||
atom_it->replace(m_tab + String(m_tabpad[(CharCount)0], count - m_tab.column_length()));
|
||||
}
|
||||
else if (cp == ' ') {
|
||||
if (m_indent.empty() or indentwidth == 0 or not is_indentation) {
|
||||
atom_it->replace(m_spc);
|
||||
} else {
|
||||
else if (cp == ' ' and is_indentation and indentwidth > 0 and not m_indent.empty()) {
|
||||
const ColumnCount column = get_column(buffer, tabstop, coord);
|
||||
if (column % indentwidth == 0 and column != 0) {
|
||||
atom_it->replace(m_indent);
|
||||
face = indentface;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
atom_it->replace(m_spc);
|
||||
}
|
||||
}
|
||||
else if (cp == ' ' and not m_spc.empty()) {
|
||||
atom_it->replace(m_spc);
|
||||
}
|
||||
else if (cp == '\n')
|
||||
else if (cp == '\n' and not m_lf.empty())
|
||||
atom_it->replace(m_lf);
|
||||
else if (cp == 0xA0 or cp == 0x202F)
|
||||
else if ((cp == 0xA0 or cp == 0x202F) and not m_nbsp.empty())
|
||||
atom_it->replace(m_nbsp);
|
||||
atom_it->face = merge_faces(atom_it->face, face);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user