feat: vim user configurable bindings for accept/dismiss (#257)

* feat: update vim tabby-agent.js

* feat: vim configurable accept/dismiss bindings
sweep/improve-logging-information
Will Owens 2023-06-23 02:35:55 -04:00 committed by GitHub
parent 59b03ae477
commit b6845ddac0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 81 additions and 62 deletions

View File

@ -46,3 +46,15 @@ let g:tabby_server_url = 'http://127.0.0.1:8080'
1. In insert mode, Tabby will show code suggestion when you stop typing. Press `<Tab>` to accpet the current suggestion, `<M-]>` to see the next suggestion, `<M-[>` to see previous suggestion, or `<C-]>` to dismiss.
2. Use command `:Tabby enable` to enable, `:Tabby disable` to disable Tabby, and `:Tabby status` to check status.
3. Use command `:help Tabby` for more information.
## Configuration
### KeyBindings
The default key bindings for accept/dismiss(`<Tab>/<C-]>`) can be customized
with the following global settings.
```vimscript
let g:tabby_accept_binding = '<Tab>'
let g:tabby_dismiss_binding = '<C-]>'
```

File diff suppressed because one or more lines are too long

View File

@ -7,8 +7,15 @@ call tabby#Start()
command! -nargs=* -complete=customlist,tabby#CompleteCommands Tabby call tabby#Command(<q-args>)
imap <script><silent><nowait><expr> <Tab> tabby#Accept(pumvisible() ? "\<C-N>" : "\t")
imap <script><silent><nowait><expr> <C-]> tabby#Dismiss("\<C-]>")
if !exists('g:tabby_accept_binding')
let g:tabby_accept_binding = '<Tab>'
endif
if !exists('g:tabby_dismiss_binding')
let g:tabby_dismiss_binding = '<C-]>'
endif
exec 'imap <script><silent><nowait><expr> ' . g:tabby_accept_binding . ' tabby#Accept(pumvisible() ? "\<C-N>" : "\t")'
exec 'imap <script><silent><nowait><expr> ' . g:tabby_dismiss_binding . ' tabby#Dismiss("\<C-]>")'
imap <Plug>(tabby-next) <Cmd>call tabby#Next()<CR>
imap <Plug>(tabby-prev) <Cmd>call tabby#Prev()<CR>