Merge remote-tracking branch 'lenormf/doctrings_update'

This commit is contained in:
Maxime Coste 2015-08-04 23:08:21 +01:00
commit cfb3a668c1
9 changed files with 44 additions and 40 deletions

View File

@ -2,7 +2,7 @@
decl int autowrap_column 80 decl int autowrap_column 80
## Automatically wrap the selection ## Automatically wrap the selection
def autowrap-selection %{ def autowrap-selection -docstring "Wrap the selection" %{
try %{ try %{
## <a-:><a-;>: ensure that the cursor is located after the anchor, then reverse the ## <a-:><a-;>: ensure that the cursor is located after the anchor, then reverse the
## selection (make sure the cursor is at the beginning of the selection) ## selection (make sure the cursor is at the beginning of the selection)
@ -20,7 +20,7 @@ def autowrap-selection %{
} }
## Add a hook that will wrap the entire line every time a key is pressed ## Add a hook that will wrap the entire line every time a key is pressed
def autowrap-enable %{ def autowrap-enable -docstring "Wrap the lines in which characters are inserted" %{
hook -group autowrap window InsertChar [^\n] %{ hook -group autowrap window InsertChar [^\n] %{
try %{ try %{
exec -draft "<a-x>:autowrap-selection<ret>" exec -draft "<a-x>:autowrap-selection<ret>"
@ -29,6 +29,6 @@ def autowrap-enable %{
} }
## Disable the automatic line wrapping, autowrap-selection remains available though ## Disable the automatic line wrapping, autowrap-selection remains available though
def autowrap-disable %{ def autowrap-disable -docstring "Disable automatic line wrapping" %{
rmhooks window autowrap rmhooks window autowrap
} }

View File

@ -5,7 +5,7 @@ decl -hidden str-list clang_completions
decl -hidden line-flag-list clang_flags decl -hidden line-flag-list clang_flags
decl -hidden str clang_errors decl -hidden str clang_errors
def -shell-params clang-parse %{ def -shell-params clang-parse -docstring "Parse the contents of the current buffer with clang" %{
%sh{ %sh{
dir=$(mktemp -d -t kak-clang.XXXXXXXX) dir=$(mktemp -d -t kak-clang.XXXXXXXX)
mkfifo ${dir}/fifo mkfifo ${dir}/fifo
@ -85,9 +85,9 @@ def -shell-params clang-parse %{
} }
} }
def clang-complete %{ clang-parse -complete } def clang-complete -docstring "Complete the current selection with clang" %{ clang-parse -complete }
def clang-enable-autocomplete %{ def clang-enable-autocomplete -docstring "Enable completion with clang" %{
set window completers "option=clang_completions:%opt{completers}" set window completers "option=clang_completions:%opt{completers}"
hook window -group clang-autocomplete InsertIdle .* %{ try %{ hook window -group clang-autocomplete InsertIdle .* %{ try %{
exec -draft <a-h><a-k>(\.|->|::).\'<ret> exec -draft <a-h><a-k>(\.|->|::).\'<ret>
@ -97,7 +97,7 @@ def clang-enable-autocomplete %{
alias window complete clang-complete alias window complete clang-complete
} }
def clang-disable-autocomplete %{ def clang-disable-autocomplete -docstring "Disable automatic clang completion" %{
set window completers %sh{ echo "'${kak_opt_completers}'" | sed -e 's/option=clang_completions://g' } set window completers %sh{ echo "'${kak_opt_completers}'" | sed -e 's/option=clang_completions://g' }
rmhooks window clang-autocomplete rmhooks window clang-autocomplete
unalias window complete clang-complete unalias window complete clang-complete
@ -111,17 +111,17 @@ def -hidden clang-show-error-info %{ %sh{
done done
} } } }
def clang-enable-diagnostics %{ def clang-enable-diagnostics -docstring "Activate automatic diagnostics of the code by clang" %{
addhl flag_lines default clang_flags addhl flag_lines default clang_flags
hook window -group clang-diagnostics NormalIdle .* %{ clang-show-error-info } hook window -group clang-diagnostics NormalIdle .* %{ clang-show-error-info }
} }
def clang-disable-diagnostics %{ def clang-disable-diagnostics -docstring "Disable automatic diagnostics of the code" %{
rmhl hlflags_clang_flags rmhl hlflags_clang_flags
rmhooks window clang-diagnostics rmhooks window clang-diagnostics
} }
def clang-diagnostics-next %{ %sh{ def clang-diagnostics-next -docstring "Jump to the next line that contains an error" %{ %sh{
echo "${kak_opt_clang_errors}" | ( echo "${kak_opt_clang_errors}" | (
line=-1 line=-1
first_line=-1 first_line=-1

View File

@ -7,7 +7,7 @@ decl str-list ctagsfiles 'tags'
def -shell-params \ def -shell-params \
-shell-completion 'readtags -p "$1" | cut -f 1 | sort | uniq' \ -shell-completion 'readtags -p "$1" | cut -f 1 | sort | uniq' \
-docstring 'jump to tag definition' \ -docstring 'Jump to tag definition' \
tag \ tag \
%{ %sh{ %{ %sh{
export tagname=${1:-${kak_selection}} export tagname=${1:-${kak_selection}}
@ -25,7 +25,7 @@ def -shell-params \
END { print length(out) == 0 ? "echo -color Error no such tag " ENVIRON["tagname"] : "menu -auto-single " out }' END { print length(out) == 0 ? "echo -color Error no such tag " ENVIRON["tagname"] : "menu -auto-single " out }'
}} }}
def tag-complete %{ eval -draft %{ def tag-complete -docstring "Insert completion candidates for the current selection into the buffer's local variables" %{ eval -draft %{
exec <space>hb<a-k>^\w+$<ret> exec <space>hb<a-k>^\w+$<ret>
%sh{ ( %sh{ (
compl=$(readtags -p "$kak_selection" | cut -f 1 | sort | uniq | sed -e 's/:/\\:/g' | sed -e 's/\n/:/g' ) compl=$(readtags -p "$kak_selection" | cut -f 1 | sort | uniq | sed -e 's/:/\\:/g' | sed -e 's/\n/:/g' )
@ -34,8 +34,9 @@ def tag-complete %{ eval -draft %{
) > /dev/null 2>&1 < /dev/null & } ) > /dev/null 2>&1 < /dev/null & }
}} }}
def funcinfo %{ def ctags-funcinfo -docstring "Display ctags information about a selected function" %{
eval -draft %{ eval -draft %{
try %{
exec '[(;B<a-k>[a-zA-Z_]+\(<ret><a-;>' exec '[(;B<a-k>[a-zA-Z_]+\(<ret><a-;>'
%sh{ %sh{
sigs=$(readtags -e ${kak_selection%(} | grep kind:f | sed -re 's/^(\S+).*((class|struct|namespace):(\S+))?.*signature:(.*)$/\5 [\4::\1]/') sigs=$(readtags -e ${kak_selection%(} | grep kind:f | sed -re 's/^(\S+).*((class|struct|namespace):(\S+))?.*signature:(.*)$/\5 [\4::\1]/')
@ -44,18 +45,19 @@ def funcinfo %{
fi fi
} }
} }
}
} }
def ctags-enable-autoinfo %{ def ctags-enable-autoinfo -docstring "Automatically display ctags information about function" %{
hook window -group ctags-autoinfo NormalKey .* funcinfo hook window -group ctags-autoinfo NormalKey .* ctags-funcinfo
hook window -group ctags-autoinfo InsertKey .* funcinfo hook window -group ctags-autoinfo InsertKey .* ctags-funcinfo
} }
def ctags-disable-autoinfo %{ rmhooks window ctags-autoinfo } def ctags-disable-autoinfo -docstring "Disable automatic ctags information displaying" %{ rmhooks window ctags-autoinfo }
decl str ctagsopts "-R ." decl str ctagsopts "-R ."
def gentags -docstring 'generate tag file asynchronously' %{ def gentags -docstring 'Generate tag file asynchronously' %{
echo -color Information "launching tag generation in the background" echo -color Information "launching tag generation in the background"
%sh{ ( %sh{ (
if ctags -f .tags.kaktmp ${kak_opt_ctagsopts}; then if ctags -f .tags.kaktmp ${kak_opt_ctagsopts}; then

View File

@ -23,7 +23,7 @@ decl line-flag-list git_blame_flags
decl line-flag-list git_diff_flags decl line-flag-list git_diff_flags
def -shell-params \ def -shell-params \
-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=${1:0:${kak_pos_in_token}}

View File

@ -59,13 +59,13 @@ def -hidden _golang-indent-on-closing-curly-brace %[
try %[ exec -itersel -draft <a-h><a-k>^\h+\}$<ret>hms\`|.\'<ret>1<a-&> ] try %[ exec -itersel -draft <a-h><a-k>^\h+\}$<ret>hms\`|.\'<ret>1<a-&> ]
] ]
def golang-enable-gofmt %{ def golang-enable-gofmt -docstring "Format the code using the gofmt utility upon saving" %{
hook buffer -group golang-formatter BufWritePre .* %{ hook buffer -group golang-formatter BufWritePre .* %{
exec -draft %{%|"gofmt"<ret>} exec -draft %{%|"gofmt"<ret>}
} }
} }
def golang-disable-gofmt %{ def golang-disable-gofmt -docstring "Disable automatic code formatting" %{
rmhooks buffer golang-formatter rmhooks buffer golang-formatter
} }

View File

@ -3,7 +3,7 @@ decl str toolsclient
decl -hidden int _grep_current_line 0 decl -hidden int _grep_current_line 0
def -shell-params -file-completion \ def -shell-params -file-completion \
grep %{ %sh{ grep -docstring "Grep utility wrapper" %{ %sh{
output=$(mktemp -d -t kak-grep.XXXXXXXX)/fifo output=$(mktemp -d -t kak-grep.XXXXXXXX)/fifo
mkfifo ${output} mkfifo ${output}
if [ $# -gt 0 ]; then if [ $# -gt 0 ]; then
@ -34,14 +34,16 @@ hook global WinSetOption filetype=(?!grep).* %{ rmhl grep; rmhooks buffer grep-h
decl str jumpclient decl str jumpclient
def jump %{ def grep-jump %{
try %{
exec 'xs^((?:\w:)?[^:]+):(\d+):(\d+)?<ret>' exec 'xs^((?:\w:)?[^:]+):(\d+):(\d+)?<ret>'
set buffer _grep_current_line %val{cursor_line} set buffer _grep_current_line %val{cursor_line}
eval -try-client %opt{jumpclient} edit -existing %reg{1} %reg{2} %reg{3} eval -try-client %opt{jumpclient} edit -existing %reg{1} %reg{2} %reg{3}
try %{ focus %opt{jumpclient} } try %{ focus %opt{jumpclient} }
}
} }
def next -docstring 'Jump to next grep match' %{ def grep-next -docstring 'Jump to next grep match' %{
eval -try-client %opt{jumpclient} %{ eval -try-client %opt{jumpclient} %{
buffer '*grep*' buffer '*grep*'
exec "%opt{_grep_current_line}g<a-l>/^[^:]+:\d+:<ret>" exec "%opt{_grep_current_line}g<a-l>/^[^:]+:\d+:<ret>"
@ -49,7 +51,7 @@ def next -docstring 'Jump to next grep match' %{
} }
} }
def prev -docstring 'Jump to previous grep match' %{ def grep-prev -docstring 'Jump to previous grep match' %{
eval -try-client %opt{jumpclient} %{ eval -try-client %opt{jumpclient} %{
buffer '*grep*' buffer '*grep*'
exec "%opt{_grep_current_line}g<a-/>^[^:]+:\d+:<ret>" exec "%opt{_grep_current_line}g<a-/>^[^:]+:\d+:<ret>"

View File

@ -1,7 +1,7 @@
decl -hidden str jedi_tmp_dir decl -hidden str jedi_tmp_dir
decl -hidden str-list jedi_completions decl -hidden str-list jedi_completions
def jedi-complete %{ def jedi-complete -docstring "Complete the current selection with jedi" %{
%sh{ %sh{
dir=$(mktemp -d -t kak-jedi.XXXXXXXX) dir=$(mktemp -d -t kak-jedi.XXXXXXXX)
mkfifo ${dir}/fifo mkfifo ${dir}/fifo
@ -27,7 +27,7 @@ def jedi-complete %{
} }
} }
def jedi-enable-autocomplete %{ def jedi-enable-autocomplete -docstring "Add jedi completion candidates to the completer" %{
set window completers "option=jedi_completions:%opt{completers}" set window completers "option=jedi_completions:%opt{completers}"
hook window -group jedi-autocomplete InsertIdle .* %{ try %{ hook window -group jedi-autocomplete InsertIdle .* %{ try %{
exec -draft <a-h><a-k>\..\'<ret> exec -draft <a-h><a-k>\..\'<ret>
@ -37,7 +37,7 @@ def jedi-enable-autocomplete %{
alias window complete jedi-complete alias window complete jedi-complete
} }
def jedi-disable-autocomplete %{ def jedi-disable-autocomplete -docstring "Disable jedi completion" %{
set window completers %sh{ echo "'${kak_opt_completers}'" | sed -e 's/option=jedi_completions://g' } set window completers %sh{ echo "'${kak_opt_completers}'" | sed -e 's/option=jedi_completions://g' }
rmhooks window jedi-autocomplete rmhooks window jedi-autocomplete
unalias window complete jedi-complete unalias window complete jedi-complete

View File

@ -2,7 +2,7 @@ decl str makecmd make
decl str toolsclient decl str toolsclient
decl -hidden int _make_current_error_line decl -hidden int _make_current_error_line
def -shell-params make %{ %sh{ def -shell-params make -docstring "Make utility wrapper" %{ %sh{
output=$(mktemp -d -t kak-make.XXXXXXXX)/fifo output=$(mktemp -d -t kak-make.XXXXXXXX)/fifo
mkfifo ${output} mkfifo ${output}
( eval ${kak_opt_makecmd} "$@" > ${output} 2>&1 ) > /dev/null 2>&1 < /dev/null & ( eval ${kak_opt_makecmd} "$@" > ${output} 2>&1 ) > /dev/null 2>&1 < /dev/null &

View File

@ -44,7 +44,7 @@ def -shell-params \
esac esac
done done
} \ } \
man %{ %sh{ man -docstring "Manpages viewer wrapper" %{ %sh{
[ -z "$@" ] && set -- "$kak_selection" [ -z "$@" ] && set -- "$kak_selection"
echo "eval -try-client %opt{docsclient} _man $@" echo "eval -try-client %opt{docsclient} _man $@"
} } } }