Fix: Simplify neural buffer completion key loading

This commit is contained in:
Anexon
2023-12-28 16:32:09 +00:00
parent 0cbcb93c0a
commit e8295b4e4b
4 changed files with 5 additions and 13 deletions
-2
View File
@@ -38,8 +38,6 @@ endfunction
function! neural#buffer#CreateBuffer(options) abort
let l:buffer_options = s:GetOptions(a:options)
" echo l:buffer_options.name
" echo bufnr(l:buffer_options.name)
" TODO: Add auto incrementing buffer names instead of switching.
if bufexists(l:buffer_options.name)
+1 -1
View File
@@ -18,7 +18,7 @@ let s:defaults = {
\ 'echo_enabled': v:true,
\ },
\ 'buffer': {
\ 'completion_key': '\<C-CR>',
\ 'completion_key': '<C-CR>',
\ 'create_mode': 'vertical',
\ 'wrap': v:true,
\ },
+3 -9
View File
@@ -5,14 +5,8 @@ call neural#config#Load()
command! -buffer -nargs=0 NeuralRun :call neural#buffer#RunBuffer()
nnoremap <buffer> <Plug>(neural_completion) :NeuralRun<Return>
nnoremap <silent> <buffer> <Plug>(neural_completion) :NeuralRun<CR>
" Keybindings of Neural Buffer
if exists('*keytrans') && exists('g:neural.buffer.completion_key')
execute 'nnoremap ' . keytrans(g:neural.buffer.completion_key) . ' <Plug>(neural_completion)'
execute 'inoremap ' . keytrans(g:neural.buffer.completion_key) . ' <Esc><Plug>(neural_completion)'
else
nnoremap <C-CR> <Plug>(neural_completion)
inoremap <C-CR> <Esc><Plug>(neural_completion)
endif
execute 'nnoremap ' . g:neural.buffer.completion_key . ' <Plug>(neural_completion)'
execute 'inoremap ' . g:neural.buffer.completion_key . ' <Esc><Plug>(neural_completion)'
+1 -1
View File
@@ -73,7 +73,7 @@ Execute(The default neural buffer settings should be correct):
" AssertEqual {'echo_enabled': v:true}, g:neural.ui
AssertEqual
\ {
\ 'completion_key': '\<C-CR>',
\ 'completion_key': '<C-CR>',
\ 'create_mode': 'vertical',
\ 'wrap': v:true,
\ },