File tree Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,29 @@ function! s:rand(i0, i1) abort
7373 return a: i0 + rand () % (a: i1 - a: i0 + 1 )
7474endfunction
7575
76+ let s: llama_enabled = v: true
77+
78+ function ! llama#disable ()
79+ call llama#fim_cancel ()
80+ autocmd ! llama
81+ silent ! iunmap <C-F>
82+ endfunction
83+
84+ function ! llama#toggle ()
85+ if s: llama_enabled
86+ call llama#disable ()
87+ else
88+ call llama#init ()
89+ endif
90+ let s: llama_enabled = ! s: llama_enabled
91+ endfunction
92+
93+ function llama#setup_commands ()
94+ command ! LlamaEnable call llama#init ()
95+ command ! LlamaDisable call llama#disable ()
96+ command ! LlamaToggle call llama#toggle ()
97+ endfunction
98+
7699function ! llama#init ()
77100 if ! executable (' curl' )
78101 echohl WarningMsg
@@ -81,6 +104,8 @@ function! llama#init()
81104 return
82105 endif
83106
107+ call llama#setup_commands ()
108+
84109 let s: pos_x = 0 " cursor position upon start of completion
85110 let s: pos_y = 0
86111
Original file line number Diff line number Diff line change @@ -21,6 +21,25 @@ Shortcut
2121- Ctrl+B - accept just the first word of the suggestion
2222- Ctrl+F - toggle FIM completion manually
2323
24+ ================================================================================
25+ Commands
26+
27+ *:LlamaDisable*
28+
29+ Disable the related autocommands and keymap for this vim/nvim session.
30+ Equivalent to vimscript function: `llama#disable ()`
31+
32+ *:LlamaEnable*
33+
34+ Enable the related autocommands and keymap for this vim/nvim session
35+ Equivalent to vimscript function: `llama#enable ()`
36+
37+ *:LlamaToggle*
38+
39+ Toggle the related autocommands and keymap for this vim/nvim session
40+ Equivalent to vimscript function: `llama#toggle ()`
41+
42+
2443================================================================================
2544How to start the server
2645
You can’t perform that action at this time.
0 commit comments