1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-18 08:51:46 +03:00

Fix various posix shell compliance issues in the rc/ files

This commit is contained in:
Maxime Coste 2016-03-14 20:59:23 +00:00
parent dca9bccc6a
commit 09baf73152
3 changed files with 4 additions and 4 deletions

View File

@ -37,7 +37,7 @@ def -hidden -params .. _man %{ %sh{
def -params .. \
-shell-completion %{
prefix=${1:0:${kak_pos_in_token}}
prefix=$(echo "$1" | cut -c1-${kak_pos_in_token} 2>/dev/null)
for page in /usr/share/man/*/${prefix}*.[1-8]*; do
candidate=$(basename ${page%%.[1-8]*})
pagenum=$(printf %s "$page" | sed -r 's,^.+/.+\.([1-8][^.]*)\..+$,\1,')
@ -52,7 +52,7 @@ def -params .. \
pagenum=""
## The completion suggestions display the page number, strip them if present
if [[ $subject =~ [a-zA-Z_-]+\([^\)]+\) ]]; then
if expr "$subject" : '[a-zA-Z_-]+\([^\)]+\)'; then
pagenum=${subject##*\(}
pagenum=${pagenum:0:$((${#pagenum} - 1))}
subject=${subject%%\(*}

View File

@ -37,7 +37,7 @@ def clang-parse -params 0..1 -docstring "Parse the contents of the current buffe
*) ft=c++ ;;
esac
if [ "$1" == "-complete" ]; then
if [ "$1" = "-complete" ]; then
pos=-:${kak_cursor_line}:${kak_cursor_column}
header="${kak_cursor_line}.${kak_cursor_column}@${kak_timestamp}"
compl=$(clang++ -x ${ft} -fsyntax-only ${kak_opt_clang_options} \

View File

@ -29,7 +29,7 @@ def -params 1.. \
-docstring %sh{printf "%%{Git wrapping helper\navailable commands:\n add\n rm\n blame\n commit\n checkout\n diff\n hide-blame\n log\n show\n show-diff\n status\n update-diff}"} \
-shell-completion %{
shift $(expr ${kak_token_to_complete})
prefix=${1:0:${kak_pos_in_token}}
prefix=$(echo "${1}" | cut -c1-${kak_pos_in_token} 2>/dev/null)
(
for cmd in add rm blame commit checkout diff hide-blame log show show-diff status update-diff; do
expr "${cmd}" : "^\(${prefix}.*\)$"