vim-php-namespace icon indicating copy to clipboard operation
vim-php-namespace copied to clipboard

Inserting a use statement switches off auto indentation

Open dbatten5 opened this issue 7 years ago • 0 comments

Using: NeoVim version 0.2.2

init.vim config:

" Alphabetisize the use statements
let g:php_namespace_sort_after_insert = 1

" Insert the use statement
function! IPhpInsertUse()
    call PhpInsertUse()
    call feedkeys('a',  'n')
endfunction
autocmd FileType php inoremap <leader>u <Esc>:call IPhpInsertUse()<CR>
autocmd FileType php noremap <leader>u :call PhpInsertUse()<CR><Paste>

" Expand a class name to the qualified name
function! IPhpExpandClass()
    call PhpExpandClass()
    call feedkeys('a', 'n')
endfunction
autocmd FileType php inoremap <leader>ex <Esc>:call IPhpExpandClass()<CR>
autocmd FileType php noremap <leader>ex :call PhpExpandClass()<CR>

Inserting a use statement works as expected but when I go to insert a new line, the cursor starts at the very start of the line as opposed to the correct indentation like so:

screen shot 2018-01-08 at 12 23 22 screen shot 2018-01-08 at 12 25 45

This can be rectified with the command :set autoindent but this only applies to the current buffer

dbatten5 avatar Jan 08 '18 12:01 dbatten5