Skip to content

Commit

Permalink
Fix: Simplify neural buffer completion key loading
Browse files Browse the repository at this point in the history
  • Loading branch information
Angelchev committed Dec 28, 2023
1 parent 0cbcb93 commit e8295b4
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 13 deletions.
2 changes: 0 additions & 2 deletions autoload/neural/buffer.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion autoload/neural/config.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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,
\ },
Expand Down
12 changes: 3 additions & 9 deletions ftplugin/neuralbuf.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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)'
2 changes: 1 addition & 1 deletion test/vim/test_config.vader
Original file line number Diff line number Diff line change
Expand Up @@ -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,
\ },
Expand Down

0 comments on commit e8295b4

Please sign in to comment.