Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 31 additions & 6 deletions autoload/llama.vim
Original file line number Diff line number Diff line change
Expand Up @@ -245,13 +245,38 @@ function! llama#toggle_auto_fim()
call llama#setup_autocmds()
endfunction

function! llama#setup()
command! LlamaEnable call llama#enable()
command! LlamaDisable call llama#disable()
command! LlamaToggle call llama#toggle()
command! LlamaToggleAutoFim call llama#toggle_auto_fim()
function! llama#command(line1, line2, subcommand) abort
if a:subcommand ==# 'enable'
call llama#enable()
elseif a:subcommand ==# 'disable'
call llama#disable()
elseif a:subcommand ==# 'toggle'
call llama#toggle()
elseif a:subcommand ==# 'toggle-auto-fim'
call llama#toggle_auto_fim()
elseif a:subcommand ==# 'debug-toggle'
call llama_debug#toggle()
elseif a:subcommand ==# 'debug-clear'
call llama_debug#clear()
elseif a:subcommand ==# 'instruct'
call llama#inst(a:line1, a:line2)
else
echohl ErrorMsg
echo 'Unknown Llama subcommand: ' . a:subcommand
echohl None
endif
endfunction

command! -range=% LlamaInstruct call llama#inst(<line1>, <line2>)
" Tab completion options for :Llama command.
function! llama#completions(arg_lead, _cmd_line, _cursor_pos) abort
let l:options = ['enable', 'disable', 'toggle', 'toggle-auto-fim', 'debug-toggle', 'debug-clear', 'instruct']
" Filter options that start with what the user typed
return filter(copy(l:options), 'v:val =~# "^" . a:arg_lead')
endfunction

function! llama#setup()
" Define :Llama command with tab completion and range support.
command! -range=% -nargs=1 -complete=customlist,llama#completions Llama call llama#command(<line1>, <line2>, <q-args>)

call llama#debug_setup()
endfunction
Expand Down
3 changes: 0 additions & 3 deletions autoload/llama_debug.vim
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,4 @@ endfunction

function! llama_debug#setup() abort
call llama_debug#clear()

command! LlamaDebugClear call llama_debug#clear()
command! LlamaDebugToggle call llama_debug#toggle()
endfunction