Fix various posix shell compliance issues in the rc/ files
This commit is contained in:
parent
dca9bccc6a
commit
09baf73152
|
@ -37,7 +37,7 @@ def -hidden -params .. _man %{ %sh{
|
||||||
|
|
||||||
def -params .. \
|
def -params .. \
|
||||||
-shell-completion %{
|
-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
|
for page in /usr/share/man/*/${prefix}*.[1-8]*; do
|
||||||
candidate=$(basename ${page%%.[1-8]*})
|
candidate=$(basename ${page%%.[1-8]*})
|
||||||
pagenum=$(printf %s "$page" | sed -r 's,^.+/.+\.([1-8][^.]*)\..+$,\1,')
|
pagenum=$(printf %s "$page" | sed -r 's,^.+/.+\.([1-8][^.]*)\..+$,\1,')
|
||||||
|
@ -52,7 +52,7 @@ def -params .. \
|
||||||
pagenum=""
|
pagenum=""
|
||||||
|
|
||||||
## The completion suggestions display the page number, strip them if present
|
## 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=${subject##*\(}
|
||||||
pagenum=${pagenum:0:$((${#pagenum} - 1))}
|
pagenum=${pagenum:0:$((${#pagenum} - 1))}
|
||||||
subject=${subject%%\(*}
|
subject=${subject%%\(*}
|
||||||
|
|
|
@ -37,7 +37,7 @@ def clang-parse -params 0..1 -docstring "Parse the contents of the current buffe
|
||||||
*) ft=c++ ;;
|
*) ft=c++ ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [ "$1" == "-complete" ]; then
|
if [ "$1" = "-complete" ]; then
|
||||||
pos=-:${kak_cursor_line}:${kak_cursor_column}
|
pos=-:${kak_cursor_line}:${kak_cursor_column}
|
||||||
header="${kak_cursor_line}.${kak_cursor_column}@${kak_timestamp}"
|
header="${kak_cursor_line}.${kak_cursor_column}@${kak_timestamp}"
|
||||||
compl=$(clang++ -x ${ft} -fsyntax-only ${kak_opt_clang_options} \
|
compl=$(clang++ -x ${ft} -fsyntax-only ${kak_opt_clang_options} \
|
||||||
|
|
|
@ -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}"} \
|
-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 %{
|
-shell-completion %{
|
||||||
shift $(expr ${kak_token_to_complete})
|
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
|
for cmd in add rm blame commit checkout diff hide-blame log show show-diff status update-diff; do
|
||||||
expr "${cmd}" : "^\(${prefix}.*\)$"
|
expr "${cmd}" : "^\(${prefix}.*\)$"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user